Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 78a0914

Browse files
committed
binary migration: pg_migrator
Add comments about places where system oids have to be preserved for binary migration.
1 parent 2e9468f commit 78a0914

File tree

5 files changed

+29
-5
lines changed

5 files changed

+29
-5
lines changed

src/backend/catalog/pg_enum.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.9 2009/01/01 17:23:37 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/catalog/pg_enum.c,v 1.10 2009/12/19 00:47:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -67,6 +67,10 @@ EnumValuesCreate(Oid enumTypeOid, List *vals)
6767
oids = (Oid *) palloc(n * sizeof(Oid));
6868
for (i = 0; i < n; i++)
6969
{
70+
/*
71+
* The pg_enum.oid is stored in user tables. This oid must be
72+
* preserved by binary upgrades.
73+
*/
7074
oids[i] = GetNewOid(pg_enum);
7175
}
7276

src/backend/commands/typecmds.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.139 2009/12/07 05:22:21 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/typecmds.c,v 1.140 2009/12/19 00:47:57 momjian Exp $
1212
*
1313
* DESCRIPTION
1414
* The "DefineFoo" routines take the parse tree and pick out the
@@ -531,6 +531,12 @@ DefineType(List *names, List *parameters)
531531
* now have TypeCreate do all the real work.
532532
*/
533533
typoid =
534+
/*
535+
* The pg_type.oid is stored in user tables as array elements
536+
* (base types) in ArrayType and in composite types in
537+
* DatumTupleFields. This oid must be preserved by binary
538+
* upgrades.
539+
*/
534540
TypeCreate(InvalidOid, /* no predetermined type OID */
535541
typeName, /* type name */
536542
typeNamespace, /* namespace */

src/backend/utils/adt/arrayfuncs.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.161 2009/09/04 11:20:22 heikki Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.162 2009/12/19 00:47:57 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -328,6 +328,11 @@ array_in(PG_FUNCTION_ARGS)
328328
SET_VARSIZE(retval, nbytes);
329329
retval->ndim = ndim;
330330
retval->dataoffset = dataoffset;
331+
/*
332+
* This comes from the array's pg_type.typelem (which points to the
333+
* base data type's pg_type.oid) and stores system oids in user tables.
334+
* This oid must be preserved by binary upgrades.
335+
*/
331336
retval->elemtype = element_type;
332337
memcpy(ARR_DIMS(retval), dim, ndim * sizeof(int));
333338
memcpy(ARR_LBOUND(retval), lBound, ndim * sizeof(int));

src/backend/utils/adt/enum.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/utils/adt/enum.c,v 1.7 2009/01/01 17:23:49 momjian Exp $
10+
* $PostgreSQL: pgsql/src/backend/utils/adt/enum.c,v 1.8 2009/12/19 00:47:57 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -56,6 +56,10 @@ enum_in(PG_FUNCTION_ARGS)
5656
format_type_be(enumtypoid),
5757
name)));
5858

59+
/*
60+
* This comes from pg_enum.oid and stores system oids in user tables.
61+
* This oid must be preserved by binary upgrades.
62+
*/
5963
enumoid = HeapTupleGetOid(tup);
6064

6165
ReleaseSysCache(tup);

src/backend/utils/adt/rowtypes.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.25 2009/06/11 14:49:04 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/rowtypes.c,v 1.26 2009/12/19 00:47:57 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -97,6 +97,11 @@ record_in(PG_FUNCTION_ARGS)
9797
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
9898
errmsg("input of anonymous composite types is not implemented")));
9999
tupTypmod = -1; /* for all non-anonymous types */
100+
/*
101+
* This comes from the composite type's pg_type.oid and
102+
* stores system oids in user tables, specifically DatumTupleFields.
103+
* This oid must be preserved by binary upgrades.
104+
*/
100105
tupdesc = lookup_rowtype_tupdesc(tupType, tupTypmod);
101106
ncolumns = tupdesc->natts;
102107

0 commit comments

Comments
 (0)