1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

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.
This commit is contained in:
Tom Lane
2003-01-08 22:06:23 +00:00
parent 51d2e3bd6e
commit 2d140d35a4
3 changed files with 8 additions and 20 deletions

View File

@@ -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);

View File

@@ -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
@@ -1623,11 +1623,6 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
if (contain_agg_clause(expr))
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.
*/