Re: Order of execution in shell echo to psql

From: John Gage <jsmgage(at)numericable(dot)fr>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Order of execution in shell echo to psql
Date: 2010-05-02 15:02:39
Message-ID: 1EAFF3C1-52FA-4B0E-8D90-165DBA47CFDB@numericable.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks very much for elucidating this. \g is going to help me in this
situation more than the ;

John

On May 2, 2010, at 4:25 PM, Tom Lane wrote:

> David W Noon <dwnoon(at)ntlworld(dot)com> writes:
>> On Sun, 2 May 2010 14:13:52 +0200, John Gage wrote abour [GENERAL]
>>> I issue the following command to the shell:
>>>
>>> echo '\o file.txt \\ select * from table_name limit 10 \o ' |
>>> psql --
>>> host 'localhost' --port 5432 --username 'johngage' 'database_name'
>
>> Try putting a semi-colon at the end of your SQL query.
>
> Or put a \g there. As it stands, execution of the SQL query is
> triggered by the EOF at the end of the string. So the fact that the
> second \o got executed before that is unsurprising.
>
> regards, tom lane
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Cédric Villemain 2010-05-02 16:04:06 Re: About the limit of storage
Previous Message pasman pasmański 2010-05-02 14:48:50 File compression in WinXP