*
*
* 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
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);
-
/*
* Constraints are evaluated with execQual, which expects an
* implicit-AND list, so convert expression to implicit-AND form.
* 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
format_type_be(type_id));
}
- /*
- * Might as well try to reduce any constant expressions.
- */
- expr = eval_const_expressions(expr);
-
return (expr);
}
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
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);
*
*
* 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
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.
*/