Re: [PATCH] Alter or rename enum value

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: emre(at)hasegeli(dot)com
Cc: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Matthias Kurz <m(dot)kurz(at)irregular(dot)at>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Subject: Re: [PATCH] Alter or rename enum value
Date: 2016-09-05 18:10:22
Message-ID: 32710.1473099022@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Emre Hasegeli <emre(at)hasegeli(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mithun Cy 2016-09-05 18:50:23 Re: Cache Hash Index meta page.
Previous Message Tomas Vondra 2016-09-05 18:04:58 Re: Speed up Clog Access by increasing CLOG buffers