Statement timeout

From: Edson Richter <edsonrichter(at)hotmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Statement timeout
Date: 2016-01-29 15:00:06
Message-ID: BLU436-SMTP2276AADCE7695969FDFF006CFDB0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-01-29 15:29:08 Re: apt.postgresql.org ubtuntu trusty missing libpq version
Previous Message Maeldron T. 2016-01-29 14:46:32 BSD initdb without ICU support and switch later