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

From David G. Johnston
Subject Re: [PATCH] rename column if exists
Date
Msg-id CAKFQuwYy6RHDwxaKu2zhogUQZZzoTqWrg9-xAkPtFZxk3H=6mQ@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] rename column if exists  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: [PATCH] rename column if exists
List pgsql-hackers
On Thursday, November 4, 2021, Daniel Gustafsson <daniel@yesql.se> wrote:
> On 22 Mar 2021, at 20:40, David Oksman <oksman.dav@gmail.com> wrote:
>
> Added the ability to specify IF EXISTS when renaming a column of an object (table, view, etc.).
> For example: ALTER TABLE distributors RENAME COLUMN IF EXISTS address TO city;
> If the column does not exist, a notice is issued instead of throwing an error.

What is the intended use-case for RENAME COLUMN IF EXISTS?  I'm struggling to
see when that would be helpful to users but I might not be imaginative enough.


Same reasoning as for all the other if exists we have, idempotence. Being able to run the command on an object that is already in the desired state without provoking an error.

David J.

pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: Automatic notification of top transaction IDs
Next
From: Ahmet Gedemenli
Date:
Subject: Possible Documentation Update for ALTER STATISTICS