On Wed, Feb 8, 2017 at 12:24 AM, Clemens Ladisch <clem...@ladisch.de> wrote:

> Igor Korot wrote:
> > Does SQLite supports the FK name?
> > If yes, what is the proper syntax?
>
>   CREATE TABLE t (
>     x PRIMARY KEY,
>     y,
>     CONSTRAINT this_is_the_name FOREIGN KEY (y) REFERENCES t(x)
>   );
>
> or
>
>   CREATE TABLE t (
>     x PRIMARY KEY,
>     y CONSTRAINT this_is_the_name REFERENCES t(x)
>   );
>
> But it is ignored:
>
>   > PRAGMA foreign_key_list(t);
>   0|0|t|y|x|NO ACTION|NO ACTION|NONE
>   > INSERT INTO t VALUES (1, 2);
>   Error: FOREIGN KEY constraint failed
>
> the value 2 you set for Y doesn't exsit as an X in t.


>
> Regards,
> Clemens
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to