【发布时间】:2010-01-06 14:57:40
【问题描述】:
我有一些查询正在使用 PostgreSQL 数据库和旧版本 JDataStore 的某些部分(用于与数据库交互的部分)的 java 程序中运行。有时,查询会从一次查询的执行中两次发送到数据库。更奇怪的是,发送的第一个查询与第二个略有不同,而且是不正确的。例如:
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
请注意该查询开头的两个字段,以及缺少单词“as”,与此相比:
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
我们有一组我们使用的查询列表,而第一个查询甚至不在该列表中。什么可能导致这种情况? (对不起,我没有提供代码,但在这种情况下这样做是不可行的。)
【问题讨论】:
标签: java sql postgresql