Re: [HACKERS] generated columns - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: [HACKERS] generated columns
Date
Msg-id eba539b8-9d15-a708-1702-c3271c30ad52@2ndquadrant.com
Whole thread Raw
In response to Re: [HACKERS] generated columns  (Simon Riggs <simon@2ndquadrant.com>)
Responses Re: [HACKERS] generated columns
List pgsql-hackers
On 06/11/2018 14:28, Simon Riggs wrote:
>     The simplest solution would be to exclude generated columns from the
>     replication stream altogether.
> 
> 
> IMHO...
> 
> Virtual generated columns need not be WAL-logged, or sent.

right

> Stored generated columns should be treated just like we'd treat a column
> value added by a trigger.
> 
> e.g. if we had a Timestamp column called LastUpdateTimestamp we would
> want to send that value

Generated columns cannot have volatile expression results in them, so
this case cannot happen.

Also, we don't know whether the generation expression on the target is
the same (or even if it looks the same, consider locale issues etc.), so
we need to recompute the generated columns on the target anyway, so it's
pointless to send the already computed stored values.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: backend crash on DELETE, reproducible locally
Next
From: "Jonah H. Harris"
Date:
Subject: Re: Disallow setting client_min_messages > ERROR?