|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.172 2005/10/02 23:50:08 tgl Exp $ |
| 11 | + * $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.173 2005/10/03 02:45:12 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -2509,8 +2509,12 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap)
|
2509 | 2509 | {
|
2510 | 2510 | if (newrel)
|
2511 | 2511 | {
|
| 2512 | +OidtupOid=InvalidOid; |
| 2513 | + |
2512 | 2514 | /* Extract data from old tuple */
|
2513 | 2515 | heap_deform_tuple(tuple,oldTupDesc,values,isnull);
|
| 2516 | +if (oldTupDesc->tdhasoid) |
| 2517 | +tupOid=HeapTupleGetOid(tuple); |
2514 | 2518 |
|
2515 | 2519 | /* Set dropped attributes to null in new tuple */
|
2516 | 2520 | foreach (lc,dropped_attrs)
|
@@ -2539,6 +2543,10 @@ ATRewriteTable(AlteredTableInfo *tab, Oid OIDNewHeap)
|
2539 | 2543 | * be reset shortly.
|
2540 | 2544 | */
|
2541 | 2545 | tuple=heap_form_tuple(newTupDesc,values,isnull);
|
| 2546 | + |
| 2547 | +/* Preserve OID, if any */ |
| 2548 | +if (newTupDesc->tdhasoid) |
| 2549 | +HeapTupleSetOid(tuple,tupOid); |
2542 | 2550 | }
|
2543 | 2551 |
|
2544 | 2552 | /* Now check any constraints on the possibly-changed tuple */
|
|