aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_utilcmd.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-10-06 00:55:35 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-10-06 00:55:35 +0000
commit8e3384e35df25479371fb196ec49e58c7940a5a6 (patch)
treef9a8b5a218e0491848f9244b50974440e1af4471 /src/backend/parser/parse_utilcmd.c
parent83a673808dc3a47363eae6388bea8571e2bc07a3 (diff)
downloadpostgresql-8e3384e35df25479371fb196ec49e58c7940a5a6.tar.gz
postgresql-8e3384e35df25479371fb196ec49e58c7940a5a6.zip
Change CREATE TABLE so that column default expressions coming from different
inheritance parent tables are compared using equal(), instead of doing strcmp() on the nodeToString representation. The old implementation was always a tad cheesy, and it finally fails completely as of 8.4, now that the node tree might contain syntax location information. equal() knows it's supposed to ignore those fields, but strcmp() hardly can. Per recent report from Scott Ribe.
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r--src/backend/parser/parse_utilcmd.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c
index e5a3621cce6..4a9406ffbdd 100644
--- a/src/backend/parser/parse_utilcmd.c
+++ b/src/backend/parser/parse_utilcmd.c
@@ -19,7 +19,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.21 2009/06/11 14:49:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/parse_utilcmd.c,v 2.21.2.1 2009/10/06 00:55:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -642,7 +642,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
*/
if (attribute->atthasdef && including_defaults)
{
- char *this_default = NULL;
+ Node *this_default = NULL;
AttrDefault *attrdef;
int i;
@@ -653,7 +653,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
{
if (attrdef[i].adnum == parent_attno)
{
- this_default = attrdef[i].adbin;
+ this_default = stringToNode(attrdef[i].adbin);
break;
}
}
@@ -664,7 +664,7 @@ transformInhRelation(ParseState *pstate, CreateStmtContext *cxt,
* but it can't; so default is ready to apply to child.
*/
- def->cooked_default = pstrdup(this_default);
+ def->cooked_default = this_default;
}
}