Re: psql \copy with multi-line query

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Rob Sargent <robjsargent(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: psql \copy with multi-line query
Date: 2023-03-24 23:14:28
Message-ID: CAKFQuwYHXdsx6MQ_jZWU3mgm+5GZVD6BEeB_gL7++pFGyM_ZXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 24, 2023 at 4:04 PM Rob Sargent <robjsargent(at)gmail(dot)com> wrote:

> Using version 13 psql on version 14 server and having trouble sending a
> multi-line select in the \copy. I don't see any remark about this in the
> man page.
>

The copy meta-command cannot contain newlines. You should use "COPY ... TO
STDOUT" directly instead.

All of this is discussed under "\copy" in the documentation (including
notes).

https://www.postgresql.org/docs/current/app-psql.html

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2023-03-24 23:25:29 Re: psql \copy with multi-line query
Previous Message Rob Sargent 2023-03-24 23:04:32 psql \copy with multi-line query