Skip site navigation (1) Skip section navigation (2)

pgsql: Rearrange ALTER TABLE syntax processing as per my recent

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Rearrange ALTER TABLE syntax processing as per my recent
Date: 2008-06-15 01:25:54
Message-ID: 20080615012554.D219F754595@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/doc/src/sgml/ref:
        alter_sequence.sgml (r1.21 -> r1.22)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/alter_sequence.sgml?r1=1.21&r2=1.22)
        alter_view.sgml (r1.3 -> r1.4)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/alter_view.sgml?r1=1.3&r2=1.4)
    pgsql/src/backend/commands:
        alter.c (r1.28 -> r1.29)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/alter.c?r1=1.28&r2=1.29)
        tablecmds.c (r1.256 -> r1.257)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/commands/tablecmds.c?r1=1.256&r2=1.257)
    pgsql/src/backend/parser:
        gram.y (r2.615 -> r2.616)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/gram.y?r1=2.615&r2=2.616)
    pgsql/src/backend/tcop:
        utility.c (r1.293 -> r1.294)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/tcop/utility.c?r1=1.293&r2=1.294)
    pgsql/src/include/commands:
        tablecmds.h (r1.39 -> r1.40)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/commands/tablecmds.h?r1=1.39&r2=1.40)

pgsql-committers by date

Next:From: Tom LaneDate: 2008-06-15 01:41:38
Subject: pgsql: Fix 64-bit problem in recent patch.
Previous:From: Alvaro HerreraDate: 2008-06-14 21:59:59
Subject: pgsql: In log_filename documentation, mention that strftime is not used

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group