Re: Catalog domain not-null constraints - Mailing list pgsql-hackers

From jian he
Subject Re: Catalog domain not-null constraints
Date
Msg-id CACJufxHD2K6RLf+auXyLMGsZM4iwsQV-Gt=J50CzTmuAY7VqZA@mail.gmail.com
Whole thread Raw
In response to Re: Catalog domain not-null constraints  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: Catalog domain not-null constraints
List pgsql-hackers
On Wed, Feb 7, 2024 at 4:11 PM Peter Eisentraut <peter@eisentraut.org> wrote:
>
> >
> > Interesting.  I couldn't reproduce this locally, even across different
> > operating systems.  The cfbot failures appear to be sporadic, but also
> > happening across multiple systems, so it's clearly not just a local
> > environment failure.  Can anyone else perhaps reproduce this locally?
>
> This patch set needed a rebase, so here it is.
>
do you think
add following
ALTER DOMAIN <replaceable class="parameter">name</replaceable> ADD NOT
NULL VALUE

to doc/src/sgml/ref/alter_domain.sgml synopsis makes sense?
otherwise it would be hard to find out this command, i think.


I think I found a bug.
connotnull already set to not null.
every execution of  `alter domain connotnull add not null value ;`
would concatenate 'NOT NULL VALUE' for the "Check" column,
That means changes in the function pg_get_constraintdef_worker are not
100% correct.
see below demo:


src8=# \dD+
                                                  List of domains
 Schema |    Name    |  Type   | Collation | Nullable | Default |
Check      | Access privileges | Description
--------+------------+---------+-----------+----------+---------+----------------+-------------------+-------------
 public | connotnull | integer |           |          |         | NOT
NULL VALUE |                   |
 public | nnint      | integer |           | not null |         | NOT
NULL VALUE |                   |
(2 rows)

src8=# alter domain connotnull add not null value ;
ALTER DOMAIN
src8=# \dD+
                                                         List of domains
 Schema |    Name    |  Type   | Collation | Nullable | Default |
       Check             | Access privileges | Descript
ion

--------+------------+---------+-----------+----------+---------+-------------------------------+-------------------+---------
----
 public | connotnull | integer |           | not null |         | NOT
NULL VALUE NOT NULL VALUE |                   |
 public | nnint      | integer |           | not null |         | NOT
NULL VALUE                |                   |
(2 rows)

src8=# alter domain connotnull add not null value ;
ALTER DOMAIN
src8=# \dD+
                                                                 List of domains
 Schema |    Name    |  Type   | Collation | Nullable | Default |
              Check                     | Access privil
eges | Description

--------+------------+---------+-----------+----------+---------+----------------------------------------------+--------------
-----+-------------
 public | connotnull | integer |           | not null |         | NOT
NULL VALUE NOT NULL VALUE NOT NULL VALUE |
     |
 public | nnint      | integer |           | not null |         | NOT
NULL VALUE                               |
     |
(2 rows)



pgsql-hackers by date:

Previous
From: Mats Kindahl
Date:
Subject: Re: glibc qsort() vulnerability
Next
From: jian he
Date:
Subject: Re: 2024-02-08 release announcement draft