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

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.
This commit is contained in:
Bruce Momjian
2010-01-06 05:18:18 +00:00
parent 6f8d2008fc
commit 28f6cab61a
3 changed files with 18 additions and 6 deletions

View File

@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.365 2010/01/06 03:03:58 momjian Exp $ * $PostgreSQL: pgsql/src/backend/catalog/heap.c,v 1.366 2010/01/06 05:18:18 momjian Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
@@ -945,7 +945,8 @@ heap_create_with_catalog(const char *relname,
errmsg("only shared relations can be placed in pg_global tablespace"))); errmsg("only shared relations can be placed in pg_global tablespace")));
} }
if ((relkind == RELKIND_RELATION || relkind == RELKIND_SEQUENCE) && if ((relkind == RELKIND_RELATION || relkind == RELKIND_SEQUENCE ||
relkind == RELKIND_VIEW || relkind == RELKIND_COMPOSITE_TYPE) &&
OidIsValid(binary_upgrade_next_heap_relfilenode)) OidIsValid(binary_upgrade_next_heap_relfilenode))
{ {
relid = binary_upgrade_next_heap_relfilenode; relid = binary_upgrade_next_heap_relfilenode;

View File

@@ -12,7 +12,7 @@
* by PostgreSQL * by PostgreSQL
* *
* IDENTIFICATION * 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 ntups;
int i_attname; int i_attname;
int i_atttypdefn; int i_atttypdefn;
int i_typrelid;
int i; int i;
/* Set proper schema search path so type references list correctly */ /* 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 */ /* We assume here that remoteVersion must be at least 70300 */
appendPQExpBuffer(query, "SELECT a.attname, " 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 " "FROM pg_catalog.pg_type t, pg_catalog.pg_attribute a "
"WHERE t.oid = '%u'::pg_catalog.oid " "WHERE t.oid = '%u'::pg_catalog.oid "
"AND a.attrelid = t.typrelid " "AND a.attrelid = t.typrelid "
@@ -7222,9 +7224,15 @@ dumpCompositeType(Archive *fout, TypeInfo *tyinfo)
i_attname = PQfnumber(res, "attname"); i_attname = PQfnumber(res, "attname");
i_atttypdefn = PQfnumber(res, "atttypdefn"); i_atttypdefn = PQfnumber(res, "atttypdefn");
i_typrelid = PQfnumber(res, "typrelid");
if (binary_upgrade) 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_type_oids_by_type_oid(q, tyinfo->dobj.catId.oid);
binary_upgrade_set_relfilenodes(q, typrelid, false);
}
appendPQExpBuffer(q, "CREATE TYPE %s AS (", appendPQExpBuffer(q, "CREATE TYPE %s AS (",
fmtId(tyinfo->dobj.name)); fmtId(tyinfo->dobj.name));
@@ -10518,6 +10526,9 @@ dumpTableSchema(Archive *fout, TableInfo *tbinfo)
appendPQExpBuffer(delq, "%s;\n", appendPQExpBuffer(delq, "%s;\n",
fmtId(tbinfo->dobj.name)); 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", appendPQExpBuffer(q, "CREATE VIEW %s AS\n %s\n",
fmtId(tbinfo->dobj.name), viewdef); fmtId(tbinfo->dobj.name), viewdef);

View File

@@ -37,7 +37,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.568 2010/01/06 03:07:24 momjian Exp $ * $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.569 2010/01/06 05:18:18 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@@ -53,6 +53,6 @@
*/ */
/* yyyymmddN */ /* yyyymmddN */
#define CATALOG_VERSION_NO 201001052 #define CATALOG_VERSION_NO 201001061
#endif #endif