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 1gtYL5-0003Er-GD for pgsql-general@arkaria.postgresql.org; Tue, 12 Feb 2019 13:43:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gtYL3-0004Jf-3b for pgsql-general@arkaria.postgresql.org; Tue, 12 Feb 2019 13:43:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtYL2-0004JY-NV for pgsql-general@lists.postgresql.org; Tue, 12 Feb 2019 13:43:04 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtYKv-0001QM-Tm for pgsql-general@postgresql.org; Tue, 12 Feb 2019 13:43:03 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 3910D99356 for ; Tue, 12 Feb 2019 05:42:56 -0800 (PST) Date: Tue, 12 Feb 2019 05:42:56 -0800 (PST) From: Rich Shepard To: pgsql-general@postgresql.org Subject: Re: Blank, nullable date column rejected by psql In-Reply-To: <7ad1d0b443c12a1a6ea11606221b7201e933148f.camel@cybertec.at> Message-ID: References: <7ad1d0b443c12a1a6ea11606221b7201e933148f.camel@cybertec.at> 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 Tue, 12 Feb 2019, Laurenz Albe wrote: > If you insert a string into a "date" column, PostgreSQL will try to > convert the string to a date with the type input function. The type input > function fails on an empty string, since it cannot parse it into a valid > "date" value. This also applies to the empty string. Laurenz, All my previous databases with date columns were required to have an entry because each row contatined spatio-temporal sampling data. The table in this business-oriented application is not required to have a next_contact date and (the crucial point) is that I conflated date values with string values. As you wrote, a date column is converted from the entered string to a non-string date type and requires an explicit null when there is no value to be stored for that column. Thanks very much, Rich