pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #17303: statement_timeout does not work always
4+ messages / 4 participants
[nested] [flat]
* BUG #17303: statement_timeout does not work always
@ 2021-11-29 03:58 PG Bug reporting form <noreply@postgresql.org>
2021-11-29 13:54 ` Re: BUG #17303: statement_timeout does not work always David G. Johnston <david.g.johnston@gmail.com>
2021-11-29 14:53 ` Re: BUG #17303: statement_timeout does not work always Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 4+ messages in thread
From: PG Bug reporting form @ 2021-11-29 03:58 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: rekgrpth@gmail.com
The following bug has been logged on the website:
Bug reference: 17303
Logged by: RekGRpth
Email address: rekgrpth@gmail.com
PostgreSQL version: 10.19
Operating system: ubuntu
Description:
in postgres 10.19
psql -c "SET statement_timeout = 1000;select pg_sleep(2);"
pg_sleep
----------
(1 row)
but
psql
psql (14.1 (Ubuntu 14.1-1.pgdg21.10+1), server 10.19 (Ubuntu
10.19-1.pgdg21.10+1))
Type "help" for help.
postgres=# SET statement_timeout = 1000;select pg_sleep(2);
SET
ERROR: canceling statement due to statement timeout
and in postgres 14.1
psql -c "SET statement_timeout = 1000;select pg_sleep(2);"
ERROR: canceling statement due to statement timeout
Why statement_timeout does not work always in postgres 10.19?
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #17303: statement_timeout does not work always
2021-11-29 03:58 BUG #17303: statement_timeout does not work always PG Bug reporting form <noreply@postgresql.org>
@ 2021-11-29 13:54 ` David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 0 replies; 4+ messages in thread
From: David G. Johnston @ 2021-11-29 13:54 UTC (permalink / raw)
To: RekGRpth <rekgrpth@gmail.com>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
On Mon, Nov 29, 2021 at 1:50 AM PG Bug reporting form <
noreply@postgresql.org> wrote:
> Why statement_timeout does not work always in postgres 10.19?
>
Due to questions like yours it was decided the behavior of "psql -c" needed
to be changed. But it is good software practice to not change such
behavior on a minor release. Thus the current version of 10 has the old
behavior and the current version of 14 has the improved behavior (I don't
recall when exactly it changed). This is not a bug, it is just how
softwares changes over time.
David J.
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #17303: statement_timeout does not work always
2021-11-29 03:58 BUG #17303: statement_timeout does not work always PG Bug reporting form <noreply@postgresql.org>
@ 2021-11-29 14:53 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-11-30 03:22 ` Re: BUG #17303: statement_timeout does not work always RekGRpth <rekgrpth@gmail.com>
1 sibling, 1 reply; 4+ messages in thread
From: Tom Lane @ 2021-11-29 14:53 UTC (permalink / raw)
To: rekgrpth@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org
PG Bug reporting form <noreply@postgresql.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
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: BUG #17303: statement_timeout does not work always
2021-11-29 03:58 BUG #17303: statement_timeout does not work always PG Bug reporting form <noreply@postgresql.org>
2021-11-29 14:53 ` Re: BUG #17303: statement_timeout does not work always Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-11-30 03:22 ` RekGRpth <rekgrpth@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: RekGRpth @ 2021-11-30 03:22 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
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@sss.pgh.pa.us>:
>
> PG Bug reporting form <noreply@postgresql.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
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2021-11-30 03:22 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-29 03:58 BUG #17303: statement_timeout does not work always PG Bug reporting form <noreply@postgresql.org>
2021-11-29 13:54 ` David G. Johnston <david.g.johnston@gmail.com>
2021-11-29 14:53 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-11-30 03:22 ` RekGRpth <rekgrpth@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox