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 1gtKOo-00007A-Nn for pgsql-general@arkaria.postgresql.org; Mon, 11 Feb 2019 22:50:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gtKOn-0006Hn-Cq for pgsql-general@arkaria.postgresql.org; Mon, 11 Feb 2019 22:50:01 +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 1gtKOl-0006HQ-Me for pgsql-general@lists.postgresql.org; Mon, 11 Feb 2019 22:50:01 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtKOh-0000eD-Us for pgsql-general@postgresql.org; Mon, 11 Feb 2019 22:49:59 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id F1DE43064; Mon, 11 Feb 2019 17:49:52 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 11 Feb 2019 17:49:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=7 ShwUVIZZsRXG4xotEPI8m98EqNYBFgi896FLSmadiw=; b=RtFWvWAZKayNYx3Ug 82wdzA6Hx7j8egCluI4sQBbhIhAPdG+w6DyTBIA6fOroXwz015xo0/EbdJ6uQngP VXf0m0vIhLFgaEsMs67RRDZRgYlr1MdGfhD/ixIbm48bvDRpy/r8grTqp62PpCHS BHYBfm90i/8QIHuVTCODYIIepbwyZrP5Jxv6zgP0b3SueYphdVasgg83LtlkouIv FCJJcv1X9Mw41v50W6AcWXvNohN9eILiPrbnY/butc7OHsx0WB5orIdpeZWaryn4 AcRtk8WwityEVLiuTCjNUxMh7/ToXNh0617JoDIxGWHRyrlqpj9mQlKAf9BmzweN 6slhg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=7ShwUVIZZsRXG4xotEPI8m98EqNYBFgi896FLSmad iw=; b=eZSnmYepPxwbJ9ninqOjKP3z95cj9CcTXTtBKtmPudDKfp2jzCnadyX7J s6qsavB4h6ARqcJ7NfFrmMci2VMRUlPJgD6Pq+A+ppxOeFWJNgzXcn8h/cEWbFGM p54Tt+gtd+HzNYD6QKkLThY3tFJHLD2z8N/r4IMLVXiIvL6XO/rfjyTbFWUD8H+a 8V5AWgh/F5aylfa7B08r4GUVWTLXbfJXGEtIK5rKm3jyBzo0hExaZnlG5CB0sIik EUcpP5HusbTkkrx5DM92GVrMTvKCStEYbVAAwmuau9ZuTRGDQ7EPNwgJb3kGo5AD qaALdrDtT7sYURND7kGCpbPmGvJGg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledruddttddgtdefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefuvfhfhffkff gfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceo rggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecukfhppeejuddrvd duvddrudehtddrvddtvdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id CA992E4412; Mon, 11 Feb 2019 17:49:51 -0500 (EST) Subject: Re: Blank, nullable date column rejected by psql To: Rich Shepard , pgsql-general@postgresql.org References: From: Adrian Klaver Message-ID: <814371b9-d223-239d-e138-5451a81af2d4@aklaver.com> Date: Mon, 11 Feb 2019 14:49:50 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/11/19 2:44 PM, Rich Shepard wrote: > Running postgresql-10.5 on Slackware-14.2. > > A table has a column defined as > > Column       | Type  | Collation | Nullable | Default > next_contact | date  |           |          | > > In a .sql file to insert rows in this table psql has a problem when there's > no value for the next_contact column: > > $ psql -f activities.sql -d bustrac psql:activities.sql:6: ERROR: > invalid input syntax for type date: "" > LINE 2: ...ise. Asked him to call.',''), > > Explicitly replacing the blank field ('') with null is accepted. Why is > this? > > Now I know to replace no dates with null I'll do so but I'm curious why > this > is needed. Because: invalid input syntax for type date: "" means you are trying to enter an empty string("") and that: a) Is not NULL b) Is not a valid date string. > > Thanks in advance, > > Rich > > > -- Adrian Klaver adrian.klaver@aklaver.com