Changing GENERATED ALWAYS AS expression

From: Will Bryant <will(dot)bryant(at)gmail(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Changing GENERATED ALWAYS AS expression
Date: 2019-07-05 10:42:35
Message-ID: 42D90443-FA2C-4073-9896-7A4498AE7013@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 database synchronisation 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 was pulled 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 for something 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 they have 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 recreating all the indexes etc. which gets messy.

Any thoughts? Will this be implemented later?

Cheers,
Will

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2019-07-05 10:54:16 Re: benchmarking Flex practices
Previous Message Ronan Dunklau 2019-07-05 10:37:25 Inconsistency between attname of index and attname of relation