diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-04-25 21:37:39 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-04-25 21:38:06 -0400 |
commit | 0bd11d9711b88e72d2022e25b9227c480aca4978 (patch) | |
tree | 762e3fdbdd38a313d68c41ac7ecca46fe4f8892d /src/backend/parser/parse_utilcmd.c | |
parent | 04f1542d390fdd95dadc66e86c623ecdc1bca401 (diff) | |
download | postgresql-0bd11d9711b88e72d2022e25b9227c480aca4978.tar.gz postgresql-0bd11d9711b88e72d2022e25b9227c480aca4978.zip |
Add comments warning against generalizing default_with_oids.
pg_dump has historically assumed that default_with_oids affects only plain
tables and not other relkinds. Conceivably we could make it apply to some
newly invented relkind if we did so from the get-go, but changing the
behavior for existing object types will break existing dump scripts.
Add code comments warning about this interaction.
Also, make sure that default_with_oids doesn't cause parse_utilcmd.c to
think that CREATE FOREIGN TABLE will create an OID column. I think this is
only a latent bug right now, since we don't allow UNIQUE/PKEY constraints
in CREATE FOREIGN TABLE, but it's better to be consistent and future-proof.
Diffstat (limited to 'src/backend/parser/parse_utilcmd.c')
-rw-r--r-- | src/backend/parser/parse_utilcmd.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/backend/parser/parse_utilcmd.c b/src/backend/parser/parse_utilcmd.c index 1fc8c2cbe1e..73924ae12e6 100644 --- a/src/backend/parser/parse_utilcmd.c +++ b/src/backend/parser/parse_utilcmd.c @@ -222,7 +222,18 @@ transformCreateStmt(CreateStmt *stmt, const char *queryString) cxt.blist = NIL; cxt.alist = NIL; cxt.pkey = NULL; - cxt.hasoids = interpretOidsOption(stmt->options, true); + + /* + * Notice that we allow OIDs here only for plain tables, even though + * foreign tables also support them. This is necessary because the + * default_with_oids GUC must apply only to plain tables and not any other + * relkind; doing otherwise would break existing pg_dump files. We could + * allow explicit "WITH OIDS" while not allowing default_with_oids to + * affect other relkinds, but it would complicate interpretOidsOption(), + * and right now there's no WITH OIDS option in CREATE FOREIGN TABLE + * anyway. + */ + cxt.hasoids = interpretOidsOption(stmt->options, !cxt.isforeign); Assert(!stmt->ofTypename || !stmt->inhRelations); /* grammar enforces */ |