summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorBruce Momjian2010-01-06 05:18:18 +0000
committerBruce Momjian2010-01-06 05:18:18 +0000
commit28f6cab61ab8958b1a7dfb019724687d92722538 (patch)
tree109009a3d3cc314357f1cb528669680b39560644 /src/bin
parent6f8d2008fcb4a866567f1ceaf76e0da5a66eab29 (diff)
binary upgrade:
Preserve relfilenodes for views and composite types --- even though we don't store data in, them, they do consume relfilenodes. Bump catalog version.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/pg_dump/pg_dump.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index cff6832cd56..6c9cb886b99 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -12,7 +12,7 @@
* by PostgreSQL
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.565 2010/01/06 03:04:02 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.566 2010/01/06 05:18:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -7192,6 +7192,7 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
int ntups;
int i_attname;
int i_atttypdefn;
+ int i_typrelid;
int i;
/* Set proper schema search path so type references list correctly */
@@ -7201,7 +7202,8 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
/* We assume here that remoteVersion must be at least 70300 */
appendPQExpBuffer(query, "SELECT a.attname, "
- "pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn "
+ "pg_catalog.format_type(a.atttypid, a.atttypmod) AS atttypdefn, "
+ "typrelid "
"FROM pg_catalog.pg_type t, pg_catalog.pg_attribute a "
"WHERE t.oid = '%u'::pg_catalog.oid "
"AND a.attrelid = t.typrelid "
@@ -7222,9 +7224,15 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
i_attname = PQfnumber(res, "attname");
i_atttypdefn = PQfnumber(res, "atttypdefn");
+ i_typrelid = PQfnumber(res, "typrelid");
if (binary_upgrade)
+ {
+ Oid typrelid = atooid(PQgetvalue(res, 0, i_typrelid));
+
binary_upgrade_set_type_oids_by_type_oid(q, tyinfo->dobj.catId.oid);
+ binary_upgrade_set_relfilenodes(q, typrelid, false);
+ }
appendPQExpBuffer(q, "CREATE TYPE %s AS (",
fmtId(tyinfo->dobj.name));
@@ -10518,6 +10526,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
appendPQExpBuffer(delq, "%s;\n",
fmtId(tbinfo->dobj.name));
+ if (binary_upgrade)
+ binary_upgrade_set_relfilenodes(q, tbinfo->dobj.catId.oid, false);
+
appendPQExpBuffer(q, "CREATE VIEW %s AS\n %s\n",
fmtId(tbinfo->dobj.name), viewdef);