Re: BUG #9198: psql -c 'SET; ...' not working - Mailing list pgsql-bugs

From Matheus de Oliveira
Subject Re: BUG #9198: psql -c 'SET; ...' not working
Date
Msg-id CAJghg4Lo5t8jab6NnrLOnM9A2LNH_zajD_7TegiPCSvSGdqUDA@mail.gmail.com
Whole thread Raw
In response to Re: BUG #9198: psql -c 'SET; ...' not working  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #9198: psql -c 'SET; ...' not working
List pgsql-bugs
On Wed, Feb 12, 2014 at 1:40 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> christoph.berg@credativ.de writes:
> > This seems to be a bug:
>
> > time psql -c "SET statement_timeout =3D '3s'; SELECT pg_sleep(2)"
> > ERROR:  canceling statement due to statement timeout
> > real    0m1.065s
>
>
> Many people have complained that it's unintuitive that -c works this way
> rather than breaking up the string into multiple submissions the same way
> psql would do with normal input.  We're afraid to change it for fear of
> breaking applications, though.  If you want behavior more like psql's
> normal operation, consider
>
> echo "SET statement_timeout =3D '3s'; SELECT pg_sleep(2)" | psql
>
>
How if psql could handle multiple "-c" commands, something like this:

    psql -c "SET statement_timetout =3D '3s'" -c "SELECT pg_sleep(2)"

It wouldn't break existent applications and would make simpler to work on
scripts.


Best regards,
--=20
Matheus de Oliveira
Analista de Banco de Dados
Dextra Sistemas - MPS.Br n=EDvel F!
www.dextra.com.br/postgres

pgsql-bugs by date:

Previous
From: Christoph Berg
Date:
Subject: Re: BUG #9198: psql -c 'SET; ...' not working
Next
From: David Johnston
Date:
Subject: Re: BUG #9198: psql -c 'SET; ...' not working