From: | Robert Haas <rhaas(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Refactor broken CREATE TABLE IF NOT EXISTS support. |
Date: | 2011-04-25 21:01:22 |
Message-ID: | E1QESuI-0003TZ-S7@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Refactor broken CREATE TABLE IF NOT EXISTS support.
Per bug #5988, reported by Marko Tiikkaja, and further analyzed by Tom
Lane, the previous coding was broken in several respects: even if the
target table already existed, a subsequent CREATE TABLE IF NOT EXISTS
might try to add additional constraints or sequences-for-serial
specified in the new CREATE TABLE statement.
In passing, this also fixes a minor information leak: it's no longer
possible to figure out whether a schema to which you don't have CREATE
access contains a sequence named like "x_y_seq" by attempting to create a
table in that schema called "x" with a serial column called "y".
Some more refactoring of this code in the future might be warranted,
but that will need to wait for a later major release.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/68ef051f5cf16f82a5368067a40ffba3c340b0d3
Modified Files
--------------
src/backend/bootstrap/bootparse.y | 3 +--
src/backend/catalog/heap.c | 19 +++----------------
src/backend/catalog/namespace.c | 29 +++++++++++++++++++++++++++++
src/backend/catalog/toasting.c | 3 +--
src/backend/commands/cluster.c | 3 +--
src/backend/commands/tablecmds.c | 29 ++++-------------------------
src/backend/executor/execMain.c | 12 ++----------
src/backend/parser/parse_utilcmd.c | 32 ++++++++++++++++++++++++++++----
src/backend/tcop/utility.c | 18 ++----------------
src/include/catalog/heap.h | 3 +--
src/include/catalog/namespace.h | 1 +
11 files changed, 73 insertions(+), 79 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2011-04-26 00:14:29 | pgsql: Remove incorrect HINT for use of ALTER FOREIGN TABLE on the wron |
Previous Message | Robert Haas | 2011-04-25 20:41:19 | pgsql: Remove partial and undocumented GRANT .. FOREIGN TABLE support. |