On 29/03/17 02:38, Simon Slavin wrote:
On 29 Mar 2017, at 1:34am, Domingo Alvarez Duarte <mingo...@gmail.com> wrote:
It seems sqlite look first if there is a temp.table before main.table and
without qualification temp.table is used.
You got it. It’s not obvious that this is what SQLite would do. But now you
know it you understand what is happening.
Thanks for helping to clear this up. I should have tested the content
of the table before doing the update and especially before posting. Oh well.
I didn't expect temp to win over main like that. Especially because I
recently read the documentation page for "ATTACH DATABASE".
Tables in an attached database can be referred to using the syntax
/schema-name.table-name/. If the name of the table is unique across
all attached databases and the main and temp databases, then the
/schema-name/ prefix is not required. If two or more tables in
different databases have the same name and the /schema-name/ prefix is
not used on a table reference, then the table chosen is the one in the
database that was *least recently attached*.
So I guess for our purposes temp is "less recently" attached than main,
which wasn't an obvious fact to me.
Mark
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users