Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gekcP-0001p7-3l for pgsql-general@arkaria.postgresql.org; Wed, 02 Jan 2019 17:47:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gekcN-0006H7-K8 for pgsql-general@arkaria.postgresql.org; Wed, 02 Jan 2019 17:47:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gekcN-0006Gz-BG for pgsql-general@lists.postgresql.org; Wed, 02 Jan 2019 17:47:47 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gekcL-0001eq-3h for pgsql-general@postgresql.org; Wed, 02 Jan 2019 17:47:46 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id B39A19934A for ; Wed, 2 Jan 2019 09:47:42 -0800 (PST) Date: Wed, 2 Jan 2019 09:47:42 -0800 (PST) From: Rich Shepard To: "pgsql-general@postgresql.org" Subject: Re: Implementing standard SQL's DOMAIN constraint In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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