Re: PostgreSQL domains and NOT NULL constraint

From: Vik Fearing <vik(at)postgresfriends(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Erki Eessaar <erki(dot)eessaar(at)taltech(dot)ee>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PostgreSQL domains and NOT NULL constraint
Date: 2023-10-14 14:00:49
Message-ID: 126de91a-7fa8-4552-a5a6-25d51712448b@postgresfriends.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/13/23 06:37, Tom Lane wrote:
> If it's not nominally of a domain type, please cite chapter and
> verse that says it isn't.

Okay, I found it.

SQL:2023-2 6.7 <column reference>

Syntax Rules

5) Let C be the column that is referenced by CR. The declared type of CR is
Case:
a) If the column descriptor of C includes a data type, then that
data type.

b) Otherwise, the data type identified in the domain descriptor that
describes the domain that is identified by the <domain name> that is
included in the column descriptor of C.

So the domain should not be carried into a query expression (including
views) and the data type should be the one specified in the domain.
--
Vik Fearing

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Atkinson 2023-10-14 14:54:57 Re: [Doc] Glossary Term Definitions Edits
Previous Message Amit Kapila 2023-10-14 11:53:18 Re: logical decoding and replication of sequences, take 2