Re: cataloguing NOT NULL constraints - Mailing list pgsql-hackers

From Alexander Lakhin
Subject Re: cataloguing NOT NULL constraints
Date
Msg-id d57b4a69-7394-3146-5976-9a1ef27e7972@gmail.com
Whole thread Raw
In response to Re: cataloguing NOT NULL constraints  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: cataloguing NOT NULL constraints
List pgsql-hackers
Hi Alvaro,

25.08.2023 14:38, Alvaro Herrera wrote:
I have now pushed this again.  Hopefully it'll stick this time.

I've found that after that commit the following query:
CREATE TABLE t(a int PRIMARY KEY) PARTITION BY RANGE (a);
CREATE TABLE tp1(a int);
ALTER TABLE t ATTACH PARTITION tp1 FOR VALUES FROM (0) to (1);

triggers a server crash:
Core was generated by `postgres: law regression [local] ALTER TABLE                                  '.
Program terminated with signal SIGSEGV, Segmentation fault.

warning: Section `.reg-xstate/2194811' in core file too small.
#0  0x0000556007711d77 in MergeAttributesIntoExisting (child_rel=0x7fc30ba309d8,
    parent_rel=0x7fc30ba33f18) at tablecmds.c:15771
15771                                   if (!((Form_pg_constraint) GETSTRUCT(contup))->connoinherit)
(gdb) bt
#0  0x0000556007711d77 in MergeAttributesIntoExisting (child_rel=0x7fc30ba309d8,
    parent_rel=0x7fc30ba33f18) at tablecmds.c:15771
#1  0x00005560077118d4 in CreateInheritance (child_rel=0x7fc30ba309d8, parent_rel=0x7fc30ba33f18)
    at tablecmds.c:15631
...

(gdb) print contup
$1 = (HeapTuple) 0x0

On b0e96f311~1 I get:
ERROR:  column "a" in child table must be marked NOT NULL

Best regards,
Alexander

pgsql-hackers by date:

Previous
From: Junwang Zhao
Date:
Subject: Re: Should we use MemSet or {0} for struct initialization?
Next
From: Alvaro Herrera
Date:
Subject: Re: cataloguing NOT NULL constraints