Re: Quoted NULLs with COPY FROM (and pgAdmin export data options)

From: "George Pavlov" <gpavlov(at)mynewplace(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Quoted NULLs with COPY FROM (and pgAdmin export data options)
Date: 2006-01-24 16:46:06
Message-ID: CCB89282FCE1024EA3DCE687A96A51640471F87B@ehost010-6.exch010.intermedia.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Quotes tend to imply a text field.

I think you meant to say "quotes imply a non-null text field". And, yes,
I am quite aware of that. The point of the thread was to see if there is
any way of avoiding/overriding that assumption.

> Assuming
> you don't want to write a short Perl script to pre-process
> the file the
> simplest way would be to import into a temporary table with
> text columns
> rather than numeric, then copy from that into the real table
> (with CASE or two queries).

Yes, both are valid alternatives. The point was to see if I could skip
those steps.

This is actually turning into a bit of a pgAdmin issue: pgAdmin lets you
export data in a format that seems to be unimportable back into the same
table. If in the "Export data to file" form you check "all columns"
under "Quoting" you will get quotes around your numeric NULLs that you
will be unable to import back using COPY without resorting to
preprocessing of some sort (unless someone tells me how COPY can use
quoted NULLs).

George

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yl Zhou 2006-01-24 16:53:57 Re: user defined function
Previous Message Joshua D. Drake 2006-01-24 16:39:54 Re: Does this look ethical to you?