The statements work. Insertion fails. Roman
________________________________________ From: sqlite-users [[email protected]] on behalf of David Yip [[email protected]] Sent: Thursday, October 25, 2018 12:37 AM To: SQLite mailing list Subject: Re: [sqlite] nested foreign keys These statements worked for me: CREATE TABLE grandparent (id INTEGER PRIMARY KEY); CREATE TABLE parent (id INTEGER PRIMARY KEY REFERENCES grandparent(id)); CREATE TABLE child (id INTEGER PRIMARY KEY REFERENCES parent(id)); The foreign key constraints work as you'd expect also. What are you doing and what error are you seeing? - David On Wed, Oct 24, 2018 at 11:30 PM Roman Fleysher < [email protected]> wrote: > Dear SQLiters, > > I am trying to set up what I would call "nested foreign keys": > > create grandParent (id PRIMARY KEY ) > create parent (id PRIMARY KEY REFERENCES grandParent(id)) > create child (id PRIMARY KEY REFERENCES parent(id)) > > SQLite complains. Does it mean that grand children are not allowed? > > Thank you, > > Roman > _______________________________________________ > sqlite-users mailing list > [email protected] > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

