diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-13 19:46:01 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-12-13 19:46:01 +0000 |
commit | 3a4f7dde16ad81b2319b9a4924a6023710a2fefd (patch) | |
tree | 248cf66fd94d40072b5ba8bb8e5437a6ea8399e5 /src/backend/commands/typecmds.c | |
parent | 77b7a740f95250af7d78f69e9c906c3e53f32e7b (diff) | |
download | postgresql-3a4f7dde16ad81b2319b9a4924a6023710a2fefd.tar.gz postgresql-3a4f7dde16ad81b2319b9a4924a6023710a2fefd.zip |
Phase 3 of read-only-plans project: ExecInitExpr now builds expression
execution state trees, and ExecEvalExpr takes an expression state tree
not an expression plan tree. The plan tree is now read-only as far as
the executor is concerned. Next step is to begin actually exploiting
this property.
Diffstat (limited to 'src/backend/commands/typecmds.c')
-rw-r--r-- | src/backend/commands/typecmds.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 989bc36ee82..fc0030fe762 100644 --- a/src/backend/commands/typecmds.c +++ b/src/backend/commands/typecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.23 2002/12/12 20:35:12 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.24 2002/12/13 19:45:52 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -1244,7 +1244,8 @@ AlterDomainAddConstraint(List *names, Node *newConstraint) Form_pg_type typTup; ExprContext *econtext; char *ccbin; - Node *expr; + Expr *expr; + ExprState *exprstate; int counter = 0; Constraint *constr; @@ -1336,10 +1337,11 @@ AlterDomainAddConstraint(List *names, Node *newConstraint) * Test all values stored in the attributes based on the domain * the constraint is being added to. */ - expr = stringToNode(ccbin); - fix_opfuncids(expr); + expr = (Expr *) stringToNode(ccbin); + fix_opfuncids((Node *) expr); + exprstate = ExecInitExpr(expr, NULL); - /* Make an expression context for ExecQual */ + /* Make an expression context for ExecEvalExpr */ econtext = MakeExprContext(NULL, CurrentMemoryContext); rels = get_rels_with_domain(domainoid); @@ -1375,7 +1377,7 @@ AlterDomainAddConstraint(List *names, Node *newConstraint) econtext->domainValue_datum = d; econtext->domainValue_isNull = isNull; - conResult = ExecEvalExpr(expr, econtext, &isNull, NULL); + conResult = ExecEvalExpr(exprstate, econtext, &isNull, NULL); if (!isNull && !DatumGetBool(conResult)) elog(ERROR, "AlterDomainAddConstraint: Domain %s constraint %s failed", |