Re: [HACKERS] generated columns
John Naylor <jcnaylor@gmail.com>
From: John Naylor <jcnaylor@gmail.com>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2018-11-01T09:46:31Z
Lists: pgsql-hackers
On 10/30/18, Peter Eisentraut <peter.eisentraut@2ndquadrant.com> wrote: > 3. Radical alternative: Collapse everything into one new column. We > could combine atthasdef and attgenerated and even attidentity into a new > column. (Only one of the three can be the case.) This would give > client code a clean break, which may or may not be good. The > implementation would be uglier than #1 but probably cleaner than #2. We > could also get 4 bytes back per pg_attribute row. Thinking about the distinction between 'stored' and 'virtual', I immediately thought of atthasmissing. In a way it indicates that there is a virtual default value. It seems the level of materialization is an orthogonal concept to the kind of value we have. What if attgenerated had d = normal default value i = identity default a = identity always c = generated column and in addition there was an attmaterialized column with s = stored v = virtual In this scheme, -Normal attribute: '\0' + 's' -Default value: 'd' + 's' -Fast default: 'd' + 'v' until the table is rewritten -Identity column: 'i'/'a' + 's' -Generated column: 'c' + 's'/'v' This way, we'd still end up with 1 fewer column (2 new ones minus atthasdef, attidentity, and atthasmissing). A bit crazier, what if "d = dropped" was another allowed value in attmaterialized -- we could then get rid of attisdropped as well. That has obvious disadvantages, but the broader idea is that this design may have use cases we haven't thought of yet. Thoughts? -John Naylor
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