Re: ADD OR ALTER column - Mailing list pgsql-general

From Geoff Winkless
Subject Re: ADD OR ALTER column
Date
Msg-id CAEzk6fcdirrfQ40aj=OKnAgbzOURy-daOYbcdwTs6uK26pG9CQ@mail.gmail.com
Whole thread Raw
In response to Re: ADD OR ALTER column  ("Rakesh Kumar" <rakeshkumar464@mail.com>)
List pgsql-general
On 12 January 2018 at 13:56, Rakesh Kumar <rakeshkumar464@mail.com> wrote:
>I'm probably missing something, but can anyone see a reason why adding an ADD OR >ALTER COLUMN syntax to the ALTER TABLE command isn't either a) achievable or b) >desirable?
>It seems to me to be eminently useful and not overly difficult, while potentially >saving a significant amount of effort on the part of users.

what is your use case ?  Not sure what benefit you are talking about.

Having one script to ensure the user has the latest version of a db, without a significant amount of to-and-fro effort.

Actually I would probably rather have CREATE OR ALTER TABLE instead, with the syntax of CREATE TABLE but with an optional USING clause for each column for use if the column already existed and was of a non-implicitly-castable type, along with an optional WITH DROP COLUMNS [ * | name [,...] ] clause (to allow user to drop any (or specific) columns not in the new definition). 

That's likely to be rather more effort though, at first glance.

Geoff​

pgsql-general by date:

Previous
From: Andreas Joseph Krogh
Date:
Subject: Sv: ADD OR ALTER column
Next
From: Tom Kazimiers
Date:
Subject: Get IEEE754 bytes of real and double types for msgpack encoding