git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51d2e3b)
Reconsider old decision to try to constant-fold default and constraint
Wed, 8 Jan 2003 22:06:23 +0000 (22:06 +0000)
Wed, 8 Jan 2003 22:06:23 +0000 (22:06 +0000)
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.


diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 3d671e92f3d422c1d286bb73f6dd548fe8b7f424..8d176c12cde6707326115f0e91d03c15cb3ab47e 100644 (file)
--- 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
@@ -1604,11 +1604,6 @@ AddRelationRawConstraints(Relation rel,
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.
@@ -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 3f9cad16ce4ce139560414de9bfc81372e585c44..84ea31885d67efb59de90bfd2197c79940257ff4 100644 (file)
--- 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 7d4ff1f0b649368d49f71f79fbde5e9cb9b356b9..379e4bb9b45eee930b245fc097c17a92a730b8b6 100644 (file)
--- 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
@@ -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.
*/
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /