1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-08 07:21:33 +03:00

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>
This commit is contained in:
Bruce Momjian 2002-04-24 02:42:27 +00:00
parent 19b31e0713
commit 244693744f

View File

@ -22,7 +22,7 @@
* *
* *
* IDENTIFICATION * 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++) for (j = 0; j < tblinfo[i].numatts; j++)
{ {
if (tblinfo[i].adef_expr[j] != NULL && tblinfo[i].inhAttrDef[j] == 0) if (tblinfo[i].adef_expr[j] != NULL && tblinfo[i].inhAttrDef[j] == 0) {
appendPQExpBuffer(q, "ALTER TABLE %s ALTER COLUMN %s SET DEFAULT %s;\n", appendPQExpBuffer(q, "ALTER TABLE %s ", fmtId(tblinfo[i].relname, force_quotes));
tblinfo[i].relname, tblinfo[i].attnames[j], appendPQExpBuffer(q, "ALTER COLUMN %s SET DEFAULT %s;\n",
fmtId(tblinfo[i].attnames[j], force_quotes),
tblinfo[i].adef_expr[j]); tblinfo[i].adef_expr[j]);
}
} }
commentDeps = malloc(sizeof(char *) * 2); commentDeps = malloc(sizeof(char *) * 2);