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

From Alexander Lakhin
Subject Re: cataloguing NOT NULL constraints
Date
Msg-id 83bfef0d-3e3c-e4c7-f6c4-29db5e632883@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
Hello Alvaro,

01.05.2024 20:49, Alvaro Herrera wrote:
> Here are two patches that I intend to push soon (hopefully tomorrow).
>

Thank you for fixing those issues!

Could you also clarify, please, how CREATE TABLE ... LIKE is expected to
work with NOT NULL constraints?

I wonder whether EXCLUDING CONSTRAINTS (ALL) should cover not-null
constraints too. What I'm seeing now, is that:
CREATE TABLE t1 (i int, CONSTRAINT nn NOT NULL i);
CREATE TABLE t2 (LIKE t1 EXCLUDING ALL);
\d+ t2
-- ends with:
Not-null constraints:
     "nn" NOT NULL "i"

Or a similar case with PRIMARY KEY:
CREATE TABLE t1 (i int PRIMARY KEY);
CREATE TABLE t2 (LIKE t1 EXCLUDING CONSTRAINTS EXCLUDING INDEXES);
\d+ t2
-- leaves:
Not-null constraints:
     "t2_i_not_null" NOT NULL "i"

Best regards,
Alexander



pgsql-hackers by date:

Previous
From: Maxim Orlov
Date:
Subject: Re: Build with meson + clang + sanitizer resulted in undefined reference
Next
From: Peter Geoghegan
Date:
Subject: Re: Limit index pages visited in planner's get_actual_variable_range