diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-08 22:06:23 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-01-08 22:06:23 +0000 |
commit | 2d140d35a4170a6ad20dae5c01a381b5b4a4b6a3 (patch) | |
tree | a9cb21aae59bbc611d32e2a39f604cfc4df8707b /src | |
parent | 51d2e3bd6e5b3c9f3bb7aef465bd4f8ce2527d78 (diff) | |
download | postgresql-2d140d35a4170a6ad20dae5c01a381b5b4a4b6a3.tar.gz postgresql-2d140d35a4170a6ad20dae5c01a381b5b4a4b6a3.zip |
Reconsider old decision to try to constant-fold default and constraint
expressions before they are stored. This seems like not such a hot idea,
particularly now that the constant-folder will try to inline SQL functions.
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/catalog/heap.c | 14 | ||||
-rw-r--r-- | src/backend/commands/tablecmds.c | 7 | ||||
-rw-r--r-- | src/backend/commands/typecmds.c | 7 |
3 files changed, 8 insertions, 20 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 3d671e92f3d..8d176c12cde 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.238 2002/12/16 18:39:22 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.239 2003/01/08 22:06:20 tgl Exp $ * * * INTERFACE ROUTINES @@ -1605,11 +1605,6 @@ AddRelationRawConstraints(Relation rel, elog(ERROR, "cannot use aggregate function in CHECK constraint expression"); /* - * Might as well try to reduce any constant expressions. - */ - expr = eval_const_expressions(expr); - - /* * Constraints are evaluated with execQual, which expects an * implicit-AND list, so convert expression to implicit-AND form. * (We could go so far as to convert to CNF, but that's probably @@ -1733,7 +1728,7 @@ cookDefault(ParseState *pstate, * column's type. We store the expression without coercion, however, * to avoid premature coercion in cases like * - * CREATE TABLE tbl (fld timestamp DEFAULT 'now'::text); + * CREATE TABLE tbl (fld timestamp DEFAULT 'now'); * * NB: this should match the code in rewrite/rewriteHandler.c that will * actually do the coercion, to ensure we don't accept an unusable @@ -1755,11 +1750,6 @@ cookDefault(ParseState *pstate, format_type_be(type_id)); } - /* - * Might as well try to reduce any constant expressions. - */ - expr = eval_const_expressions(expr); - return (expr); } diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 3f9cad16ce4..84ea31885d6 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.64 2002/12/30 19:45:17 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.65 2003/01/08 22:06:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -2756,7 +2756,10 @@ AlterTableAddCheckConstraint(Relation rel, Constraint *constr) elog(ERROR, "cannot use aggregate function in CHECK constraint expression"); /* - * Might as well try to reduce any constant expressions. + * Might as well try to reduce any constant expressions, so as to + * minimize overhead while testing the constraint at each row. + * + * Note that the stored form of the constraint will NOT be const-folded. */ expr = eval_const_expressions(expr); diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c index 7d4ff1f0b64..379e4bb9b45 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.28 2003/01/08 21:40:39 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.29 2003/01/08 22:06:23 tgl Exp $ * * DESCRIPTION * The "DefineFoo" routines take the parse tree and pick out the @@ -1624,11 +1624,6 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid, elog(ERROR, "cannot use aggregate function in CHECK constraint expression"); /* - * Might as well try to reduce any constant expressions. - */ - expr = eval_const_expressions(expr); - - /* * Convert to string form for storage. */ ccbin = nodeToString(expr); |