Menu

#510 table qualification in join stmt leads to incorrect result

V3.2
open
nobody
SQL API (45)
5
2011-06-04
2011-06-04
No

Hi Xue,

There could be a bug. Generally we might have coded to handle tablename.fieldname by default. Resolving fieldname across tables in join list might be a issue.

Thank you very much for pointing it out. Will will look into this issue.

Regards
Gopal S

On Thu, Jun 2, 2011 at 1:45 PM, zhongbin xue... wrote:

Dear Sir,

I tested CSQL 3.3 (Open source version), and found a bug when joining two
tables. The details are as follows:

Two tables:T1(A int,B int,C int) T2(C int, D int)
Five tuples in each table:
T1:(0,1,2)(1,2,3)(2,3,4)(3,4,5)(4,5,6)
T2:(0,1)(1,2)(2,3)(3,4)(4,5)
Three join statements:
A) select A,D from T1,T2 where T1.A=T2.C
B) select A,T2.D from T1,T2 where T1.A=T2.C
C) select T1.A,D from T1,T2 where T1.A=T2.C
The result:
A) CSQL>select A,D from T1,T2 where T1.A=T2.C
---------------------------------------------------------
A D
---------------------------------------------------------
144149184 1
144149184 2
144149184 3
144149184 4
144149184 5
B) CSQL>select A,T2.D from T1,T2 where T1.A=T2.C
---------------------------------------------------------
A T2.D
---------------------------------------------------------
144146936 1
144146936 2
144146936 3
144146936 4
144146936 5
C) CSQL>select T1.A,D from T1,T2 where T1.A=T2.C
---------------------------------------------------------
T1.A D
---------------------------------------------------------
0 1
1 2
2 3
3 4
4 5

The system seems to require the first attribute in the select clause
to be in the form tableName.Fieldname. Is it a bug?

Thanks ahead for your help.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.