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 1gtKOY-00006N-ON for pgsql-general@arkaria.postgresql.org; Mon, 11 Feb 2019 22:49:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gtKOW-0003MM-Ti for pgsql-general@arkaria.postgresql.org; Mon, 11 Feb 2019 22:49:44 +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 1gtKOW-0003IT-FN for pgsql-general@lists.postgresql.org; Mon, 11 Feb 2019 22:49:44 +0000 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtKOP-0006fr-BT for pgsql-general@lists.postgresql.org; Mon, 11 Feb 2019 22:49:42 +0000 Received: by mail-ot1-x342.google.com with SMTP id u16so1072697otk.8 for ; Mon, 11 Feb 2019 14:49:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=Du5HhdOMmnXBHcg92r1MQUoAySPjPKNyb0aUEzWIgxE=; b=iWN0XhSFhb4Mf7MPKnHKemo7g86Lh9iIr33WdqXG64tP241BQc9E/vZSoUhODIK/cC 7f8BtfrOM650O0cqvBn94aBlIoCgHZyAYcWXRSvtAYx3W7vNiBt9xtOHfm80FifVfH0N hxLTyYVFGjqtmzLfhZR+C3ojpoWI7ETcdaWNBR6g2agCu2lNU6VXRuTnnG7WtaRKTt52 ZmcVV1fu/zeFku2xuUYK/Yexd8tzqaZz1oNt+GDcFHkmL9I/3Jr3PVd6R+u5mMB8jRfk MBGyvOoOEdLnMW/qbLinmyWajcu0Ts+7krR4eJoxHCwm1PR1kEnV5EP98ypIai/p/xLS TcTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Du5HhdOMmnXBHcg92r1MQUoAySPjPKNyb0aUEzWIgxE=; b=akTFEAzSSKurG1WhSN4pF1TWi9TGC7cLxXGsVnr8uxlVOMfRWC/i/hcpwVhmXw+QMA yMwqi48PwNmbywKGaVwLnrhw9asZyNEcAknzQAtyeNo4ZHuK/OCDDwPNzqi+7EcFviv9 nYZURhBTAtWbfsvMkiU4nlu+rvDQpqviRIuSsqYN3a67yJw38SZ2UxygzOy2XBt0WTE3 l2uNatTNobdi11VxjkyxIR80rd41+YJ6/l0/heNNensCicnOSP8JOU9aIGFjS7CQRPTd agVjZzD204wZ60ZLdJIGZRTc/QhRTO4r2VZX94qGay0A4L1146HqVhuYOgkHLYpyqBqc 4+Xg== X-Gm-Message-State: AHQUAuaQMoacG/vWbYWeXJPFC4/Lm0hmpaEXIB1c0cbKzTAJCZmxkYvl PKSJlo6dzgERkcNdve5iD1GI0wui X-Google-Smtp-Source: AHgI3IYj7XSq8rWyvbIll+WeuTgZ4BInejcmwVM552eZcRqYgDWAndkciJAaZLn8f/8bEOEVNG5vrg== X-Received: by 2002:a05:6830:1596:: with SMTP id i22mr603784otr.7.1549925375981; Mon, 11 Feb 2019 14:49:35 -0800 (PST) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id m5sm1774082oih.16.2019.02.11.14.49.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Feb 2019 14:49:35 -0800 (PST) Subject: Re: Blank, nullable date column rejected by psql To: pgsql-general@lists.postgresql.org References: From: Ron Message-ID: <9a60f04a-797b-420b-39db-ac139ce8fa23@gmail.com> Date: Mon, 11 Feb 2019 16:49:34 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 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 On 2/11/19 4: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. NULL is nothing.  Blank isn't nothing; blank is a zero-length string.  Thus, you need to tell Pg "nothing", not "blank string". (Oracle is really bad about that.) -- Angular momentum makes the world go 'round.