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 1gek4h-0000Sx-JZ for pgsql-general@arkaria.postgresql.org; Wed, 02 Jan 2019 17:12:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gek4e-0005Fm-PR for pgsql-general@arkaria.postgresql.org; Wed, 02 Jan 2019 17:12:56 +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 1gek4e-0005Ff-HF for pgsql-general@lists.postgresql.org; Wed, 02 Jan 2019 17:12:56 +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 1gek4X-0000sS-Ur for pgsql-general@postgresql.org; Wed, 02 Jan 2019 17:12:56 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 379519934A for ; Wed, 2 Jan 2019 09:12:47 -0800 (PST) Date: Wed, 2 Jan 2019 09:12:47 -0800 (PST) From: Rich Shepard Reply-To: Rich Shepard To: pgsql-general@postgresql.org Subject: Implementing standard SQL's DOMAIN constraint Message-ID: User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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