Statement timeout - Mailing list pgsql-general

From Edson Richter
Subject Statement timeout
Date
Msg-id BLU436-SMTP2276AADCE7695969FDFF006CFDB0@phx.gbl
Whole thread Raw
Responses Re: Statement timeout  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-general
I've set statement timeout in postgresql.conf to 300s.
Now, I have a schema update procedure at application startup I would
like to run without timeout, or with significant larger timeout (let's
say, 10000s).

It is possible to change statement timeout at runtime before issuing the
command (for one connection only) without changing postgresql.conf?

I'm using JDBC, and I've imagined something like


java.sql.Connection cn = getConnection(); // this is a function that
returns a connection form the connection's pool.
java.sql.Statement st = cn.createStatement();
cn.setAutoCommit(false);
st.executeQuery("set statement_timeout = 10000s");
st.executeUpdate("update table XYZ set value_non_zero = 1 where
value_non_zero is null or value_non_zero = 0");
st.executeUpdate("alter table XYZ modify value_non_zero not null default
1");
cn.commit();

Something like that (I know sql syntax is wrong, this is just a lazy
example)...

--
Atenciosamente,

Edson Carlos Ericksson Richter



pgsql-general by date:

Previous
From: "Maeldron T."
Date:
Subject: BSD initdb without ICU support and switch later
Next
From: Adrian Klaver
Date:
Subject: Re: apt.postgresql.org ubtuntu trusty missing libpq version