SQLite Forum

R*Tree table constraints
Login

R*Tree table constraints

(1) By anonymous on 2021-03-25 11:21:25 [link] [source]

Table constraints seems to be disallowed for R*Tree tables:

sqlite> create virtual table test using rtree(id integer primary key, x1, x2, y1, y2, check(x1 < x2));
Error: near "REAL": syntax error

Column constraints are accepted, but does not seem to have any effect:

sqlite> create virtual table test using rtree(id integer primary key, x1, x2 check (x2 > x1), y1, y2 (check y2 > y1));
sqlite> insert into test values(1, 1, 1, 1, 1);
sqlite>

(2) By Richard Hipp (drh) on 2021-03-25 13:02:17 in reply to 1 [source]

Yes, you are correct on both counts.

(3) By anonymous on 2021-03-25 13:12:21 in reply to 2 [link] [source]

Thanks! Feature or bug? From the tone of your reply, I'd guess the former :)

(4) By Keith Medcalf (kmedcalf) on 2021-03-25 13:18:10 in reply to 3 [link] [source]

I would have replied "Working as Designed and Documented".

See https://sqlite.org/rtree.html section 3.1.1

(5) By anonymous on 2021-03-25 14:03:58 in reply to 4 [link] [source]

Got it, thanks.