Question Regarding COPY Command Handling of Line Breaks in PostgreSQL - Mailing list pgsql-general

From gzh
Subject Question Regarding COPY Command Handling of Line Breaks in PostgreSQL
Date
Msg-id 43b9fb8c.8b5c.197f96e3544.Coremail.gzhcoder@126.com
Whole thread Raw
Responses Re: Question Regarding COPY Command Handling of Line Breaks in PostgreSQL
List pgsql-general
Dear,

I am encountering an issue with the COPY command in PostgreSQL regarding the handling of line breaks in data fields. My PostgreSQL instance is installed on a Linux system.

When I use the COPY command to export data to a CSV file and then import the same CSV file back into the database, all carriage return characters (CR) in the fields are automatically converted to line feed characters (LF). For example:

Field content before import: *** (CR) ***
Field content after import: *** (LF) ***
I would like to know if there is a way to use the COPY command while preserving the original line breaks (CR) in the data fields during import.

Thank you for your assistance.

Best regards,
gzh

pgsql-general by date:

Previous
From: Dominique Devienne
Date:
Subject: Re: Aggregate versions of hashing functions (md5, sha1, etc...)
Next
From: Ron Johnson
Date:
Subject: Re: Question Regarding COPY Command Handling of Line Breaks in PostgreSQL