Null vs empty string

From: "Keith Worthington" <keithw(at)narrowpathinc(dot)com>
To: "PostgreSQL Novice" <pgsql-novice(at)postgresql(dot)org>
Subject: Null vs empty string
Date: 2004-12-04 01:57:24
Message-ID: 20041204015724.M85155@narrowpathinc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi All,

I am loading data into a PostgreSQL v7.3.6 database running on RedHat
Enterprise Linux ES. This is accomplished by a shell script running the COPY
command. The data is in comma seperated value format.

I am experiencing two difficulties.

Firstly, when loading a missing (consecutive commas) numeric value (int4) an
error message is generated indicating that the string cannot be parsed. I
would prefer that a NULL value be inserted.

Secondly, when loading a missing (consecutive commas) string (varchar) an
empty string is inserted. Again, I would prefer that a NULL value be inserted
as later on a foreign key constraint complains bitterly about not being able
to match the empty string. :-(

Can you please explain how best to accomplish these results.

Kind Regards,
Keith

______________________________________________
99main Internet Services http://www.99main.com

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Fuhr 2004-12-04 03:11:47 Re: multiple table join and sumation
Previous Message Keith Worthington 2004-12-03 23:16:32 multiple table join and sumation