Re: ATTACH PARTITION seems to ignore column generation status

2023-02-16 Thread Tom Lane
Alvaro Herrera writes: > On 2023-Feb-16, Alexander Lakhin wrote: >> I've encountered a query that triggers an assert added in that commit: >> CREATE TABLE t(a int, b int GENERATED ALWAYS AS (a) STORED) PARTITION BY >> RANGE (a); >> CREATE TABLE tp PARTITION OF t(b DEFAULT 1) FOR VALUES FROM (0)

Re: ATTACH PARTITION seems to ignore column generation status

2023-02-16 Thread Alvaro Herrera
On 2023-Feb-16, Alexander Lakhin wrote: > I've encountered a query that triggers an assert added in that commit: > CREATE TABLE t(a int, b int GENERATED ALWAYS AS (a) STORED) PARTITION BY > RANGE (a); > CREATE TABLE tp PARTITION OF t(b DEFAULT 1) FOR VALUES FROM (0) to (1); It seems wrong that

Re: ATTACH PARTITION seems to ignore column generation status

2023-02-16 Thread Alexander Lakhin
Hello, 11.01.2023 23:58, Tom Lane wrote: Amit Langote writes: I've updated your disallow-generated-child-columns-2.patch to do this, and have also merged the delta post that I had attached with my last email, whose contents you sound to agree with. Pushed with some further work to improve

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-11 Thread Tom Lane
Amit Langote writes: > I noticed a typo in the doc additions, which I've attached a fix for. Doh, right, pushed. regards, tom lane

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-11 Thread Amit Langote
On Thu, Jan 12, 2023 at 5:58 AM Tom Lane wrote: > Amit Langote writes: > > I've updated your disallow-generated-child-columns-2.patch to do this, > > and have also merged the delta post that I had attached with my last > > email, whose contents you sound to agree with. > > Pushed with some

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-11 Thread Tom Lane
Amit Langote writes: > I've updated your disallow-generated-child-columns-2.patch to do this, > and have also merged the delta post that I had attached with my last > email, whose contents you sound to agree with. Pushed with some further work to improve the handling of multiple- inheritance

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-10 Thread Amit Langote
On Wed, Jan 11, 2023 at 7:13 AM Tom Lane wrote: > I wrote: > > Amit Langote writes: > >> Thanks for the patch. It looks good, though I guess you said that we > >> should also change the error message that CREATE TABLE ... PARTITION > >> OF emits to match the other cases while we're here. I've

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-10 Thread Tom Lane
I wrote: > Amit Langote writes: >> Thanks for the patch. It looks good, though I guess you said that we >> should also change the error message that CREATE TABLE ... PARTITION >> OF emits to match the other cases while we're here. I've attached a >> delta patch. > Thanks. I hadn't touched

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-09 Thread Tom Lane
Amit Langote writes: > Thanks for the patch. It looks good, though I guess you said that we > should also change the error message that CREATE TABLE ... PARTITION > OF emits to match the other cases while we're here. I've attached a > delta patch. Thanks. I hadn't touched that issue because I

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-09 Thread Amit Langote
On Tue, Jan 10, 2023 at 6:41 AM Tom Lane wrote: > I wrote: > > After thinking about this awhile, I feel that we ought to disallow > > it in the traditional-inheritance case as well. The reason is that > > there are semantic prohibitions on inserting or updating a generated > > column, eg > > >

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-09 Thread Tom Lane
I wrote: > After thinking about this awhile, I feel that we ought to disallow > it in the traditional-inheritance case as well. The reason is that > there are semantic prohibitions on inserting or updating a generated > column, eg > regression=# create table t (f1 int, f2 int generated always as

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-06 Thread Tom Lane
Amit Langote writes: > On Fri, Jan 6, 2023 at 3:53 AM Tom Lane wrote: >> I'm not sure to what extent it's sensible for partitions to have >> GENERATED columns that don't match their parent; but even if that's >> okay for payload columns I doubt we want to allow partitioning >> columns to be

Re: ATTACH PARTITION seems to ignore column generation status

2023-01-06 Thread Amit Langote
On Fri, Jan 6, 2023 at 3:53 AM Tom Lane wrote: > This does not seem good: > > regression=# create table pp (a int, b int) partition by range(a); > CREATE TABLE > regression=# create table cc (a int generated always as (b+1) stored, b int); > CREATE TABLE > regression=# alter table pp attach

ATTACH PARTITION seems to ignore column generation status

2023-01-05 Thread Tom Lane
This does not seem good: regression=# create table pp (a int, b int) partition by range(a); CREATE TABLE regression=# create table cc (a int generated always as (b+1) stored, b int); CREATE TABLE regression=# alter table pp attach partition cc for values from ('1') to ('10'); ALTER TABLE