Hi,

I have tracked down a bug in some other software where two tables have the same 
name, where it seems that the one table was masking the other.

I can demonstrate simply with the following (on v3.6.23.1):

create table t(i);
insert into t values (1);

attach database "other.db" as other;
create table other.t(i);
insert into other.t values(2);

select * from t;
>> 1

create temp table t(i);
insert into temp.t values(3);
insert into t values(4);

select * from t;
>> 3
>> 4

select * from main.t;
>> 1



What happens is that the table 't' in the main connection takes precedence over 
table 't' in the attached database, but *not* over the temporary table.

My question is, is this correct behaviour on the part of sqlite?  If so, please 
could it be documented on the "CREATE TABLE" page (perhaps with a warning?).  
My apologies if this is already documented and known, but I did try to find 
where it might be documented to no avail.  Would it be better if sqlite 
returned an error saying that table 't' is ambiguous if you don't specify which 
database it is in and it is present in more than one?  Alternatively, would it 
be better if it always took the table from the main connection over any others?

Thanks
Andy

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

Reply via email to