Re: Use carriage return with copy in PostgreSQL

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Sergio Alonso <seralonso1014(at)gmail(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Use carriage return with copy in PostgreSQL
Date: 2021-05-14 18:49:41
Message-ID: CAKFQuwaV=Y7dRyg7XgrYGPr+VTMsiYHUXw50+9Cs6f8E4Htg5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Friday, May 14, 2021, Sergio Alonso <seralonso1014(at)gmail(dot)com> wrote:

> ('TEST one\r\n' )
> TEST one\\r\\n
>

This has nothing to do with the copy command. You are mis-informed on how
to write string literals, in particular expecting ‘\r’ to be escaped when
in fact in a simple string literal the only special character is the single
quote.

You need to review 4.1.1.2 (
https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS)
if you need to write string literals that contain backslash escapes.

David J.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Tim 2021-05-14 19:37:18 pg_upgrade not excluding system tables in EPAS
Previous Message Sergio Alonso 2021-05-14 17:29:29 Use carriage return with copy in PostgreSQL