Re: Can't find not null constraint, but \d+ shows that

Поиск
Список
Период
Сортировка
От jian he
Тема Re: Can't find not null constraint, but \d+ shows that
Дата
Msg-id CACJufxEOzyt+NmbaoABY0pskX73ps=LFdKNDNUSiniSHBfY5Hg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Can't find not null constraint, but \d+ shows that  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Ответы Re: Can't find not null constraint, but \d+ shows that
Список pgsql-hackers
On Wed, Apr 10, 2024 at 1:29 AM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
>
> On 2024-Mar-29, Tender Wang wrote:
>
> > I think aboved case can explain what's meaning about comments in
> > dropconstraint_internal.
> > But here, in RemoveConstraintById() , we only care about primary key case,
> > so NOT NULL is better to removed from comments.
>
> Actually, I think it's better if all the resets of attnotnull occur in
> RemoveConstraintById, for both types of constraints; we would keep that
> block in dropconstraint_internal only to raise errors in the cases where
> the constraint is protecting a replica identity or a generated column.
> Something like the attached, perhaps, may need more polish.
>

DROP TABLE if exists notnull_tbl2;
CREATE TABLE notnull_tbl2 (c0 int generated by default as IDENTITY, c1 int);
ALTER TABLE notnull_tbl2 ADD CONSTRAINT Q PRIMARY KEY(c0, c1);
ALTER TABLE notnull_tbl2 DROP CONSTRAINT notnull_tbl2_c0_not_null;
ALTER TABLE notnull_tbl2 DROP c1;
\d notnull_tbl2

last "\d notnull_tbl2" command, master output is:
                        Table "public.notnull_tbl2"
 Column |  Type   | Collation | Nullable |             Default
--------+---------+-----------+----------+----------------------------------
 c0     | integer |           | not null | generated by default as identity



last "\d notnull_tbl2" command, applying
0001-Correctly-reset-attnotnull-when-constraints-dropped-.patch
output:
                        Table "public.notnull_tbl2"
 Column |  Type   | Collation | Nullable |             Default
--------+---------+-----------+----------+----------------------------------
 c0     | integer |           |          | generated by default as identity


there may also have similar issues with  the replicate identity.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Rowley
Дата:
Сообщение: Re: Incorrect handling of IS [NOT] NULL quals on inheritance parents
Следующее
От: Tender Wang
Дата:
Сообщение: Re: Can't find not null constraint, but \d+ shows that