pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Colin Rothnie <colinr@tiwest.com.au>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: FW: [SQL] Errors loading null dates in 7.0beta1
Date: Wed, 08 Mar 2000 11:04:37 -0500
Message-ID: <25356.952531477@sss.pgh.pa.us> (raw)
In-Reply-To: <E9EDEF4E768BD311BE0B00A0C9D4C42807B3F5@minxs1.tiwest.com.au>
References: <E9EDEF4E768BD311BE0B00A0C9D4C42807B3F5@minxs1.tiwest.com.au>

Colin Rothnie <colinr@tiwest.com.au> writes:
> I am copying data from a tab delimited text file using the psql command 
> test=> \copy collar from collar.txt;
> where the table "collar" contains a date field (not set to "NOT NULL") and
> the text file contains date fields for some records and nothing between two
> tabs for records without date data.

The approved way to represent nulls in copy data is "\N", not just an
empty string.  This is the same for all data types.

> The same table structure and load file
> were used successfully with 6.5.3

Really?  I tried it and got

play=> \copy collar from collar.txt
ERROR:  Bad date external representation ''
PQendcopy: resetting connection
Copy failed.

which is what I'd expect.

> Looking at it again now, I am also uncertain whether "date" is an allowable
> field name (PostrgreSQL didn't object).

We allow it, but the SQL92 spec lists DATE as a <reserved word>, so it's
possible that some other DBMSes would complain.

			regards, tom lane



view thread (4+ messages)

Message-ID: <25356.952531477@sss.pgh.pa.us>
Permalink:  ../25356.952531477@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25356.952531477@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, colinr@tiwest.com.au
  Subject: Re: FW: [SQL] Errors loading null dates in 7.0beta1
  In-Reply-To: <25356.952531477@sss.pgh.pa.us>
  References: <E9EDEF4E768BD311BE0B00A0C9D4C42807B3F5@minxs1.tiwest.com.au> <25356.952531477@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox