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 1gfT5X-0006gt-5Z for pgsql-general@arkaria.postgresql.org; Fri, 04 Jan 2019 17:16:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gfT5V-0003Gd-U9 for pgsql-general@arkaria.postgresql.org; Fri, 04 Jan 2019 17:16:49 +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 1gfT5V-0003FO-MA for pgsql-general@lists.postgresql.org; Fri, 04 Jan 2019 17:16:49 +0000 Received: from mail.i-mark.de ([188.138.104.222]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gfT5T-0002Ep-J3 for pgsql-general@lists.postgresql.org; Fri, 04 Jan 2019 17:16:49 +0000 Received: from [192.168.178.20] (unknown [185.38.49.17]) by mail.i-mark.de (Postfix) with ESMTPSA id D82821580552 for ; Fri, 4 Jan 2019 18:16:41 +0100 (CET) Authentication-Results: loft7616.startdedicated.de; spf=pass (sender IP is 185.38.49.17) smtp.mailfrom=andreas@a-kretschmer.de smtp.helo=[192.168.178.20] Received-SPF: pass (loft7616.startdedicated.de: connection is authenticated) Subject: Re: Comparing dates in DDL To: pgsql-general@lists.postgresql.org References: From: Andreas Kretschmer Message-ID: Date: Fri, 4 Jan 2019 18:16:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Am 04.01.19 um 17:53 schrieb Rich Shepard: > I have a projects table that includes these two columns: > > start_date date DEFAULT CURRENT_DATE, > end_date date >     CONSTRAINT valid_start_date >     CHECK (start_date <= end_date), > >   1. Do I need a DEFAULT value for the end_date? no, you can use NULL, for instance. You don't need an explicit value. But maybe you want to set the start_date to NOT NULL. > 2. If so, please suggest a value for it. other solution for such 2 fields: you can use DATERANGE, only one field. Regards, Andreas -- 2ndQuadrant - The PostgreSQL Support Company. www.2ndQuadrant.com