I have some queries being run in a java program that makes use of a PostgreSQL database and some parts of an old version of JDataStore (the parts used to interact with the database). Sometimes the queries are sent to the database twice from one execution of a query. What's even more odd is that the first query sent is slightly different than the second, and is incorrect. For example:
First Query (incorrect)
SELECT b."construct_id", c."instance_id", a.SymbolName, c.Address AddressDecimal,
c.Description, b.ConstructName, a.DeclarationType, a.Symbol_id,
a.SymbolType_id, a.Construct_id, a.Leaf
FROM tblSymbolDeclaration a, tblLanguageConstructName b, tblSymbolInstance c
WHERE a.Construct_id = b.Construct_id and a.Symbol_id = c.Symbol_id
and a.DeclarationType = 1 and a.Root = 1
Note the two fields at the start of that query, and the lack of the word 'as', compared with this:
Second Query (correct)
SELECT a.SymbolName, c.Address as AddressDecimal, c.Description,
b.ConstructName, a.DeclarationType, a.Symbol_id, a.SymbolType_id,
a.Construct_id, a.Leaf
FROM tblSymbolDeclaration a, tblLanguageConstructName b, tblSymbolInstance c
WHERE a.Construct_id = b.Construct_id and a.Symbol_id = c.Symbol_id
and a.DeclarationType = 1 and a.Root = 1
We have a set list of queries we use, and the first query is not even in that list. What could cause this? (Sorry that I have provided no code, but it is not feasible to do so in this situation.)