Re: BUG #9198: psql -c 'SET; ...' not working
От | Tom Lane |
---|---|
Тема | Re: BUG #9198: psql -c 'SET; ...' not working |
Дата | |
Msg-id | 25094.1392219652@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #9198: psql -c 'SET; ...' not working (christoph.berg@credativ.de) |
Ответы |
Re: BUG #9198: psql -c 'SET; ...' not working
Re: BUG #9198: psql -c 'SET; ...' not working Re: BUG #9198: psql -c 'SET; ...' not working |
Список | pgsql-bugs |
christoph.berg@credativ.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 The reason this isn't a bug is that a -c command string is sent to the server as a single statement (PQexec call), and what "statement timeout" controls is the total time for the whole thing. The SET operation can't change the already-running timer for the current statement. It would affect the timeout for the next statement ... but there won't be one. 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 regards, tom lane
В списке pgsql-bugs по дате отправления: