My main reason for questioning the inconsistency in returned column names between the three following cases is that SQL standards and other SQL databases seem to all return short column names, not prefix.column name in the three below scenarios. Having SQLite behave differently than everyone else is a compatibility problem that can prevent people from using SQLite in a smooth manner.
select x.id1, x.s1, y.s2 from tbl1 x inner join tbl2 y on x.id1=y.id2; select x.id1, x.s1, subq.s2 from tbl1 x inner join (select * from tbl2 y where y.id2=1) subq on x.id1=subq.id2; select x.id1, x.s1, subq.* from tbl1 x inner join (select * from tbl2 y where y.id2=1) subq on x.id1=subq.id2; I did a small attempt yesterday at fixing my local sqlite build and I needed a patch of about 5 lines in sqlite3ExprListSetSpan to make it return consistent short names. I don't have the full test suite so can't say for sure it is all good but looks fairly promising. sqlite> select 1*2, x.id1, x.s1, subq.s2 from tbl1 x inner join (select * from tbl2 y where y.id2=1) subq on x.id1=subq.id2; 1*2|id1|s1|s2 2|1|v1|v2 sqlite> select 1*2 as magicnumber, x.id1 as 'xyz.col', x.s1, subq.s2 from tbl1 x inner join (select * from tbl2 y where y.id2=1) subq on x.id1=subq.id2; magicnumber|xyz.col|s1|s2 2|1|v1|v2 Fix is pretty much this: char *dot = (char*)memchr(pSpan->zStart, '.', (int)(pSpan->zEnd - pSpan->zStart)); if (dot) { pItem->zSpan = after dot up to pSpan->zEnd } else { pItem->zSpan = entire pSpan->zStart to zEnd string (same as before) } Kind regards, Marcus Bergner _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users