> Ok, so cross-database view is not supported. Right?

Correct. I remember there was some message on this list about these
matters. And IIRC it even offered some simple patch to SQLite sources
to allow cross-database view support. You might try to search the
archives.

> So as it is not possible to
> create the foreign key constraint with no attached database (because parent
> table doesn't exist), I can imagine that SQLite doesn't allow to detach
> database when foreign key constraints exist on it.

OK. Now you've done with this connection, close it, maybe even close
your application, restart it, connect to database once more but do not
attach that database foreign key refers to. What should SQLite do
here? Or another scenario: you open connection straight to the other
database and drop all data from your referred table. How should SQLite
enforce foreign key here?

Unless database is in one piece and in full control of SQLite there
always will be scenario when foreign key cannot be enforced properly.


Pavel

On Wed, Jan 20, 2010 at 11:07 AM, Tiberio, Sylvain
<sylvain.tibe...@eads.com> wrote:
> Ok, so cross-database view is not supported. Right?
>
> About "cross-database foreign key constraints": I agree with you that
> attached database can be dettached or changed. So as it is not possible to
> create the foreign key constraint with no attached database (because parent
> table doesn't exist), I can imagine that SQLite doesn't allow to detach
> database when foreign key constraints exist on it.
>
> Sylvain
>
> -----Original Message-----
> From: sqlite-users-boun...@sqlite.org
> [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Pavel Ivanov
> Sent: Wednesday, January 20, 2010 4:40 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Attached database
>
> I wouldn't say anything about views - from my POV there's no much harm in
> supporting cross-database views other than possible user confusion
> (personally I don't know why it was decided to not support this). But
> concerning foreign keys: how do you think SQLite is supposed to enforce
> foreign key when other database is not attached or when you attach another
> database with the same alias that have table with the same name but with
> completely different data?
>
>
> Pavel
>
> On Wed, Jan 20, 2010 at 10:33 AM, Tiberio, Sylvain
> <sylvain.tibe...@eads.com> wrote:
>> Hi,
>> I remark some effects if I use a main database with other attached
>> database (ATTACH command):
>> - I cannot create view in main database that select columns from main
>> database and attached database.
>> - There is no foreign key constraints control is the foreign key is on
>> an attached database table.
>> Is there any think to do to be able to do that? Do I forget something?
>>
>> Regards,
>>
>> Sylvain
>>
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to