Hello Pavel,

thanks for your reply.

On 2010-08-18 20:39, Pavel Ivanov wrote:
>> Summary: how can I use foreign keys across database boundaries? Is it at
>> all possible?
> 
> No. It's logically incorrect action, so it's impossible. If you want
> consistency of your tables to be automatically checked by database
> engine you need to allow that engine to see those tables at all times.
Sorry to disagree, concerning the logic. But I can't see why an error
about texts.text instead of main.text would make such a difference. Why
is one more logical than the other? In either case the insertion would
fail, since it can only be checked when it happens and it probably will
not be checked again afterwards.

If SQLite supports attaching multiple databases it would be natural to
support foreign tables across them.

The only possible catch I see is if the references are two-way (or
more). Then it could really get messy, although the principle of failing
if the table does not exist would still apply. I guess I'll have to
dedicate a night or two to read over the code to get an idea about the
"why".

> For SQLite it means that you need to keep those tables in one
> database. If you insist on keeping tables in different databases then
> your application should check consistency itself because it's the only
> one knowing how to keep track of different files.
I guess what I'll simply dump the data from the "static" DB (which will
only be modified manually) and import it right before creating the new
tables.


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

Reply via email to