1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-22 21:53:06 +03:00

Change ALTER TABLE SET WITHOUT OIDS to rewrite the whole table to physically

get rid of the OID column.  This eliminates the problem discovered by Heikki
back in November that 8.4's suppression of "unnecessary" junk filtering in
INSERT/SELECT could lead to an Assert failure, or storing of oids into a table
that shouldn't have them if Asserts are off.  While that particular problem
could have been solved in other ways, it seems likely to be just a forerunner
of things to come if we continue to allow tables to contain rows that disagree
with the pg_class.relhasoids setting.  It's better to make this operation slow
than to sacrifice performance or risk bugs in more common code paths.

Also, add ALTER TABLE SET WITH OIDS to rewrite the table to add oids.
This was a bit more controversial, but in view of the very small amount of
extra code needed given the current ALTER TABLE infrastructure, it seems best
to eliminate the asymmetry in features.
This commit is contained in:
Tom Lane
2009-02-11 21:11:16 +00:00
parent 68d95f12e7
commit 6d1e361852
6 changed files with 260 additions and 65 deletions

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.657 2009/02/02 19:31:39 alvherre Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.658 2009/02/11 21:11:16 tgl Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -1636,6 +1636,13 @@ alter_table_cmd:
n->behavior = $4;
$$ = (Node *)n;
}
/* ALTER TABLE <name> SET WITH OIDS */
| SET WITH OIDS
{
AlterTableCmd *n = makeNode(AlterTableCmd);
n->subtype = AT_AddOids;
$$ = (Node *)n;
}
/* ALTER TABLE <name> SET WITHOUT OIDS */
| SET WITHOUT OIDS
{