pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
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: Fri, 3 May 2024 07:00:00 +0300
Message-ID: <7d0f1fea-0f1a-2c9f-9b02-867b73abee78@gmail.com> (raw)
In-Reply-To: <202405021621.ftmuhmfg7f2j@alvherre.pgsql>
References: <202405021621.ftmuhmfg7f2j@alvherre.pgsql>

02.05.2024 19:21, Alvaro Herrera wrote:

> Now, you could claim that the standard doesn't mention
> INCLUDING/EXCLUDING CONSTRAINTS, therefore since we have come up with
> its definition then we should make it affect not-null constraints.
> However, there's also this note:
>
>    NOTE 520 — <column constraint>s, except for NOT NULL, are not included in
>    CDi; <column constraint definition>s are effectively transformed to <table
>    constraint definition>s and are thereby also excluded.
>
> which is explicitly saying that not-null constraints are treated
> differently; in essence, with INCLUDING CONSTRAINTS we choose to affect
> the constraints that the standard says to ignore.

Thank you for very detailed and convincing explanation!

Now I see what the last sentence here (from [1]) means:
INCLUDING CONSTRAINTS

     CHECK constraints will be copied. No distinction is made between
     column constraints and table constraints. _Not-null constraints are
     always copied to the new table._

(I hadn't paid enough attention to it, because this exact paragraph is
also presented in previous versions...)

[1] https://www.postgresql.org/docs/devel/sql-createtable.html

Best regards,
Alexander





view thread (196+ messages)  latest in thread

Message-ID: <7d0f1fea-0f1a-2c9f-9b02-867b73abee78@gmail.com>
Permalink:  ../7d0f1fea-0f1a-2c9f-9b02-867b73abee78@gmail.com/
Also on:    postgresql.org/message-id/7d0f1fea-0f1a-2c9f-9b02-867b73abee78@gmail.com

 · 

reply

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: <7d0f1fea-0f1a-2c9f-9b02-867b73abee78@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