Re: BUG #17303: statement_timeout does not work always

From: RekGRpth <rekgrpth(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17303: statement_timeout does not work always
Date: 2021-11-30 03:22:59
Message-ID: CAPgh2mLYqizw+fovHe=i2D4VUN99XRwuSbpTXOMxUcc_gukT7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Ok, thanks.

I solve it by

psql -c "BEGIN;SET statement_timeout = 1000;COMMIT;select pg_sleep(2);"
ERROR: canceling statement due to statement timeout

this works in both 10.19 and 14.1

пн, 29 нояб. 2021 г. в 19:53, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
>
> PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> > in postgres 10.19
> > psql -c "SET statement_timeout = 1000;select pg_sleep(2);"
> > pg_sleep
> > ----------
>
> > (1 row)
>
> > Why statement_timeout does not work always in postgres 10.19?
>
> When you use -c that way, the two statements are sent as a single Query
> message. PG versions before 11 interpreted the timeout as taking effect
> beginning with the next Query message. 11 and later define it
> differently. There's no bug here, or at least nothing we're going to change.
>
> A workaround you could use in older versions is to use two separate -c
> switches (although you need a 9.6 or later psql for that).
>
> regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2021-11-30 06:46:42 Re: BUG #17288: PSQL bug with COPY command (Windows)
Previous Message Michael Paquier 2021-11-30 00:57:23 Re: BUG #17288: PSQL bug with COPY command (Windows)