Re: BUG #9198: psql -c 'SET; ...' not working

From: Matheus de Oliveira <matioli(dot)matheus(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: christoph(dot)berg(at)credativ(dot)de, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9198: psql -c 'SET; ...' not working
Date: 2014-02-13 15:43:40
Message-ID: CAJghg4Lo5t8jab6NnrLOnM9A2LNH_zajD_7TegiPCSvSGdqUDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Feb 12, 2014 at 1:40 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> christoph(dot)berg(at)credativ(dot)de writes:
> > This seems to be a bug:
>
> > time psql -c "SET statement_timeout = '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 = '3s'; SELECT pg_sleep(2)" | psql
>
>
How if psql could handle multiple "-c" commands, something like this:

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

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

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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Johnston 2014-02-13 15:59:20 Re: BUG #9198: psql -c 'SET; ...' not working
Previous Message digoal 2014-02-13 14:07:59 BUG #9210: PostgreSQL string store bug? not enforce check with correct characterSET/encoding