Kees Nuyt wrote:

> It is by design. At the bottom of
> http://www.sqlite.org/lang_createtable.html
> it says:
> The parent key of a foreign key constraint is not allowed to use the
> rowid. The parent key must used named columns only.
> 
> This means you have to alias the rowid to be able to refer to it in
> a foreign key clause.
> 
> In your case, the foreign key clause does not explicitly refer to a
> specific column in the parent table, foo. SQLite probably tries to
> find the primary key of the parent table, but there isn't one.
> 
> In general it is a bad idea to depend on the implicit existence of
> rowid. Make it a habit to alias rowid to an explicit integer primary
> key. It makes your code more portable and more readible.
> 
> For readibility, I would also explicitly name the column in the
> foreign key clause. So your example would become:

Thanks a lot Kees.
Yes, I think it is better too; I just tried to see what type of tables are 
tolerated for a foreign relation.

Julien

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

Reply via email to