diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-02-03 21:15:45 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-02-03 21:15:45 +0000 |
| commit | 3752e85bad45e98383ea1c9e7e7dbaf13f41da7e (patch) | |
| tree | ce6735a837cf169d82744b7877630494d35ce65a /src/include/nodes/primnodes.h | |
| parent | 464598b637cfabde01695a27a32ed8f133d127d7 (diff) | |
| download | postgresql-3752e85bad45e98383ea1c9e7e7dbaf13f41da7e.tar.gz | |
Determine the set of constraints applied to a domain at executor
startup, not in the parser; this allows ALTER DOMAIN to work correctly
with domain constraint operations stored in rules. Rod Taylor;
code review by Tom Lane.
Diffstat (limited to 'src/include/nodes/primnodes.h')
| -rw-r--r-- | src/include/nodes/primnodes.h | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index b187c98fdc..ad1c736125 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: primnodes.h,v 1.77 2003/01/10 21:08:15 tgl Exp $ + * $Id: primnodes.h,v 1.78 2003/02/03 21:15:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -578,28 +578,22 @@ typedef struct BooleanTest } BooleanTest; /* - * ConstraintTest + * CoerceToDomain * - * ConstraintTest represents the operation of testing a value to see whether - * it meets a constraint. If so, the input value is returned as the result; - * if not, an error is raised. + * CoerceToDomain represents the operation of coercing a value to a domain + * type. At runtime (and not before) the precise set of constraints to be + * checked will be determined. If the value passes, it is returned as the + * result; if not, an error is raised. Note that this is equivalent to + * RelabelType in the scenario where no constraints are applied. */ - -typedef enum ConstraintTestType -{ - CONSTR_TEST_NOTNULL, - CONSTR_TEST_CHECK -} ConstraintTestType; - -typedef struct ConstraintTest +typedef struct CoerceToDomain { Expr xpr; Expr *arg; /* input expression */ - ConstraintTestType testtype; /* test type */ - char *name; /* name of constraint (for error msgs) */ - char *domname; /* name of domain (for error messages) */ - Expr *check_expr; /* for CHECK test, a boolean expression */ -} ConstraintTest; + Oid resulttype; /* domain type ID (result type) */ + int32 resulttypmod; /* output typmod (currently always -1) */ + CoercionForm coercionformat; /* how to display this node */ +} CoerceToDomain; /* * Placeholder node for the value to be processed by a domain's check @@ -610,12 +604,12 @@ typedef struct ConstraintTest * the domain itself. This is because we shouldn't consider the value to * be a member of the domain if we haven't yet checked its constraints. */ -typedef struct ConstraintTestValue +typedef struct CoerceToDomainValue { Expr xpr; Oid typeId; /* type for substituted value */ int32 typeMod; /* typemod for substituted value */ -} ConstraintTestValue; +} CoerceToDomainValue; /* |
