This is the patch to fix the problem I mentioned below. Can someone take a look and see if this is a right fix ? It seems to be working fine in a few tests that I did.

Index: select.c
===================================================================
RCS file: /home/source/strummer/sqlite3/select.c,v
retrieving revision 1.1
diff -w -u -r1.1 select.c
--- select.c    6 Dec 2006 19:04:18 -0000    1.1
+++ select.c    6 Dec 2006 19:56:32 -0000
@@ -1338,7 +1338,7 @@
              pExpr = pRight;
              pExpr->span = pExpr->token;
            }
-            if( longNames ){
+            if( longNames || pTabList->nSrc>1 ){
              pNew = sqlite3ExprListAppend(pNew, pExpr, &pExpr->span);
            }else{
              pNew = sqlite3ExprListAppend(pNew, pExpr, &pRight->token);


Thanks,
Sandeep

Sandeep Suresh wrote:
When doing a select with join as :

select * from table_1
left join table_2
on table_1.column11 = table2.column21

column names are *not *qualified with table names. Instead, what I get is column11, column12, column21, column22 and so on. ( where column11, column12 are from table_1 and column21, column22 are from table_2 )

According to the wiki, when there is a join involved, I should be getting the column names as *table1.column11*, *table2.column12* and so on.....

http://www.sqlite.org/cvstrac/wiki?p=ColumnNames ( case 4 applies in my case )

Also note that, if instead I do the following it works as expected and column names *are *qualified with table_names

select table1.column11, table2.column21, table2.column22
from table_1
left join table_2
on table_1.column11 = table_2.column21;

I'm using version 3.3.8 and have both short_column_names and full_column_names flags turned 'off'

I'm not sure if I'm missing something here or this is a bug ?

Any help would be appreciated.

-Sandeep.



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to