Re: [WIP] ALTER COLUMN IF EXISTS

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Bradley Ayers <bradley(dot)ayers(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [WIP] ALTER COLUMN IF EXISTS
Date: 2022-04-01 00:01:29
Message-ID: CAKFQuwbykodeu=XKbBf3entvGgkNM9=WFbh5eP5_NFo71nsYFw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Mar 31, 2022 at 4:39 PM Bradley Ayers <bradley(dot)ayers(at)gmail(dot)com>
wrote:

>
> I'm interested in adding more ergonomics to DDL commands, in
> particular supporting IF EXISTS for ALTER TABLE … ALTER COLUMN, so
> that if a column doesn't exist the command is skipped.
>
> IF EXISTS is already supported in various places (e.g. ALTER TABLE …
> ADD COLUMN IF NOT EXISTS, and ALTER TABLE … DROP COLUMN IF EXISTS),
> but it's not available for any of the ALTER COLUMN sub commands.
>

At present the project seems to largely consider the IF EXISTS/IF NOT
EXISTS features to have been largely a mistake and while removing it is not
going to happen the desire to change or extend it is not strong.

If you want to make a go at this I would suggest not writing any new code
at first but instead take inventory of what is already implemented, how it
is implemented, what gaps there are, and proposals to fill those gaps.
Write the theory/rules that we follow in our existing (or future)
implementation of this idempotence feature. Then get agreement to
implement the proposals from enough important people that a well-written
patch would be considered acceptable to commit.
I don't know if any amount of planning and presentation will convince
everyone this is a good idea in theory, let alone one that we want to
maintain while the author goes off to other projects (this being your first
patch that seems like a reasonable assumption).

I can say you have some community support in the endeavor but, and maybe
this is biasing me, my (fairly recent) attempt at what I considered
bug-fixing in this area was not accepted. On that note, as part of your
research, you should find the previous email threads on this topic (there
are quite a few I am sure), and make you own judgements from those. Aside
from it being my opinion I don't have any information at hand that isn't in
the email archives.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-04-01 00:25:39 Re: unlogged sequences
Previous Message Michail Nikolaev 2022-03-31 23:58:37 Re: [PATCH] Full support for index LP_DEAD hint bits on standby