Re: Can't find not null constraint, but \d+ shows that - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Can't find not null constraint, but \d+ shows that
Date
Msg-id 202404110910.dbwfcz47kpth@alvherre.pgsql
Whole thread Raw
In response to Re: Can't find not null constraint, but \d+ shows that  (jian he <jian.universality@gmail.com>)
Responses Re: Can't find not null constraint, but \d+ shows that
List pgsql-hackers
On 2024-Apr-11, jian he wrote:

> now I figured out that
> dropping a column of primary key columns will not change other key
> columns'  "not null" property.
> dropping the primary key associated constraint will make all key
> columns "not null" property disappear.

Well, I think you were right that we should try to handle the situation
of unmarking attnotnull as much as possible, to decrease the chances
that the problematic situation occurs.  That means, we can use the
earlier code to handle DROP COLUMN when it causes a PK to be dropped --
even though we still need to handle the situation of an attnotnull flag
set with no pg_constraint row.  I mean, we still have to handle DROP
DOMAIN correctly (and there might be other cases that I haven't thought
about) ... but surely this is a much less common situation than the one
you reported.  So I'll merge everything and post an updated patch.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
Bob [Floyd] used to say that he was planning to get a Ph.D. by the "green
stamp method," namely by saving envelopes addressed to him as 'Dr. Floyd'.
After collecting 500 such letters, he mused, a university somewhere in
Arizona would probably grant him a degree.              (Don Knuth)



pgsql-hackers by date:

Previous
From: Dmitry Koval
Date:
Subject: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
Next
From: "Daniel Westermann (DWE)"
Date:
Subject: [MASSMAIL]type in basebackup_incremental.c ?