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


Reply via email to