On Thu, Oct 29, 2009 at 9:51 PM, Itagaki Takahiro
<itagaki.takah...@oss.ntt.co.jp> wrote:
>
> Heikki Linnakangas <heikki.linnakan...@enterprisedb.com> wrote:
>
>> > The keyword "PARTITION" is
>> > added to the full-reserved keyword list to support ADD/DROP PARTITION.
>>
>> Any chance to avoid that? PARTITION seems like something people might
>> well use as a column or variable name. OTOH, it is reserved in SQL2008
>> and SQL2003.
>
> CREATE TABLE does not require PARTITION to be a reserved keyword,
> but there are conflicts in ALTER TABLE ADD/DROP PARTITION:
>
>  * ALTER TABLE ... DROP [COLUMN]  name [CASCADE | RESTRICT]
>  * ALTER TABLE ... DROP PARTITION name [CASCADE | RESTRICT]
>
> There are some solutions:
>
>  1. Change COLUMN not to an optional word (unlikely)
>  2. Change syntax of DROP PARTITION to DROP TABLE PARITION or so
>  3. Change ALTER TABLE ADD/DROP PARTITION to top level
>      => CREATE/DROP PARTITION name ON table_name
>
> Any better ideas?

I'm not sure if this is better, but what about:

CREATE PARTITION name ON TABLE name
DROP PARTITION name

Since partitions will live in pg_class and are in some sense "top
level" objects, it seems like it would make sense to use a syntax that
is similar to the one we use for indices...  we can't say "DROP COLUMN
name", because the table must be specified.  But a partition name must
be unambiguous, so making the user write it out explicitly doesn't
seem friendly.

...Robert

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to