Download http://www.fstutoring.com/~chris/temp/bug.sqlite3 or load the
.dump below the ---snip---; then perform the following:
$ sqlite3 -header bug.sqlite3
sqlite> select * from marking_next;
transition|place|marking
t1|p1|0
t1|p3|3
t1|p4|1
t2|p1|2
t2|p3|1
t2|p4|2
sqlite> select * from marking_next_tbl;
transition|place|marking
t1|p1|0
t1|p3|3
t1|p4|1
t2|p1|2
t2|p3|1
t2|p4|2
sqlite> select * from marking_next natural join active_transition;
transition|place|marking
t1|p3|3
sqlite> select * from marking_next_tbl natural join active_transition;
transition|place|marking
t1|p1|0
t1|p3|3
t1|p4|1
Obviously the last two queries should produce identical results (since
marking_next and marking_next_tbl are identical), but they do not.
---snip---
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE place (place not null primary key);
INSERT INTO "place" VALUES('p1');
INSERT INTO "place" VALUES('p2');
INSERT INTO "place" VALUES('p3');
INSERT INTO "place" VALUES('p4');
CREATE TABLE transition (transition not null primary key);
INSERT INTO "transition" VALUES('t1');
INSERT INTO "transition" VALUES('t2');
CREATE TABLE pt (place not null references place, transition not null
references transition, weight integer not null, primary key (place,
transition));
INSERT INTO "pt" VALUES('p1','t1',1);
INSERT INTO "pt" VALUES('p2','t2',1);
INSERT INTO "pt" VALUES('p3','t2',1);
CREATE TABLE tp (transition not null references transition, place not null
references place, weight integer not null, primary key (transition,
place));
INSERT INTO "tp" VALUES('t1','p2',1);
INSERT INTO "tp" VALUES('t1','p3',1);
INSERT INTO "tp" VALUES('t2','p4',1);
INSERT INTO "tp" VALUES('t2','p1',1);
CREATE TABLE marking (place not null primary key references place, marking
integer not null);
INSERT INTO "marking" VALUES('p1',1);
INSERT INTO "marking" VALUES('p3',2);
INSERT INTO "marking" VALUES('p4',1);
CREATE TABLE marking_next_tbl (transition, place, marking);
INSERT INTO "marking_next_tbl" VALUES('t1','p1',0);
INSERT INTO "marking_next_tbl" VALUES('t1','p3',3);
INSERT INTO "marking_next_tbl" VALUES('t1','p4',1);
INSERT INTO "marking_next_tbl" VALUES('t2','p1',2);
INSERT INTO "marking_next_tbl" VALUES('t2','p3',1);
INSERT INTO "marking_next_tbl" VALUES('t2','p4',2);
CREATE VIEW active_transition as select transition from pt left join
marking using (place) group by transition having min(coalesce(marking, 0)
= weight) > 0;
CREATE VIEW delta as select transition, place, coalesce(tp.weight, 0) -
coalesce(pt.weight, 0) as delta from (transition join place) left join pt
using (transition, place) left join tp using (transition, place);
CREATE VIEW marking_next as select transition, place, marking + delta as
marking from marking natural join delta;
COMMIT;
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users