Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1nQY-000c7p-2X for pgsql-general@arkaria.postgresql.org; Sun, 15 Mar 2026 15:30:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w1nQX-004osN-2l for pgsql-general@arkaria.postgresql.org; Sun, 15 Mar 2026 15:30:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w1nQW-004osF-2o for pgsql-general@lists.postgresql.org; Sun, 15 Mar 2026 15:30:50 +0000 Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w1nQU-00000000GDX-48JJ for pgsql-general@postgresql.org; Sun, 15 Mar 2026 15:30:48 +0000 Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfout.phl.internal (Postfix) with ESMTP id DFC6BEC0047; Sun, 15 Mar 2026 11:30:45 -0400 (EDT) Received: from phl-frontend-04 ([10.202.2.163]) by phl-compute-01.internal (MEProxy); Sun, 15 Mar 2026 11:30:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1773588645; x=1773675045; bh=x9x95iNxteTU0h89FHTox1BwIYPd97ROfWFxl5+QbMI=; b= nkbfdIxkgj88SYkiMOW/0i+rijfFSFV/OaXFcD3ghFFWw9cHcYXEM+8DDPGTv4Sb 8AtmZMV8R4sZmwX4EiO+xJfNRczSDFjiG+Rpc7Faq2CZGs6ZsTPn5APsXugwQ55T 859/CZZfrxHLKP2osb++YbC26VxPcFeBuDjkQHUjpX88cLwRY4LAcV1IjGCn4Rv4 mQkVHtNMPUxwg+z9/+8fc/9HKb++8JYNtmYA3xiikm1CCOi+L9DyHYBHXQXXt1zR eUpaY6+cBgKYVoFMIrvdkbSWcGKB7tnYapNho+1sb10W/GNDNKqPEQAMk9ZMS/AZ UhIxbwWl+N94letWscgzhQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1773588645; x=1773675045; bh=x 9x95iNxteTU0h89FHTox1BwIYPd97ROfWFxl5+QbMI=; b=atA/vreoy/Vha971v Lco1D56kj1v19xh8v6pv7tof3BjIbL3qOuB0SfePuWTh0axZ2Q1ptKUkRQ3gcucr gbjo9L4Z5vHsFaatuQPDwt0P1M8vJ5sTLEuF47cdpw77xUGe1dME2RSwpvo8ahw/ DANRglrbxz4vQywoMDcMyztaB7DNjTyc4oW+pSM5h3AevtC0SebfB+9jebl6zS2k mvA30IJ9WAevCAHMG5Jd52oQz/4WLQFI/vK25vWH6EumGoVM2aAgHuM5G85rfrkF 5j6wk+I07Mez0EpLuiT7LrN2KqB5dsjNte86P1vgGtlCAX975V+zny4d4g3jXNvO H5lVw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvleehkeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertd dtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgr vhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrfgrthhtvghrnhepiedvhfeiheehge euieeljeeitedtjeehudegfeelkedvleekhedtgfeiffefkedunecuvehluhhsthgvrhfu ihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrh esrghklhgrvhgvrhdrtghomhdpnhgspghrtghpthhtohepvddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepfhhlohhrihhprghrohgssehtphhgrdgtohhmrdgruhdprhgtph htthhopehpghhsqhhlqdhgvghnvghrrghlsehpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 15 Mar 2026 11:30:45 -0400 (EDT) Message-ID: <18ef99ab-f4c1-44a5-b78a-35c261993017@aklaver.com> Date: Sun, 15 Mar 2026 08:30:44 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Using \copy to populate a table To: rob stone , PostGreSQL MailingList References: <43388977a1cdbde81043c690b41e0647e9b95a2b.camel@tpg.com.au> Content-Language: en-US From: Adrian Klaver In-Reply-To: <43388977a1cdbde81043c690b41e0647e9b95a2b.camel@tpg.com.au> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 3/15/26 12:11 AM, rob stone wrote: > psql (18.3 (Debian 18.3-1+b1)) > Type "help" for help. > > Debian OS is forky. > > When setting up a new development database, the following occurred:- > > How do we fix this? Alter all the nulls to zeroes in the file or write > a program to dissect the file and create individual insert statements? CSV is a text format and in: C|0|pageloader|||null|null|null|null|t|f|f|0 the null values are the string 'null' which indeed is not a valid syntax for a smallint. > > Has anybody else had this problem and if so what was the solution? Do you have control over whatever creates the file? An option is to create a staging table that is has all string fields, import into it and then do clean up before moving to final table. > > Thanks, > Rob > > -- Adrian Klaver adrian.klaver@aklaver.com