Re: BUG #17464: Domain type. If the value field(CREATE DOMAIN) is set to null, errors cannot be intercepted.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #17464: Domain type. If the value field(CREATE DOMAIN) is set to null, errors cannot be intercepted.
Дата
Msg-id 795093.1649774506@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #17464: Domain type. If the value field(CREATE DOMAIN) is set to null, errors cannot be intercepted.  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> "VALUES = null" is simply wrong.  That isn't how one checks for null.  Use
> "IS NULL".  If that restores the correct behavior I'm unsure what we'd be
> willing to do to behave differently in the presence of the improper null
> test form.

There's already transform_null_equals, which does work if you turn it on
while executing this incorrect CREATE DOMAIN command.  But the better
answer is to fix your SQL.

regression=# set transform_null_equals = 1;
SET
regression=# CREATE DOMAIN xb AS TEXT CHECK
regression-# (
regression(#    VALUE = '男'
regression(#    OR VALUE ='女'
regression(#    OR VALUE = null
regression(#  );
CREATE DOMAIN
regression=# \dD+ xb
                                                                       List of domains
 Schema | Name | Type | Collation | Nullable | Default |                               Check
   | Access privileges | Description  

--------+------+------+-----------+----------+---------+--------------------------------------------------------------------+-------------------+-------------
 public | xb   | text |           |          |         | CHECK (VALUE = '男'::text OR VALUE = '女'::text OR VALUE IS
NULL)|                   |  
(1 row)


            regards, tom lane



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: BUG #17464: Domain type. If the value field(CREATE DOMAIN) is set to null, errors cannot be intercepted.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #17462: Invalid memory access in heapam_tuple_lock