]> granicus.if.org Git - postgresql/commit
Fix CREATE TABLE ... LIKE ... WITH OIDS.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Dec 2016 21:23:33 +0000 (16:23 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 22 Dec 2016 21:23:38 +0000 (16:23 -0500)
commit1ead0208b2178089b024caa2d1465a3f3056a45c
tree8ac2cfe3f66343b05006d1cd5e0c6651b82c9ad3
parent22434dd06bbc5774c7bbffa5bf2bef3ead50c2f2
Fix CREATE TABLE ... LIKE ... WITH OIDS.

Having a WITH OIDS specification should result in the creation of an OID
column, but commit b943f502b broke that in the case that there were LIKE
tables without OIDS.  Commentary in that patch makes it look like this was
intentional, but if so it was based on a faulty reading of what inheritance
does: the parent tables can add an OID column, but they can't subtract one.
AFAICS, the behavior ought to be that you get an OID column if any of the
inherited tables, LIKE tables, or WITH clause ask for one.

Also, revert that patch's unnecessary split of transformCreateStmt's loop
over the tableElts list into two passes.  That seems to have been based on
a misunderstanding as well: we already have two-pass processing here,
we don't need three passes.

Per bug #14474 from Jeff Dafoe.  Back-patch to 9.6 where the misbehavior
was introduced.

Report: https://postgr.es/m/20161222145304.25620.47445@wrigleys.postgresql.org
src/backend/parser/parse_utilcmd.c
src/test/regress/expected/create_table_like.out
src/test/regress/sql/create_table_like.sql