Parameter NOT NULL to CREATE DOMAIN not the same as CHECK (VALUE IS NOT NULL)

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: jbe-mlist(at)magnetkern(dot)de
Subject: Parameter NOT NULL to CREATE DOMAIN not the same as CHECK (VALUE IS NOT NULL)
Date: 2025-01-03 13:39:44
Message-ID: 173591158454.714.7664064332419606037@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/sql-createdomain.html
Description:

The manual claims:

The syntax NOT NULL in this command is a PostgreSQL extension. (A
standard-conforming way to write the same would be CHECK (VALUE IS NOT
NULL). […])

But both variants differ when composite types are involved:

CREATE TYPE complex AS (real float8, imag float8);

CREATE DOMAIN d1 AS complex NOT NULL;
CREATE DOMAIN d2 AS complex CHECK (VALUE IS NOT NULL);

SELECT '(,)'::d1; -- allowed
SELECT '(,)'::d2; -- not allowed

Kind Regards,
Jan Behrens

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message jian he 2025-01-06 10:19:23 Re: LC_COLLATE is visible in the documentation for PostgreSQL 17, but it is not supported
Previous Message PG Doc comments form 2024-12-30 12:06:40 LC_COLLATE is visible in the documentation for PostgreSQL 17, but it is not supported

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2025-01-03 13:44:22 Re: magical eref alias names
Previous Message Robert Haas 2025-01-03 13:33:02 Re: Fwd: Re: A new look at old NFS readdir() problems?