From: Alexander Lakhin <exclusion@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Andrew Bille <andrewbille@gmail.com>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: cataloguing NOT NULL constraints
Date: Thu, 2 May 2024 18:00:00 +0300
Message-ID: <83bfef0d-3e3c-e4c7-f6c4-29db5e632883@gmail.com> (raw)
In-Reply-To: <202405011749.txscey5apbn6@alvherre.pgsql>
References: <202405011749.txscey5apbn6@alvherre.pgsql>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: exclusion@gmail.com, alvherre@alvh.no-ip.org, dean.a.rasheed@gmail.com, andrewbille@gmail.com, peter@eisentraut.org, robertmhaas@gmail.com, pgsql-hackers@lists.postgresql.org
Subject: Re: cataloguing NOT NULL constraints
In-Reply-To: <83bfef0d-3e3c-e4c7-f6c4-29db5e632883@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox