Hi,
Using the latest amalgamation build sqlite-autoconf-3080801 I'm seeing the
following inconsistent behaviour:

$ ./sqlite3
sqlite> .headers on
sqlite> pragma short_column_names;
1
sqlite> pragma full_column_names;
0
sqlite> create table tbl1 (id1 integer, s1 text);
sqlite> create table tbl2 (id2 integer, s2 text);
sqlite> insert into tbl1 values (1, 'v1');
sqlite> insert into tbl2 values (1, 'v2');
sqlite> select x.id1, x.s1, y.s2 from tbl1 x inner join tbl2 y on
x.id1=y.id2;
id1|s1|s2
1|v1|v2

So far so good, everything as expected. If I rewrite the above select
statement to do a join with a subquery instead the resulting output changes
in an unexpected way.

sqlite> 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;
x.id1|x.s1|subq.s2
1|v1|v2

Here we get unexpected column prefixes on all fetched columns. If I rewrite
the query again to a subq.* query the behaviour is different again where
only the first two columns have prefixes.

sqlite> 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;
x.id1|x.s1|id2|s2
1|v1|1|v2

Expected behaviour: returned columns should not contain prefixes in any of
the above scenarios.

Kind regards,

Marcus Bergner
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to