Re: [sqlite] How to prevent the insertion of cycles into a hierarchical table?

2017-12-24 Thread Shane Dev
Thanks for the wonderfully simple and concise solution. I see now triggers do support CTEs if they SELECT a RAISE() function. I never thought of using a BEFORE trigger. Fijne kerstdagen On 24 December 2017 at 17:17, E.Pasma wrote: > On 24/12/2017 11:56, Shane Dev wrote: >

Re: [sqlite] How to prevent the insertion of cycles into a hierarchical table?

2017-12-24 Thread E.Pasma
On 24/12/2017 11:56, Shane Dev wrote: Related to my previous question https://www.mail-archive.com/sqlite-users@mailinglists.sqlit e.org/msg107527.html, I want to prevent the client from inserting a cycle. For example - sqlite> .sch edges CREATE TABLE edges(parent integer not null, child

Re: [sqlite] How to prevent the insertion of cycles into a hierarchical table?

2017-12-24 Thread J Decker
make child a unique key. so each node can only have 1 parent. On Sun, Dec 24, 2017 at 6:44 AM, Lifepillar wrote: > On 24/12/2017 11:56, Shane Dev wrote: > >> Related to my previous question >> https://www.mail-archive.com/sqlite-users@mailinglists.sqlit >>

Re: [sqlite] How to prevent the insertion of cycles into a hierarchical table?

2017-12-24 Thread Lifepillar
On 24/12/2017 11:56, Shane Dev wrote: Related to my previous question https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg107527.html, I want to prevent the client from inserting a cycle. For example - sqlite> .sch edges CREATE TABLE edges(parent integer not null, child

[sqlite] How to prevent the insertion of cycles into a hierarchical table?

2017-12-24 Thread Shane Dev
Related to my previous question https://www.mail-archive.com/sqlite-users@mailinglists.sqlite.org/msg107527.html, I want to prevent the client from inserting a cycle. For example - sqlite> .sch edges CREATE TABLE edges(parent integer not null, child integer not null, constraint self_reference