I have enabled the transitive closure extension and I followed the steps
regarding querying the virtual table mentioned in closure.c file as follows

CREATE VIRTUAL TABLE ct1 USING transitive_closure(
       tablename='group1',
       idcolumn='groupId',
       parentcolumn='parentId'
       );

CREATE TABLE group1(
     groupId INTEGER PRIMARY KEY,
     parentId INTEGER REFERENCES group1
      );

CREATE INDEX group_idx1 ON group(parentId);

SELECT group1.* FROM group1, ct1
        WHERE element.groupid=ct1.id
         AND ct1.root=?1
         AND ct1.depth<=2;

In the above query, can the root be assigned a text data type?

I tried with INTEGER data type for both groupId and parentId, it worked
fine but when they are TEXT or INT data type and if I query like
ct1.root='SQLITE' there was no output.

Can anyone kindly tell help me regarding this ?

Reply via email to