Re: COPY FROM file with zero-delimited fields

From: eugene(dot)mindrov(at)gmail(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: Re: COPY FROM file with zero-delimited fields
Date: 2007-04-13 08:44:42
Message-ID: 1176453882.820209.178620@d57g2000hsg.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Apr 11, 7:42 pm, mmonc(dot)(dot)(dot)(at)gmail(dot)com ("Merlin Moncure") wrote:
> On 11 Apr 2007 00:25:50 -0700, eugene(dot)mind(dot)(dot)(dot)(at)gmail(dot)com
>
> <eugene(dot)mind(dot)(dot)(dot)(at)gmail(dot)com> wrote:
> > Hi all,
> > I wonder if there's a way to use COPY FROM command when dealing with a
> > data file containing records whose fields are delimited with zero-
> > byte? Or I'd better change the delimiter? :)
>
> you can always run it through tr or similar tools first.
>
> merlin
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
> http://archives.postgresql.org/

Yes, sure, I know that, but the matter is - the fields are mostly
textual ones, and can hold just about any text, so it's hard to choose
a right delimiter for fields, you know ;) I though I'd eliminate the
problem by using zero-byte for a field delimiter, but apparently COPY
FROM accepts only "printable" symbols as delimiters...
Another solution would be to escape potential delimiter everywhere in
the text fields, but that also requires using external tools... I had
a hope that COPY FROM can be persuaded to use some non-printable
character in its WITH DELIMITER clause, but apparently this is not the
case...

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Listmail 2007-04-13 09:25:16 Re: Arrays with Rails?
Previous Message Tino Wildenhain 2007-04-13 08:30:29 Re: Arrays with Rails?