From: Rich Shepard <rshepard@appl-ecosys.com>
To: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: Implementing standard SQL's DOMAIN constraint
Date: Wed, 2 Jan 2019 09:47:42 -0800 (PST)
Message-ID: <alpine.LNX.2.20.1901020943560.20959@salmo.appl-ecosys.com> (raw)
In-Reply-To: <CAKFQuwbdtPmDR52TBX1EENEbYV2w02GzB1K5z_1O-r2ukfo4Kg@mail.gmail.com>
References: <alpine.LNX.2.20.1901020905410.20959@salmo.appl-ecosys.com>
<CAKFQuwbdtPmDR52TBX1EENEbYV2w02GzB1K5z_1O-r2ukfo4Kg@mail.gmail.com>
On Wed, 2 Jan 2019, David G. Johnston wrote:
> There is no magic name logic involved. A domain is just a type with
> inherent constraints that are user definable. You make use of it like any
> other type.
>
> Create table tbl (
> column_name state_code not null
> )
>
> Values stored in column_name are now of type state_code and constrained to
> be one of the check constraint values.
David,
I'm not following you. I have two tables each with a column,
state_code char(2) NOT NULL.
Do you mean that I need to write the column constraint for each table? If
not, I don't see from your response how to implement the multi-table
constraint for this column.
Regards,
Rich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: rshepard@appl-ecosys.com
Subject: Re: Implementing standard SQL's DOMAIN constraint
In-Reply-To: <alpine.LNX.2.20.1901020943560.20959@salmo.appl-ecosys.com>
References: <alpine.LNX.2.20.1901020905410.20959@salmo.appl-ecosys.com> <CAKFQuwbdtPmDR52TBX1EENEbYV2w02GzB1K5z_1O-r2ukfo4Kg@mail.gmail.com> <alpine.LNX.2.20.1901020943560.20959@salmo.appl-ecosys.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox