From dgroth at gmx.net Thu Jun 30 10:30:49 2005 From: dgroth at gmx.net (Detlef Groth) Date: Thu Jun 30 10:37:30 2005 Subject: [Pgtcl-hackers] wrong left outer joins with pgtcl Message-ID: <19270.1120123849@www73.gmx.net> Hello all, I observed, that the left outer join both with Pgtcl 1.4 and Pgtcl 1.5 against oracle 8 are not working properly. We get empty rows if using a '*'! Sample session: (tclkit) 2 % lappend auto_path d:/tcl-lib D:/tcl-programme/tclkit/tclkit8.4.8.upx.exe/lib/tcl8.4 D:/tcl-programme/tclkit/tclkit8.4.8.upx.exe/lib D:/tcl-programme/tclkit/tclkit8.4.8.upx.exe/lib/tk8.4 d:/tcl-lib (tclkit) 3 % package require Pgtcl 1.5 (tclkit) 10 % set conninfo "dbname=test port=5432 host=babelfish.molgen.mpg.de user=scott password=tiger" dbname=test port=5432 host=babelfish.molgen.mpg.de user=max password=**** (tclkit) 11 % set db [pg_connect -conninfo $conninfo] pgsql256 (tclkit) 12 % pg_execute $db "create table test (col1 INTEGER,col2 INTEGER)" (tclkit) 13 % pg_execute $db "insert into test (col1,col2) values (1,2)" 1 (tclkit) 14 % pg_execute $db "insert into test (col1,col2) values (2,3)" 1 (tclkit) 18 % pg_execute $db "create table test2 (col1 INTEGER,col2 INTEGER)" (tclkit) 19 % pg_execute $db "insert into test2 (col1,col2) values (2,3)" 1 (tclkit) 20 % pg_execute $db "insert into test2 (col1,col2) values (4,5)" 1 (tclkit) 23 % pg_execute -array v $db "select * from test2" { puts [array get v] } col2 3 col1 2 col2 5 col1 4 2 (tclkit) 24 % pg_execute -array v $db "select * from test" { puts [array get v] } col2 2 col1 1 col2 3 col1 2 2 (tclkit) 26 % pg_execute -array v $db "select * from test left outer join test2 on test.col1 = test2.col1" { puts [array get v] } col2 {} col1 {} col2 3 col1 2 2 the first row should give a 1 for col1. It is possible to fix this via avoiding "*" (tclkit) 27 % pg_execute -array v $db "select test.col1 from test left outer join test2 on test.col1 = test2.col1" { puts [array get v] } col2 3 col1 1 col2 3 col1 2 2 (tclkit) 28 % pg_execute -array v $db "select test.col1 as tcol1, test.col2 as tcol2, test2.col1 as t2col1,test2.col2 as t2col2 from test left outer join test2 on test.col1 = test2.col1" { puts [array get v] } tcol2 2 col2 3 t2col1 {} t2col2 {} tcol1 1 col1 2 tcol2 3 col2 3 t2col1 2 t2col2 3 tcol1 2 col1 2 2 But this is somewhow error prone. And why the star just returns 2 columns instead of the existing 4. So it seems you can't use the star with outer joins currently. regards, Detlef From dgroth at gmx.net Thu Jun 30 09:30:49 2005 From: dgroth at gmx.net (Detlef Groth) Date: Thu, 30 Jun 2005 11:30:49 +0200 (MEST) Subject: [Pgtcl-hackers] wrong left outer joins with pgtcl Message-ID: <19270.1120123849@www73.gmx.net> Hello all, I observed, that the left outer join both with Pgtcl 1.4 and Pgtcl 1.5 against oracle 8 are not working properly. We get empty rows if using a '*'! Sample session: (tclkit) 2 % lappend auto_path d:/tcl-lib D:/tcl-programme/tclkit/tclkit8.4.8.upx.exe/lib/tcl8.4 D:/tcl-programme/tclkit/tclkit8.4.8.upx.exe/lib D:/tcl-programme/tclkit/tclkit8.4.8.upx.exe/lib/tk8.4 d:/tcl-lib (tclkit) 3 % package require Pgtcl 1.5 (tclkit) 10 % set conninfo "dbname=test port=5432 host=babelfish.molgen.mpg.de user=scott password=tiger" dbname=test port=5432 host=babelfish.molgen.mpg.de user=max password=**** (tclkit) 11 % set db [pg_connect -conninfo $conninfo] pgsql256 (tclkit) 12 % pg_execute $db "create table test (col1 INTEGER,col2 INTEGER)" (tclkit) 13 % pg_execute $db "insert into test (col1,col2) values (1,2)" 1 (tclkit) 14 % pg_execute $db "insert into test (col1,col2) values (2,3)" 1 (tclkit) 18 % pg_execute $db "create table test2 (col1 INTEGER,col2 INTEGER)" (tclkit) 19 % pg_execute $db "insert into test2 (col1,col2) values (2,3)" 1 (tclkit) 20 % pg_execute $db "insert into test2 (col1,col2) values (4,5)" 1 (tclkit) 23 % pg_execute -array v $db "select * from test2" { puts [array get v] } col2 3 col1 2 col2 5 col1 4 2 (tclkit) 24 % pg_execute -array v $db "select * from test" { puts [array get v] } col2 2 col1 1 col2 3 col1 2 2 (tclkit) 26 % pg_execute -array v $db "select * from test left outer join test2 on test.col1 = test2.col1" { puts [array get v] } col2 {} col1 {} col2 3 col1 2 2 the first row should give a 1 for col1. It is possible to fix this via avoiding "*" (tclkit) 27 % pg_execute -array v $db "select test.col1 from test left outer join test2 on test.col1 = test2.col1" { puts [array get v] } col2 3 col1 1 col2 3 col1 2 2 (tclkit) 28 % pg_execute -array v $db "select test.col1 as tcol1, test.col2 as tcol2, test2.col1 as t2col1,test2.col2 as t2col2 from test left outer join test2 on test.col1 = test2.col1" { puts [array get v] } tcol2 2 col2 3 t2col1 {} t2col2 {} tcol1 1 col1 2 tcol2 3 col2 3 t2col1 2 t2col2 3 tcol1 2 col1 2 2 But this is somewhow error prone. And why the star just returns 2 columns instead of the existing 4. So it seems you can't use the star with outer joins currently. regards, Detlef