Re: Good Delimiter for copy command - Mailing list pgsql-general

From Mark Roberts
Subject Re: Good Delimiter for copy command
Date
Msg-id 1234477141.11148.252.camel@localhost
Whole thread Raw
In response to Re: Good Delimiter for copy command  (SHARMILA JOTHIRAJAH <sharmi_jo@yahoo.com>)
List pgsql-general
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


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Good Delimiter for copy command
Next
From: Adrian Klaver
Date:
Subject: Re: R: R: How to check if 2 series of data are equal