Re: Implementing standard SQL's DOMAIN constraint

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Implementing standard SQL's DOMAIN constraint
Date: 2019-01-02 17:47:42
Message-ID: alpine.LNX.2.20.1901020943560.20959@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2019-01-02 17:52:43 Re: Implementing standard SQL's DOMAIN constraint
Previous Message David G. Johnston 2019-01-02 17:34:32 Re: Implementing standard SQL's DOMAIN constraint