pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: Erik Rijkers <er@xs4all.nl>
Cc: Sergei Kornilov <sk@zsrv.org>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Cc: Michael Paquier <michael.paquier@gmail.com>
Cc: Jaime Casanova <jaime.casanova@2ndquadrant.com>
Subject: Re: [HACKERS] generated columns
Date: Tue, 6 Nov 2018 22:16:33 +0100
Message-ID: <eba539b8-9d15-a708-1702-c3271c30ad52@2ndquadrant.com> (raw)
In-Reply-To: <CANP8+jJwr02Yt_ZD6XtAg-y8eQ5vg4VSEpXTkNM8P4t0iqHtYg@mail.gmail.com>
References: <b151f851-4019-bdb1-699e-ebab07d2f40a@2ndquadrant.com>
	<CAJGNTeOxeQPFpEr35PME4yLayRzP_wwzt70kFrPztSTWHf-HDA@mail.gmail.com>
	<CAJGNTeM+MCjA4dBhAdjJ-vR_CwY3u65cCcc+KvnahzLHZjxjbw@mail.gmail.com>
	<1bc948f8-3bab-6c54-50af-c0723a75b85f@2ndquadrant.com>
	<20180116063546.GA3679@paquier.xyz>
	<48502d9b-60c4-5b10-40a2-e34f562132b4@2ndquadrant.com>
	<20180119051804.GC12826@paquier.xyz>
	<2e3d5147-16f8-af0f-00ab-4c72cafc896f@2ndquadrant.com>
	<20180131131804.GB1586@paquier.xyz>
	<bf9c8765-1aa0-432a-442e-45f715ebe4e7@2ndquadrant.com>
	<20180202022532.GA84623@paquier.xyz>
	<050e663d-d915-f61b-af96-5a09c10ade02@2ndquadrant.com>
	<79e4de23-52e3-2c45-9ba0-5f6932f590aa@2ndquadrant.com>
	<28574501540912440@iva5-750e13568e4d.qloud-c.yandex.net>
	<728602640f3ad29c5a355b9ff50377b7@xs4all.nl>
	<6c9cc29a-64eb-d033-0909-b93f3a2b8c63@2ndquadrant.com>
	<CANP8+jJwr02Yt_ZD6XtAg-y8eQ5vg4VSEpXTkNM8P4t0iqHtYg@mail.gmail.com>

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




view thread (112+ messages)  latest in thread

Message-ID: <eba539b8-9d15-a708-1702-c3271c30ad52@2ndquadrant.com>
Permalink:  ../eba539b8-9d15-a708-1702-c3271c30ad52@2ndquadrant.com/
Also on:    postgresql.org/message-id/eba539b8-9d15-a708-1702-c3271c30ad52@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, simon@2ndquadrant.com, er@xs4all.nl, sk@zsrv.org, michael.paquier@gmail.com, jaime.casanova@2ndquadrant.com
  Subject: Re: [HACKERS] generated columns
  In-Reply-To: <eba539b8-9d15-a708-1702-c3271c30ad52@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox