Re: Adding a stored generated column without long-lived locks - Mailing list pgsql-hackers

From Matthias van de Meent
Subject Re: Adding a stored generated column without long-lived locks
Date
Msg-id CAEze2Wirgxfh7puw_9WTGyg6Aps1HPTHMAQ2TEJUjO0Tej4ZYQ@mail.gmail.com
Whole thread
In response to Re: Adding a stored generated column without long-lived locks  (Laurenz Albe <laurenz.albe@cybertec.at>)
List pgsql-hackers
On Fri, 2 Oct 2026 at 09:30, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
>
> You could simply require the constraint to be
>
>  ROW(col)::record *= ROW(expression)::record
>
> That would also behave as desired for NULL values.
>
> True, it looks hacky, but as you said, it is a constraint created
> for this special purpose.

I don't think that's a good solution:  Whilst it may work, it also
adds significant and potentially unnecessary overhead to the execution
of the CHECK constraint.  The added complexity in the expression
itself also increases the chance of a user defining the constraint
incorrectly.


Kind regards,

Matthias van de Meent
Databricks (https://www.databricks.com)



pgsql-hackers by date:

Previous
From: ahmed
Date:
Subject: Re: Use instr_time for pg_stat_database block read/write time counters
Next
From: Alexandre Felipe
Date:
Subject: Re: Throwing away unnecessary spin-locks