Re: Empty SELECT result at simultaneous calls - Mailing list pgsql-general

From Craig Ringer
Subject Re: Empty SELECT result at simultaneous calls
Date
Msg-id 4C899A3C.4050903@postnewspapers.com.au
Whole thread Raw
In response to Re: Empty SELECT result at simultaneous calls  (Stefan Wild <wilds81@yahoo.de>)
Responses Re: INSERT with SELECT not working in pgAdmin
List pgsql-general
On 09/10/2010 03:33 AM, Stefan Wild wrote:

> Thanks for the good Idea! Unfortunately it is old data (already inserted since some days) so this cannot be the
reason...

Is there any chance you can provide a self-contained example that
includes both a populated database and the complete, compilable servlet
code required to run it? If you can post a SQL dump of a test database
that demonstrates the problem, and some Java sources that can be
compiled to to a deployable .war, it'll be a lot easier to see what's
going on.

As for the old data: are you sure the inserting transactions have
committed? Nothing stops them from being open for hours or days.

If it's not that, my next best bet would be a concurrency bug in your
code. That's not a slur on your programming skill; I'd assume the same
thing if it was my code, because I know that bugs in released, tested
PostgreSQL code are uncommon and bugs in my in-progress code are very
common. In your case you're using a shared "DbManager" (the source code
for which you have not supplied) and you haven't shown how you get from
there to query execution and result processing. You also haven't shown
how your code concludes that the results are empty.

PostgreSQL's JDBC driver is supposed to provide a fair degree of
concurrency management, making sure that only one thread may use a given
connection at a time. That only protects the driver and its
connection(s) though; it can't protect your code. If you do out-of-spec
things involving sharing resultsets, for example, you will have problems.

--
Craig Ringer


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: User function canceling VACUUMDB utility
Next
From: Craig Ringer
Date:
Subject: Re: error while autovacuuming