diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/catversion.h | 4 | ||||
-rw-r--r-- | src/include/commands/typecmds.h | 4 | ||||
-rw-r--r-- | src/include/nodes/execnodes.h | 34 | ||||
-rw-r--r-- | src/include/nodes/nodes.h | 9 | ||||
-rw-r--r-- | src/include/nodes/primnodes.h | 34 | ||||
-rw-r--r-- | src/include/parser/parse_coerce.h | 6 | ||||
-rw-r--r-- | src/include/utils/lsyscache.h | 3 |
7 files changed, 57 insertions, 37 deletions
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h index d234eb32895..df4347633f2 100644 --- a/src/include/catalog/catversion.h +++ b/src/include/catalog/catversion.h @@ -37,7 +37,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: catversion.h,v 1.174 2003/01/28 22:13:36 tgl Exp $ + * $Id: catversion.h,v 1.175 2003/02/03 21:15:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -53,6 +53,6 @@ */ /* yyyymmddN */ -#define CATALOG_VERSION_NO 200301281 +#define CATALOG_VERSION_NO 200302031 #endif diff --git a/src/include/commands/typecmds.h b/src/include/commands/typecmds.h index fde284efeaf..0d2e319ed44 100644 --- a/src/include/commands/typecmds.h +++ b/src/include/commands/typecmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: typecmds.h,v 1.4 2003/01/09 18:00:24 tgl Exp $ + * $Id: typecmds.h,v 1.5 2003/02/03 21:15:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -32,6 +32,8 @@ extern void AlterDomainAddConstraint(List *names, Node *constr); extern void AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior behavior); +extern List *GetDomainConstraints(Oid typeOid); + extern void AlterTypeOwner(List *names, AclId newOwnerSysId); #endif /* TYPECMDS_H */ diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 98c6f1ddfbd..ccb25320662 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: execnodes.h,v 1.92 2003/01/23 05:10:41 tgl Exp $ + * $Id: execnodes.h,v 1.93 2003/02/03 21:15:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -114,7 +114,7 @@ typedef struct ExprContext Datum *ecxt_aggvalues; /* precomputed values for Aggref nodes */ bool *ecxt_aggnulls; /* null flags for Aggref nodes */ - /* Value to substitute for ConstraintTestValue nodes in expression */ + /* Value to substitute for CoerceToDomainValue nodes in expression */ Datum domainValue_datum; bool domainValue_isNull; @@ -539,15 +539,37 @@ typedef struct CaseWhenState } CaseWhenState; /* ---------------- - * ConstraintTestState node + * CoerceToDomainState node * ---------------- */ -typedef struct ConstraintTestState +typedef struct CoerceToDomainState { ExprState xprstate; ExprState *arg; /* input expression */ - ExprState *check_expr; /* for CHECK test, a boolean expression */ -} ConstraintTestState; + /* Cached list of constraints that need to be checked */ + List *constraints; /* list of DomainConstraintState nodes */ +} CoerceToDomainState; + +/* + * DomainConstraintState - one item to check during CoerceToDomain + * + * Note: this is just a Node, and not an ExprState, because it has no + * corresponding Expr to link to. Nonetheless it is part of an ExprState + * tree, so we give it a name following the xxxState convention. + */ +typedef enum DomainConstraintType +{ + DOM_CONSTRAINT_NOTNULL, + DOM_CONSTRAINT_CHECK +} DomainConstraintType; + +typedef struct DomainConstraintState +{ + NodeTag type; + DomainConstraintType constrainttype; /* constraint type */ + char *name; /* name of constraint (for error msgs) */ + ExprState *check_expr; /* for CHECK, a boolean expression */ +} DomainConstraintState; /* ---------------------------------------------------------------- diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index bf8bb1719ed..a218790194e 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: nodes.h,v 1.135 2003/01/20 18:55:00 tgl Exp $ + * $Id: nodes.h,v 1.136 2003/02/03 21:15:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -114,8 +114,8 @@ typedef enum NodeTag T_CaseWhen, T_NullTest, T_BooleanTest, - T_ConstraintTest, - T_ConstraintTestValue, + T_CoerceToDomain, + T_CoerceToDomainValue, T_TargetEntry, T_RangeTblRef, T_JoinExpr, @@ -136,7 +136,8 @@ typedef enum NodeTag T_SubPlanState, T_CaseExprState, T_CaseWhenState, - T_ConstraintTestState, + T_CoerceToDomainState, + T_DomainConstraintState, /* * TAGS FOR PLANNER NODES (relation.h) diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index b187c98fdc7..ad1c7361255 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; /* diff --git a/src/include/parser/parse_coerce.h b/src/include/parser/parse_coerce.h index ecc61ea716a..ae12f46f621 100644 --- a/src/include/parser/parse_coerce.h +++ b/src/include/parser/parse_coerce.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parse_coerce.h,v 1.48 2002/10/24 22:09:00 tgl Exp $ + * $Id: parse_coerce.h,v 1.49 2003/02/03 21:15:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -45,8 +45,8 @@ extern bool can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids, CoercionContext ccontext); extern Node *coerce_type(Node *node, Oid inputTypeId, Oid targetTypeId, CoercionContext ccontext, CoercionForm cformat); -extern Node *coerce_type_constraints(Node *arg, Oid typeId, - CoercionForm cformat); +extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, Oid typeId, + CoercionForm cformat); extern Node *coerce_to_boolean(Node *node, const char *constructName); diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index 8200730f6a2..d6f9447d190 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: lsyscache.h,v 1.66 2003/01/15 19:35:47 tgl Exp $ + * $Id: lsyscache.h,v 1.67 2003/02/03 21:15:45 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -54,6 +54,7 @@ extern void get_typlenbyval(Oid typid, int16 *typlen, bool *typbyval); extern void get_typlenbyvalalign(Oid typid, int16 *typlen, bool *typbyval, char *typalign); extern char get_typstorage(Oid typid); +extern int32 get_typtypmod(Oid typid); extern Node *get_typdefault(Oid typid); extern char get_typtype(Oid typid); extern Oid get_typ_typrelid(Oid typid); |