Re: [HACKERS] generated columns
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Michael Paquier <michael@paquier.xyz>,
pgsql-hackers <pgsql-hackers@postgresql.org>, Sergei Kornilov <sk@zsrv.org>,
Jaime Casanova <jaime.casanova@2ndquadrant.com>
Date: 2019-03-26T18:52:24Z
Lists: pgsql-hackers
Attachments
- regression.diffs (application/octet-stream)
- dblink.out (application/octet-stream)
Hi út 26. 3. 2019 v 14:33 odesílatel Peter Eisentraut < peter.eisentraut@2ndquadrant.com> napsal: > On 2019-03-20 03:51, Michael Paquier wrote: > > On Mon, Mar 18, 2019 at 03:14:09PM +0100, Pavel Stehule wrote: > >> postgres=# update foo set name = 'bbbxx' where id = 1; -- error > >> ERROR: no generation expression found for column number 3 of table > >> "foo" > > > > Yes I can see the problem after adding a generated column and dropping > > it on an INSERT query. > > fixed > > > + if (relid && attnum && get_attgenerated(relid, attnum)) > > Better to use OidIsValid here? > > fixed > > > + (walrcv_server_version(wrconn) >= 120000 ? "AND a.attgenerated = > ''" : ""), > > I think that it is better to always have version-related references > > stored as defines. > > A valid idea, but I don't see it widely done (see psql, pg_dump). > > > +CREATE TABLE gtest22a (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a > * 2) STORED UNIQUE); > > +CREATE TABLE gtest22b (a int, b int GENERATED ALWAYS AS (a * 2) STORED, > PRIMARY KEY (a, b)); > > Some tests for unique constraints with a generated column should be in > > place? > > done > > > It would be nice to have extra tests for forbidden expression types > > on generated columns especially SRF, subquery and aggregates/window > > functions. > > done > make check-world fails regards Pavel > -- > Peter Eisentraut http://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services >
Commits
-
Generated columns
- fc22b6623b6b 12.0 landed
-
Add walreceiver API to get remote server version
- 69039fda837d 12.0 landed
-
Add pg_partition_tree to display information about partitions
- d5eec4eefde7 12.0 cited
-
pg_restore: Augment documentation for -N option
- 2fe42baf7c1a 12.0 cited
-
Change delimiter used for display of NextXID
- 59a884e9854c 9.6.0 cited