pgsql: Allow CREATE FOREIGN TABLE to include SERIAL columns.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Allow CREATE FOREIGN TABLE to include SERIAL columns.
Date: 2013-05-15 23:03:42
Message-ID: E1UckjW-00075i-Ff@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow CREATE FOREIGN TABLE to include SERIAL columns.

The behavior is that the required sequence is created locally, which is
appropriate because the default expression will be evaluated locally.
Per gripe from Brad Nicholson that this case was refused with a confusing
error message. We could have improved the error message but it seems
better to just allow the case.

Also, remove ALTER TABLE's arbitrary prohibition against being applied to
foreign tables, which was pretty inconsistent considering we allow it for
views, sequences, and other relation types that aren't even called tables.
This is needed to avoid breaking pg_dump, which sometimes emits column
defaults using separate ALTER TABLE commands. (I think this can happen
even when the default is not associated with a sequence, so that was a
pre-existing bug once we allowed column defaults for foreign tables.)

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/b14206862278347a379f2bb72d92d16fb9dcea45

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 34 ++++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql | 14 ++++++++++
src/backend/commands/sequence.c | 7 +++--
src/backend/commands/tablecmds.c | 15 ++++------
4 files changed, 58 insertions(+), 12 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2013-05-16 16:30:45 pgsql: Fix some uses of "the quick brown fox".
Previous Message Peter Eisentraut 2013-05-15 01:14:12 pgsql: doc: Add \dm command to psql man page