Implementing standard SQL's DOMAIN constraint - Mailing list pgsql-general

From Rich Shepard
Subject Implementing standard SQL's DOMAIN constraint
Date
Msg-id alpine.LNX.2.20.1901020905410.20959@salmo.appl-ecosys.com
Whole thread Raw
Responses Re: Implementing standard SQL's DOMAIN constraint
List pgsql-general
Happy New Year all,

My readings taught me that standard SQL has a domain constraint that checks
for the same valid characters in a column common to multiple tables.
Example:

CREATE DOMAIN state_code AS char(2)
DEFAULT '??'
CONSTRAINT valid_state_code
CHECK (value IN ('AL', 'AK', 'AZ', ...));

This applies to all tables each having a column named state_code.

I see the value of this feature when multiple tables have start_date and
end_date columns with a constraint that ensures the start_date is <= to the
end date.

Reading the release 10 manual I find many constraints and I want to learn
which one will implement this feature. A pointer is needed.

Rich




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Query planner / Analyse statistics bad estimate rows=1 with maximum statistics 10000 on PostgreSQL 10.2
Next
From: "David G. Johnston"
Date:
Subject: Re: Implementing standard SQL's DOMAIN constraint