Re: Confusing behavior of create table like

From: Konstantin Knizhnik <k(dot)knizhnik(at)postgrespro(dot)ru>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Confusing behavior of create table like
Date: 2020-08-03 12:58:55
Message-ID: 7f80abcf-ff62-3ca2-92f8-bc46035f545f@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2020-08-03 13:35:49 Re: recovering from "found xmin ... from before relfrozenxid ..."
Previous Message Tom Lane 2020-08-03 12:16:43 Re: [PATCH] Add section headings to index types doc