diff options
author | Bruce Momjian <bruce@momjian.us> | 2002-04-24 02:42:27 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2002-04-24 02:42:27 +0000 |
commit | 244693744f46194a08626cc4d79e3ca2cb54dd89 (patch) | |
tree | e1ac72921debff192c3dce4cb0ebdec7189675e9 | |
parent | 19b31e0713a0cae74f4aaf74650d1a3b45fce396 (diff) | |
download | postgresql-244693744f46194a08626cc4d79e3ca2cb54dd89.tar.gz postgresql-244693744f46194a08626cc4d79e3ca2cb54dd89.zip |
Update patch for DEFAULT on Views.
Apparently, you need to make two calls to appendPQExpBuffer() to
use fmtId() twice, because it uses a static buffer (thanks for
spotting this Tom).
Another revision of the patch is attached.
Neil Conway <neilconway@rogers.com>
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 8eea64ca68a..c4b6352075f 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.252 2002/04/24 02:38:58 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.253 2002/04/24 02:42:27 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -4376,10 +4376,12 @@ dumpTables(Archive *fout, TableInfo *tblinfo, int numTables, */ for (j = 0; j < tblinfo[i].numatts; j++) { - if (tblinfo[i].adef_expr[j] != NULL && tblinfo[i].inhAttrDef[j] == 0) - appendPQExpBuffer(q, "ALTER TABLE %s ALTER COLUMN %s SET DEFAULT %s;\n", - tblinfo[i].relname, tblinfo[i].attnames[j], + if (tblinfo[i].adef_expr[j] != NULL && tblinfo[i].inhAttrDef[j] == 0) { + appendPQExpBuffer(q, "ALTER TABLE %s ", fmtId(tblinfo[i].relname, force_quotes)); + appendPQExpBuffer(q, "ALTER COLUMN %s SET DEFAULT %s;\n", + fmtId(tblinfo[i].attnames[j], force_quotes), tblinfo[i].adef_expr[j]); + } } commentDeps = malloc(sizeof(char *) * 2); |