Re: [PATCH] rename column if exists - Mailing list pgsql-hackers

From Daniel Gustafsson
Subject Re: [PATCH] rename column if exists
Date
Msg-id EDA36731-4E04-4536-BFBD-F7393CDF6BD8@yesql.se
Whole thread Raw
In response to Re: [PATCH] rename column if exists  (Isaac Morland <isaac.morland@gmail.com>)
Responses Re: [PATCH] rename column if exists
List pgsql-hackers
> On 5 Nov 2021, at 13:03, Isaac Morland <isaac.morland@gmail.com> wrote:
>
> On Fri, 5 Nov 2021 at 05:21, Daniel Gustafsson <daniel@yesql.se <mailto:daniel@yesql.se>> wrote:
>
> > Same reasoning as for all the other if exists we have, idempotence. Being able to run the command on an object that
isalready in the desired state without provoking an error. 
>
> If the object is known to be in the desired state, there is no need to use IF
> EXISTS.  Personally I think IF EXISTS commands are useful when they provide a
> transition to a known end state, but in this case it's an unknown end state.
>
> The whole point of IF EXISTS, not to mention IF NOT EXISTS and OR REPLACE, is that the same script can run without
erroron a variety of existing schemas. They aren't (primarily) for typing directly at the psql prompt. At the time the
scriptis written, the state of the object when the script is run is unknown. 

I know that, I'm just not convinced that it's a feature (in the case at hand).

--
Daniel Gustafsson        https://vmware.com/




pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: pgsql: Fix WAL replay in presence of an incomplete record
Next
From: Alvaro Herrera
Date:
Subject: Re: pgsql: Fix WAL replay in presence of an incomplete record