setQueryTimeout

Lists: pgsql-jdbc
From: Toni Urpí <urpi(at)lsi(dot)upc(dot)edu>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: setQueryTimeout
Date: 2008-01-14 14:40:08
Message-ID: 478B7448.9040802@lsi.upc.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Hi,

Does every know if the method |void setQueryTimeout||(int seconds)|
of Statement is implemented in the Postgres JDBC driver?

The driver seems to recognize it since with a -1 value I obtain an
SQLException stating that "Query timeout must be a value greater than or
equals to 0". However, with a positive number -says 1 second- and a
query that last more that 1 second, no SQLException is produced.

thank you

toni


From: Kris Jurka <books(at)ejurka(dot)com>
To: Toni Urpí <urpi(at)lsi(dot)upc(dot)edu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: setQueryTimeout
Date: 2008-01-14 16:28:45
Message-ID: Pine.BSO.4.64.0801141128210.9507@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Mon, 14 Jan 2008, Toni Urpí wrote:

> Does every know if the method |void setQueryTimeout||(int seconds)| of
> Statement is implemented in the Postgres JDBC driver?
>

It is not implemented.

Kris Jurka


From: Guillaume Cottenceau <gc(at)mnc(dot)ch>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: Toni Urpí <urpi(at)lsi(dot)upc(dot)edu>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: setQueryTimeout
Date: 2008-01-14 16:34:53
Message-ID: 87bq7opdqq.fsf@mnc.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Kris Jurka <books 'at' ejurka.com> writes:

> On Mon, 14 Jan 2008, Toni Urpí wrote:
>
>> Does every know if the method |void setQueryTimeout||(int seconds)|
>> of Statement is implemented in the Postgres JDBC driver?
>
> It is not implemented.

Would "throw new UnsupportedOperationException()" be good to tell
that fact to the users of the driver more directly?

--
Guillaume Cottenceau, MNC Mobile News Channel SA, an Alcatel-Lucent Company
Av. de la Gare 10, 1003 Lausanne, Switzerland - direct +41 21 317 50 36


From: Kris Jurka <books(at)ejurka(dot)com>
To: Guillaume Cottenceau <gc(at)mnc(dot)ch>
Cc: Toni Urpí <urpi(at)lsi(dot)upc(dot)edu>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: setQueryTimeout
Date: 2008-01-14 16:45:16
Message-ID: Pine.BSO.4.64.0801141142380.19830@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Mon, 14 Jan 2008, Guillaume Cottenceau wrote:

> Would "throw new UnsupportedOperationException()" be good to tell
> that fact to the users of the driver more directly?
>

That's unknown. It's unclear how many applications might be calling
setQueryTimeout and not be prepared for an exception. So while they're
slightly broken now, they could be completely broken with this change. If
people feel strongly about it we could consider making the change in the
8.3dev driver, but I wouldn't backpatch it.

Kris Jurka


From: Guillaume Cottenceau <gc(at)mnc(dot)ch>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: setQueryTimeout
Date: 2008-01-14 16:56:09
Message-ID: 87zlv8ny6u.fsf@mnc.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

Kris Jurka <books 'at' ejurka.com> writes:

> On Mon, 14 Jan 2008, Guillaume Cottenceau wrote:
>
>> Would "throw new UnsupportedOperationException()" be good to tell
>> that fact to the users of the driver more directly?
>>
>
> That's unknown. It's unclear how many applications might be calling
> setQueryTimeout and not be prepared for an exception. So while
> they're slightly broken now, they could be completely broken with this
> change. If people feel strongly about it we could consider making the
> change in the 8.3dev driver, but I wouldn't backpatch it.

Personnally, I think that developers will most likely expect the
behaviour to be correct if nothing bad (exception) happens.. I'd
say that all unsupported API should throw an appropriate
exception. Doing the change in 8.3dev makes perfect sense to not
break current users, and developers would be crazy to drop in the
8.3 in the future without testing their application again. /me
votes really in favor of that :)

--
Guillaume Cottenceau, MNC Mobile News Channel SA, an Alcatel-Lucent Company
Av. de la Gare 10, 1003 Lausanne, Switzerland - direct +41 21 317 50 36


From: Kris Jurka <books(at)ejurka(dot)com>
To: Guillaume Cottenceau <gc(at)mnc(dot)ch>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: setQueryTimeout
Date: 2008-01-15 03:30:39
Message-ID: Pine.BSO.4.64.0801142230010.8244@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc

On Mon, 14 Jan 2008, Guillaume Cottenceau wrote:

> Personnally, I think that developers will most likely expect the
> behaviour to be correct if nothing bad (exception) happens.. I'd say
> that all unsupported API should throw an appropriate exception. Doing
> the change in 8.3dev makes perfect sense to not break current users, and
> developers would be crazy to drop in the 8.3 in the future without
> testing their application again.
>

Done, setQueryTimeout will throw an exception if given a non-zero timeout.

Kris Jurka