Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qbeTD-00Cf4d-HU for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Aug 2023 10:00:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qbeTC-005gmD-AH for pgsql-hackers@arkaria.postgresql.org; Thu, 31 Aug 2023 10:00:10 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qbeTB-005gm1-W5 for pgsql-hackers@lists.postgresql.org; Thu, 31 Aug 2023 10:00:09 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qbeT7-001wiA-DX for pgsql-hackers@lists.postgresql.org; Thu, 31 Aug 2023 10:00:08 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4ff09632194so1254314e87.2 for ; Thu, 31 Aug 2023 03:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693476004; x=1694080804; darn=lists.postgresql.org; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=oh9RhgfLa+ajjEjjeYY/GBaWsK28cSdL+36rpeBQQW0=; b=F2j/bTxkNFoB1adkhHnHIbUJwghh4bbix3cDm/L5T1D+LhTYmRrQiJP6OmkeOJwJln R2EWPCrMUzawAe1RuMucgVwllNsOB381DAysvxGj2h37DN2q0QDqgewKfR0PsryZ+jjC p5n/AFix8g5YGLAGThw4PF6zKIqa/ZKMbSLiln0z8zWC3uJjj7tE/OsaTUxgsGEbBBpu f9tL2Tn0TNUa7K1aX1fb8B/57Uexlt2/X9ZZp982ZDxOe01e6eYivRxBhcecSuIVEEW8 kliCMZoX/g6pmE/eqob9PpEKGAenDQGK27RYe5jKC/ZFl7j5JZzr3GWCcdKlaFkJpjH6 88ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693476004; x=1694080804; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=oh9RhgfLa+ajjEjjeYY/GBaWsK28cSdL+36rpeBQQW0=; b=LRqa0B6hhXNH/Y0SCcbEQILFgvLgpntbDwElEegue6RLFnWgFAaxAyej26dJubaEej H0mh81CRITZpSdh0GCHqkImP88UFl4XWKsVB845Vz7xgJ0Hqsp+FhjeH2DhlxS417YTI DeHp2bRYwfhg1C45j1jkBywYoc3Qb1ZL5L6KA/A8z/CZl7L3sW6lZoEnmvjym/NDKw9Y UxL1HVmY3Loj2NpW2aHBw1WTpUaIVlKchseMz78TF5txhtYhRe7e59isaKim3I7YH3A3 9bfrTVdP+RdqL4l3PQxJurIzMVwZwOlX5XPOVsSalZis3KiO87dRYQLCHJyAvIHvRZ+m Q5yQ== X-Gm-Message-State: AOJu0YyT3Ek4/dzKsizDEKnyKflUZtt8jTQaM8RH4wCW+LrIgsgjI9jM bx417Zl41s84T/6UyzNG6Bg= X-Google-Smtp-Source: AGHT+IE/klrvcFC2xKUQ4vq3UlFHdn9VedZ+HZVXqvwAGNBXZIH2fIujRv9JdVdv9JuRuTMnkQE9gQ== X-Received: by 2002:a05:6512:3702:b0:4ff:8729:555 with SMTP id z2-20020a056512370200b004ff87290555mr3243020lfr.11.1693476003441; Thu, 31 Aug 2023 03:00:03 -0700 (PDT) Received: from [1.0.0.7] ([178.155.31.218]) by smtp.gmail.com with ESMTPSA id t24-20020ac243b8000000b00500968ddca9sm192107lfl.136.2023.08.31.03.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 31 Aug 2023 03:00:02 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------U0Y00ltV0YzvU9KzfMzlKYJ4" Message-ID: Date: Thu, 31 Aug 2023 13:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: cataloguing NOT NULL constraints Content-Language: en-US To: Alvaro Herrera , Dean Rasheed , Peter Eisentraut Cc: Robert Haas , pgsql-hackers@lists.postgresql.org References: <20230825113833.4li4xnii2h4r3mqd@alvherre.pgsql> From: Alexander Lakhin In-Reply-To: <20230825113833.4li4xnii2h4r3mqd@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------U0Y00ltV0YzvU9KzfMzlKYJ4 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 --------------U0Y00ltV0YzvU9KzfMzlKYJ4 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
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
--------------U0Y00ltV0YzvU9KzfMzlKYJ4--