Re: Good Delimiter for copy command

From: Mark Roberts <mailing_lists(at)pandapocket(dot)com>
To: sharmi_jo(at)yahoo(dot)com
Cc: pgsql-general(at)postgresql(dot)org, Sam Mason <sam(at)samason(dot)me(dot)uk>
Subject: Re: Good Delimiter for copy command
Date: 2009-02-12 22:19:01
Message-ID: 1234477141.11148.252.camel@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers


On Thu, 2009-02-12 at 12:51 -0800, SHARMILA JOTHIRAJAH wrote:
>
> My data fields contains commas, tabs,'|' etc. So I cant use t hem as
> delimiters..so I need a unique may be non-character to use as a
> delimiter...
> -Sharmila

Is this a theoretical problem or an actual one? I haven't had any
problems with the default (tab). In fact, copying from one database to
another is an exceedingly common task that I do, all done with tab.

dev=> create table foo (a text);
CREATE TABLE
Time: 385.967 ms
dev=> insert into foo values (' '); -- literal tab
INSERT 0 1
Time: 0.536 ms
dev=> insert into foo values ('\t'); -- special character, parsed.
INSERT 0 1
Time: 0.224 ms
dev=> insert into foo values ('\\t'); -- backslash, t
INSERT 0 1
Time: 0.183 ms
dev=> copy foo to stdout;
\t
\t
\\t
Time: 0.188 ms
dev=> select * from foo;
a
------
\x09
\x09
\t
(3 rows)

Time: 0.239 ms
dev=>

-Mark

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2009-02-12 22:21:39 Re: R: R: How to check if 2 series of data are equal
Previous Message Tom Lane 2009-02-12 21:41:45 Re: Good Delimiter for copy command

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2009-02-12 22:43:08 connection logging dtrace probe
Previous Message Tom Lane 2009-02-12 22:13:03 Re: [ADMIN] database corruption help