aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/typecmds.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-12-12 15:49:42 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-12-12 15:49:42 +0000
commita0bf885f9eaccadd23b766ecbc064f17f06ae883 (patch)
tree62b65e5cf1a8ec02ece3a98c15457ddff018bb94 /src/backend/commands/typecmds.c
parentdebb072886efcb15e7f0825e35b168afe316d37d (diff)
downloadpostgresql-a0bf885f9eaccadd23b766ecbc064f17f06ae883.tar.gz
postgresql-a0bf885f9eaccadd23b766ecbc064f17f06ae883.zip
Phase 2 of read-only-plans project: restructure expression-tree nodes
so that all executable expression nodes inherit from a common supertype Expr. This is somewhat of an exercise in code purity rather than any real functional advance, but getting rid of the extra Oper or Func node formerly used in each operator or function call should provide at least a little space and speed improvement. initdb forced by changes in stored-rules representation.
Diffstat (limited to 'src/backend/commands/typecmds.c')
-rw-r--r--src/backend/commands/typecmds.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/backend/commands/typecmds.c b/src/backend/commands/typecmds.c
index d5260ad1190..e16942acd72 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.21 2002/12/09 20:31:05 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/typecmds.c,v 1.22 2002/12/12 15:49:24 tgl Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -1341,7 +1341,9 @@ AlterDomainAddConstraint(List *names, Node *newConstraint)
* the constraint is being added to.
*/
expr = stringToNode(ccbin);
+ fix_opfuncids(expr);
rels = get_rels_with_domain(domainoid);
+
foreach (rt, rels)
{
Relation typrel;
@@ -1522,7 +1524,7 @@ domainPermissionCheck(HeapTuple tup, TypeName *typename)
/*
- *
+ * domainAddConstraint
*/
char *
domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
@@ -1601,21 +1603,20 @@ domainAddConstraint(Oid domainOid, Oid domainNamespace, Oid baseTypeOid,
expr = eval_const_expressions(expr);
/*
- * Must fix opids in operator clauses.
+ * Convert to string form for storage.
*/
- fix_opids(expr);
-
ccbin = nodeToString(expr);
/*
- * Deparse it. Since VARNOs aren't allowed in domain
- * constraints, relation context isn't required as anything
- * other than a shell.
+ * Deparse it to produce text for consrc.
+ *
+ * Since VARNOs aren't allowed in domain constraints, relation context
+ * isn't required as anything other than a shell.
*/
ccsrc = deparse_expression(expr,
- deparse_context_for(domainName,
- InvalidOid),
- false, false);
+ deparse_context_for(domainName,
+ InvalidOid),
+ false, false);
/* Write the constraint */
CreateConstraintEntry(constr->name, /* Constraint Name */