Changing GENERATED ALWAYS AS expression - Mailing list pgsql-hackers

From Will Bryant
Subject Changing GENERATED ALWAYS AS expression
Date
Msg-id 42D90443-FA2C-4073-9896-7A4498AE7013@gmail.com
Whole thread Raw
List pgsql-hackers
Hello,

I’ve been testing out the 12 (beta) support for generated columns, mainly in order to add support for them to the
databasesynchronisation software I maintain (Kitchen Sync). 

So far it looks good compared to the similar functionality on MariaDB and MySQL (apart from VIRTUAL support which I see
waspulled out because it wasn’t ready). 

But I can’t see a way to change the expression for the generated column after its been created initially. I was looking
forsomething like the SET/DROP NOT NULL alter clauses, perhaps ALTER TABLE foo ALTER bar SET GENERATED ALWAYS AS (…)
STORED,but that doesn’t work and I can’t see anything in the docs.  (MySQL/MariaDB don’t have anything specific, but
theyhave the generic MODIFY column syntax which does allow you to change stored column definitions.) 

I can remove and add back the column, but that has the undesirable effect of changing the column order and requires
recreatingall the indexes etc. which gets messy. 

Any thoughts?  Will this be implemented later?

Cheers,
Will


pgsql-hackers by date:

Previous
From: Ronan Dunklau
Date:
Subject: Inconsistency between attname of index and attname of relation
Next
From: John Naylor
Date:
Subject: Re: benchmarking Flex practices