| From: | Ryan Kelly <rpkelly22(at)gmail(dot)com> |
|---|---|
| To: | Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> |
| Cc: | 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 14:19:52 |
| Message-ID: | 20120727141952.GB1807@llserver.lakeliving.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
On Fri, Jul 27, 2012 at 09:49:06PM +0800, Craig Ringer wrote:
> On 07/27/2012 09:28 PM, Ryan Kelly wrote:
> >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
> >
> >Am I missing something here?
> A wild guess: I'd say this is a consequence of the fact that psql on
> OS X uses libedit, on Linux it uses readline.
My psql on OSX is built with readline:
ryan(at)huxley: otool -L psql
/opt/local/lib/postgresql90/bin/psql:
/opt/local/lib/postgresql90/libpq.5.dylib (compatibility version 5.0.0, current version 5.3.0)
/opt/local/lib/libssl.1.0.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/local/lib/libreadline.6.2.dylib (compatibility version 6.0.0, current version 6.2.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
Also note that I don't usually type these in directly, rather I use \e
to write them in vim. Doesn't make any difference, though.
> Personally I had no idea that multiline \copy was possible at all.
> I've always though the way backslash commands are EOL-terminated
> while everything else is semicolon terminated is a bit of a wart,
> though.
>
> I don't have an answer for you. Using the --no-readline argument
> makes no difference on my 9.1.4 here. This may just be an area where
> libedit is smarter than readline - or it might be that I'm totally
> wrong and the real issue is something else entirely.
>
> Thanks for making the effort to produce a good post with all the
> detailed version info, exact error text, etc.
>
> --
> Craig Ringer
>
-Ryan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chris Angelico | 2012-07-27 14:21:45 | Re: Terminating a rogue connection |
| Previous Message | Mark Morgan Lloyd | 2012-07-27 14:06:01 | Re: Switching from OSX to Linux, multi-line queries in \copy don't work anymore |