| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
| Cc: | dafoer_x(at)163(dot)com, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: BUG #17464: Domain type. If the value field(CREATE DOMAIN) is set to null, errors cannot be intercepted. |
| Date: | 2022-04-12 14:41:46 |
| Message-ID: | 795093.1649774506@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
"David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2022-04-12 21:40:05 | Re: BUG #17462: Invalid memory access in heapam_tuple_lock |
| Previous Message | David G. Johnston | 2022-04-12 14:27:44 | Re: BUG #17464: Domain type. If the value field(CREATE DOMAIN) is set to null, errors cannot be intercepted. |