Re: partitioning and identity column

From: Alexander Lakhin <exclusion(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: partitioning and identity column
Date: 2024-04-26 18:00:01
Message-ID: efa3e50b-1782-c677-7f6f-c934db1a077c@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

26.04.2024 15:57, Ashutosh Bapat wrote:
> Thanks Alexander for the report.
>
> On Fri, Apr 26, 2024 at 5:30 PM Alexander Lakhin <exclusion(at)gmail(dot)com> wrote:
>
>
> CREATE TABLE tbl3 (LIKE tbl2 INCLUDING IDENTITY);
> ERROR:  no owned sequence found
>
>
> I don't think creating a table like a partition is common or even useful. Usually it would create it from partitithe
> oned table. But if we consider that to be a use case, I think the error is expected since a partition doesn't have its
> own identity; it shares it with the partitioned table. Maybe we could give a better message. But I will look into this
> and fix it if the solution makes sense.

Maybe it's uncommon, but it's allowed, so users may want to
CREATE TABLE sometable (LIKE partX INCLUDING ALL), for example, if the
partition has a somewhat different structure. And thinking about how such
a restriction could be described in the docs, I would prefer to avoid this
error at the implementation level.

>
> Do you want to track this in open items?
>

If you are inclined to fix this behavior,  I would add this item.

Best regards,
Alexander

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2024-04-26 18:04:25 Re: Why don't we support external input/output functions for the composite types
Previous Message Alexander Korotkov 2024-04-26 17:56:18 Re: New committers: Melanie Plageman, Richard Guo