On 03.08.2020 11:00, Peter Eisentraut wrote:
On 2020-08-01 00:06, Konstantin Knizhnik wrote:
Postgres provides serial and bigserial column types for which it
implicitly creates sequence.
As far as this mechanism is somehow hidden from user, it may be
confusing that table
created with CREATE TABLE LIKE has no associated sequence.
That's why identity columns were added. You shouldn't use serial
columns anymore, especially if you are concerned about behaviors like
this.
I can completely agree with this position.
There are several things in Postgres which are conceptually similar,
share a lot of code but... following different rules.
Usually it happens when some new notion is introduced, fully or partly
substitute old notion.
Inheritance and declarative partitioning is one of such examples.
Although them are used to solve the same goal, there are many cases when
some optimization works for partitioned table but not for inheritance.
May be generated and identity columns are good things. I have nothing
against them.
But what preventing us from providing the similar behavior for
serial/bigseries types?