Re: Catalog domain not-null constraints

Поиск
Список
Период
Сортировка
От jian he
Тема Re: Catalog domain not-null constraints
Дата
Msg-id CACJufxHD2K6RLf+auXyLMGsZM4iwsQV-Gt=J50CzTmuAY7VqZA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Catalog domain not-null constraints  (Peter Eisentraut <peter@eisentraut.org>)
Ответы Re: Catalog domain not-null constraints  (Peter Eisentraut <peter@eisentraut.org>)
Список 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 по дате отправления:

Предыдущее
От: Mats Kindahl
Дата:
Сообщение: Re: glibc qsort() vulnerability
Следующее
От: jian he
Дата:
Сообщение: Re: 2024-02-08 release announcement draft