Re: Switching from OSX to Linux, multi-line queries in \copy don't work anymore

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ryan Kelly <rpkelly22(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Switching from OSX to Linux, multi-line queries in \copy don't work anymore
Date: 2012-07-27 17:56:53
Message-ID: CAHyXU0wFVDVBPHXVsGmhmPfW6LHOEDafhKZg5S52AdeuiZM53A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 27, 2012 at 12:06 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Ryan Kelly <rpkelly22(at)gmail(dot)com> writes:
>> I recently switched from OSX to Linux and \copy in psql no longer
>> accepts multi-line queries. For instance:
>
>> \copy (
>> select
>> *
>> from
>> pg_settings
>> ) to '/tmp/settings.csv' with csv header
>
>> This works fine on OSX. On Linux I get:
>> \copy: parse error at end of line
>
> FWIW, I get that error on either OS X or Linux, and I'm a bit astonished
> by your report that there are any versions of psql that allow it.
> psql doesn't do multi-line backslash commands, in any context. Are you
> sure you weren't doing a plain SQL "copy" command, without a backslash?

it can be coerced:

postgres=# \copy (
select 0
) to stdout
0

now -- to do that, I had to use the \e command to do it in vi, then
recall the command with readline :-). \copy can work arbitrarily work
or fail in all kinds of ways.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan, Richard 2012-07-27 18:13:05 Re: fgets failure in Solaris after patching
Previous Message Daoud Abdelmonem Faleh 2012-07-27 17:35:00 Re: BI tools and postgresql