From: | Junfeng Yang <yjerome(at)vmware(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Is it possible to set end-of-data marker for COPY statement. |
Date: | 2020-09-01 06:14:45 |
Message-ID: | DM5PR0501MB3880CB81067E14F9C78FA28BCC2E0@DM5PR0501MB3880.namprd05.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Hi hackers,
As described in the doc https://www.postgresql.org/docs/current/sql-copy.html, the TEXT format recognizes
backslash-period (\.) as end-of-data marker.
The example below will raise an error for the line contains `\.`.
CREATE TABLE test (
id int,
name text,
dep text
)
Data in file "/tmp/data".
122,as\.d,adad
133,sa dad,adadad
Then execute
copy test from '/tmp/data' DELIMITER ',';
An end-of-copy marker corrupt error will be raised.
This requires users to escape the end-of-data marker manually in their data.
Why we don't have a mechanism to define other characters as end-of-data marker?
Or there are other ways to avoid escape the end-of-data in data?
Regards,
Junfeng
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2020-09-01 07:22:17 | Re: How bad is using queries with thousands of values for operators IN or ANY? |
Previous Message | Bruce Momjian | 2020-08-31 22:31:04 | Re: [EXTERNAL] Re: Numeric data types |
From | Date | Subject | |
---|---|---|---|
Next Message | Sait Talha Nisanci | 2020-09-01 06:14:52 | RE: [EXTERNAL] Re: WIP: WAL prefetch (another approach) |
Previous Message | Michael Paquier | 2020-09-01 05:56:35 | Re: Use T_IntList for uint32 |