]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Some variants of ALTER OWNER tried to make the "object" field of the
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Feb 2008 21:08:25 +0000 (21:08 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 7 Feb 2008 21:08:25 +0000 (21:08 +0000)
statement be a list of bare C strings, rather than String nodes, which is
what they need to be for copyfuncs/equalfuncs to work.  Fortunately these
node types never go out to disk (if they did, we'd likely have noticed the
problem sooner), so we can just fix it without creating a need for initdb.
This bug has been there since 8.0, but 8.3 exposes it in a more common
code path (Parse messages) than prior releases did.  Per bug #3940 from
Vladimir Kokovic.

src/backend/commands/alter.c
src/backend/parser/gram.y

index 9bb40f351649531450827925231dc0d3b1220745..f407ec0859b87f8984dde8e158f3527992d29d63 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.12 2004/12/31 21:59:41 pgsql Exp $
+ *       $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.12.4.1 2008/02/07 21:08:25 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -168,7 +168,7 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
                        break;
 
                case OBJECT_DATABASE:
-                       AlterDatabaseOwner((char *) linitial(stmt->object), newowner);
+                       AlterDatabaseOwner(strVal(linitial(stmt->object)), newowner);
                        break;
 
                case OBJECT_FUNCTION:
@@ -187,11 +187,11 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
                        break;
 
                case OBJECT_SCHEMA:
-                       AlterSchemaOwner((char *) linitial(stmt->object), newowner);
+                       AlterSchemaOwner(strVal(linitial(stmt->object)), newowner);
                        break;
 
                case OBJECT_TABLESPACE:
-                       AlterTableSpaceOwner((char *) linitial(stmt->object), newowner);
+                       AlterTableSpaceOwner(strVal(linitial(stmt->object)), newowner);
                        break;
 
                case OBJECT_TYPE:
index 43f74fc011e83dddc0ca1ccf726f9ee85edffe57..8f94631cd704f97c53b6ad0883ef4c183c818d6d 100644 (file)
@@ -11,7 +11,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.481.4.1 2005/11/13 19:12:05 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.481.4.2 2008/02/07 21:08:25 tgl Exp $
  *
  * HISTORY
  *       AUTHOR                        DATE                    MAJOR EVENT
@@ -3751,7 +3751,7 @@ AlterOwnerStmt: ALTER AGGREGATE func_name '(' aggr_argtype ')' OWNER TO UserId
                                {
                                        AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
                                        n->objectType = OBJECT_DATABASE;
-                                       n->object = list_make1($3);
+                                       n->object = list_make1(makeString($3));
                                        n->newowner = $6;
                                        $$ = (Node *)n;
                                }
@@ -3794,7 +3794,7 @@ AlterOwnerStmt: ALTER AGGREGATE func_name '(' aggr_argtype ')' OWNER TO UserId
                                {
                                        AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
                                        n->objectType = OBJECT_SCHEMA;
-                                       n->object = list_make1($3);
+                                       n->object = list_make1(makeString($3));
                                        n->newowner = $6;
                                        $$ = (Node *)n;
                                }
@@ -3810,7 +3810,7 @@ AlterOwnerStmt: ALTER AGGREGATE func_name '(' aggr_argtype ')' OWNER TO UserId
                                {
                                        AlterOwnerStmt *n = makeNode(AlterOwnerStmt);
                                        n->objectType = OBJECT_TABLESPACE;
-                                       n->object = list_make1($3);
+                                       n->object = list_make1(makeString($3));
                                        n->newowner = $6;
                                        $$ = (Node *)n;
                                }