diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-06-15 01:25:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-06-15 01:25:54 +0000 |
commit | a0b012a1ab85ae115f30e5e4fe09922b4885fdad (patch) | |
tree | 135f60e46a2a1a7cf7c07fbc062ea5417adaf797 /src/include/commands/tablecmds.h | |
parent | bd2ef8707f27af1da91f4b4926e71e13e2b13149 (diff) | |
download | postgresql-a0b012a1ab85ae115f30e5e4fe09922b4885fdad.tar.gz postgresql-a0b012a1ab85ae115f30e5e4fe09922b4885fdad.zip |
Rearrange ALTER TABLE syntax processing as per my recent proposal: the
grammar allows ALTER TABLE/INDEX/SEQUENCE/VIEW interchangeably for all
subforms of those commands, and then we sort out what's really legal
at execution time. This allows the ALTER SEQUENCE/VIEW reference pages
to fully document all the ALTER forms available for sequences and views
respectively, and eliminates a longstanding cause of confusion for users.
The net effect is that the following forms are allowed that weren't before:
ALTER SEQUENCE OWNER TO
ALTER VIEW ALTER COLUMN SET/DROP DEFAULT
ALTER VIEW OWNER TO
ALTER VIEW SET SCHEMA
(There's no actual functionality gain here, but formerly you had to say
ALTER TABLE instead.)
Interestingly, the grammar tables actually get smaller, probably because
there are fewer special cases to keep track of.
I did not disallow using ALTER TABLE for these operations. Perhaps we
should, but there's a backwards-compatibility issue if we do; in fact
it would break existing pg_dump scripts. I did however tighten up
ALTER SEQUENCE and ALTER VIEW to reject non-sequences and non-views
in the new cases as well as a couple of cases where they didn't before.
The patch doesn't change pg_dump to use the new syntaxes, either.
Diffstat (limited to 'src/include/commands/tablecmds.h')
-rw-r--r-- | src/include/commands/tablecmds.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/include/commands/tablecmds.h b/src/include/commands/tablecmds.h index cdb80240169..d9e1a563728 100644 --- a/src/include/commands/tablecmds.h +++ b/src/include/commands/tablecmds.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.39 2008/06/14 18:04:34 tgl Exp $ + * $PostgreSQL: pgsql/src/include/commands/tablecmds.h,v 1.40 2008/06/15 01:25:54 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -28,7 +28,8 @@ extern void ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing); extern void AlterTableInternal(Oid relid, List *cmds, bool recurse); -extern void AlterTableNamespace(RangeVar *relation, const char *newschema); +extern void AlterTableNamespace(RangeVar *relation, const char *newschema, + ObjectType stmttype); extern void AlterRelationNamespaceInternal(Relation classRel, Oid relOid, Oid oldNspOid, Oid newNspOid, |