public inbox for [email protected]  
help / color / mirror / Atom feed
From: gzh <[email protected]>
To: [email protected]
Subject: Question Regarding COPY Command Handling of Line Breaks in PostgreSQL
Date: Fri, 11 Jul 2025 20:20:38 +0800 (CST)
Message-ID: <[email protected]> (raw)

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

view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Question Regarding COPY Command Handling of Line Breaks in PostgreSQL
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox