Re: [HACKERS] Generating a query that never returns

2011-09-19 Thread Tom Lane
Dave Cramer p...@fastcrypt.com writes: I have a need to test timeouts in JDBC, is there a query that is guaranteed not to return ? You could just do an unconstrained join between several large tables. Or select pg_sleep(largevalue), depending on whether you'd like the backend to be spitting

Re: [HACKERS] Generating a query that never returns

2011-09-19 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 I have a need to test timeouts in JDBC, is there a query that is guaranteed not to return ? Not *never*, but close enough: select pg_sleep(); Or if you want to be strict: CREATE FUNCTION

Re: [HACKERS] Generating a query that never returns

2011-09-19 Thread Florian Pflug
On Sep19, 2011, at 16:48 , Dave Cramer wrote: I have a need to test timeouts in JDBC, is there a query that is guaranteed not to return ? WITH RECURSIVE infinite(value) AS (SELECT 1 UNION ALL SELECT * FROM infinite) SELECT * FROM infinite If you declare a cursor for this statement, it will

Re: [HACKERS] Generating a query that never returns

2011-09-19 Thread David Fetter
On Mon, Sep 19, 2011 at 05:12:15PM +0200, Florian Pflug wrote: On Sep19, 2011, at 16:48 , Dave Cramer wrote: I have a need to test timeouts in JDBC, is there a query that is guaranteed not to return ? WITH RECURSIVE infinite(value) AS (SELECT 1 UNION ALL SELECT * FROM infinite) SELECT *

Re: [HACKERS] Generating a query that never returns

2011-09-19 Thread Florian Pflug
On Sep19, 2011, at 17:59 , David Fetter wrote: On Mon, Sep 19, 2011 at 05:12:15PM +0200, Florian Pflug wrote: My first try, BTW, was WITH RECURSIVE infinite(value) AS (SELECT 1 UNION ALL SELECT 1) SELECT * FROM infinite but that returns only two rows. I'd have expected it to returns an