Re: [PATCH] Alter or rename enum value - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Alter or rename enum value
Date
Msg-id 32710.1473099022@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Alter or rename enum value  (Emre Hasegeli <emre@hasegeli.com>)
Responses Re: [PATCH] Alter or rename enum value  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Emre Hasegeli <emre@hasegeli.com> writes:
>> I started looking at this patch.  I'm kind of unhappy with having *both*
>> IF EXISTS and IF NOT EXISTS options on the statement, especially since
>> the locations of those phrases in the syntax seem to have been chosen
>> with a dartboard.  This feels way more confusing than it is useful.
>> Is there really a strong use-case for either option?  I note that
>> ALTER TABLE RENAME COLUMN, which is probably used a thousand times
>> more often than this will be, has so far not grown either kind of option,
>> which sure makes me think that this proposal is getting ahead of itself.

> I think they can be useful.  I am writing a lot of migration scripts
> for small projects.  It really helps to be able to run parts of them
> again.  ALTER TYPE ... ADD VALUE already have IF NOT EXISTS option.  I
> don't think we would lose anything to support both of them in here.

The opportunity cost here is potential user confusion.  The only
closely parallel rename operation we have is ALTER TABLE RENAME COLUMN,
and that doesn't have a column-level IF EXISTS option; it has a
table-level IF EXISTS option.  So I think it would be weird and confusing
for ALTER TYPE RENAME VALUE to be different from that.  And again, it's
hard to get excited about having these options for RENAME VALUE when no
one has felt a need for them yet in RENAME COLUMN.  I'm especially dubious
about IF NOT EXISTS against the destination name, considering that there
isn't *any* variant of RENAME that has an equivalent of that.  If it's
really useful, why hasn't that happened?

I think we should leave these features out for now and wait to see if
there's really field demand for them.  If there is, it probably will
make sense to add them in more than just this one kind of RENAME.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Speed up Clog Access by increasing CLOG buffers
Next
From: Mithun Cy
Date:
Subject: Re: Cache Hash Index meta page.