diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:24:36 +0000 |
commit | 06eaf7232e9a920468c0f8d74dcf2fe8b555501c (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /storage/oqgraph/mysql-test | |
parent | Initial commit. (diff) | |
download | mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.tar.xz mariadb-06eaf7232e9a920468c0f8d74dcf2fe8b555501c.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'storage/oqgraph/mysql-test')
63 files changed, 11474 insertions, 0 deletions
diff --git a/storage/oqgraph/mysql-test/oqgraph/boundary_conditions.result b/storage/oqgraph/mysql-test/oqgraph/boundary_conditions.result new file mode 100644 index 00000000..de8362c1 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/boundary_conditions.result @@ -0,0 +1,215 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +call mtr.add_suppression("graph_base is open on delete"); +CREATE TABLE graph2 ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +SELECT * FROM graph2 WHERE latch='dijkstras' AND origid=1 AND destid=6; +ERROR 42S02: Table 'test.graph_base' doesn't exist +DROP TABLE graph2; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); +# Expect no result, because of autocast +SELECT * FROM graph WHERE latch=0 ; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=0 and origid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=0 and destid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=0 and origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=0 and origid is NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=1 ; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=1 and destid=2 and origid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=1 and origid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=1 and destid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=1 and origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=1 and origid is NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=2 ; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=2 and destid=2 and origid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=2 and origid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=2 and destid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=2 and origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=2 and origid is NULL; +latch origid destid weight seq linkid +# Should this return an error? it seems we treat it as just another bogus latch +SELECT * FROM graph WHERE latch='ThisExceeds32Characters456789012'; +latch origid destid weight seq linkid +# Expect no result, because of invalid latch +SELECT * FROM graph WHERE latch='bogus'; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='bogus' and destid=2 and origid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='bogus' and origid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='bogus' and destid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='bogus' and origid=666; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='bogus' and origid is NULL; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='666'; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='666' and destid=2 and origid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='666' and origid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='666' and destid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='666' and origid=666; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='666' and origid is NULL; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='-1'; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='-1' and destid=2 and origid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='-1' and origid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='-1' and destid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='-1' and origid=666; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='-1' and origid is NULL; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +# Make sure we don't crash if someone passed in a UTF string +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄'; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and destid=2 and origid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and destid=1; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=666; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid is NULL; +latch origid destid weight seq linkid +Warnings: +Warning 1210 Incorrect arguments to OQGRAPH latch +# Return all edges when latch is NULL +SELECT * FROM graph WHERE latch is NULL; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +SELECT * FROM graph WHERE latch is NULL and destid=2 and origid=1; +latch origid destid weight seq linkid +NULL 1 2 1 3 1 +NULL 1 2 1 2 3 +NULL 1 2 1 1 2 +SELECT * FROM graph WHERE latch is NULL and origid=1; +latch origid destid weight seq linkid +NULL 1 NULL 1 2 3 +NULL 1 NULL 1 1 2 +SELECT * FROM graph WHERE latch is NULL and destid=1; +latch origid destid weight seq linkid +NULL NULL 1 1 2 3 +NULL NULL 1 1 1 2 +SELECT * FROM graph WHERE latch is NULL and origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch is NULL and origid is NULL; +latch origid destid weight seq linkid +NULL NULL NULL NULL NULL 1 +NULL NULL NULL NULL NULL 2 +NULL NULL NULL NULL NULL 3 +NULL NULL NULL NULL NULL 4 +NULL NULL NULL NULL NULL 5 +NULL NULL NULL NULL NULL 6 +INSERT INTO graph_base(from_id, to_id) VALUES (1,2); +ERROR 23000: Duplicate entry '1-2' for key 'PRIMARY' +DELETE FROM graph_base; +SELECT * FROM graph; +latch origid destid weight seq linkid +FLUSH TABLES; +TRUNCATE TABLE graph_base; +SELECT * FROM graph; +latch origid destid weight seq linkid +DROP TABLE graph_base; +FLUSH TABLES; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +ERROR 42S02: Table 'test.graph_base' doesn't exist +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/boundary_conditions.test b/storage/oqgraph/mysql-test/oqgraph/boundary_conditions.test new file mode 100644 index 00000000..9eea290c --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/boundary_conditions.test @@ -0,0 +1,139 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +--enable_warnings + +call mtr.add_suppression("graph_base is open on delete"); + +CREATE TABLE graph2 ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +# Because the backing store graph_base doesnt exist yet, the select should fail +--error S42S02 +SELECT * FROM graph2 WHERE latch='dijkstras' AND origid=1 AND destid=6; +DROP TABLE graph2; + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); + +--echo # Expect no result, because of autocast +SELECT * FROM graph WHERE latch=0 ; +SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1; +SELECT * FROM graph WHERE latch=0 and origid=1; +SELECT * FROM graph WHERE latch=0 and destid=1; +SELECT * FROM graph WHERE latch=0 and origid=666; +SELECT * FROM graph WHERE latch=0 and origid is NULL; +SELECT * FROM graph WHERE latch=1 ; +SELECT * FROM graph WHERE latch=1 and destid=2 and origid=1; +SELECT * FROM graph WHERE latch=1 and origid=1; +SELECT * FROM graph WHERE latch=1 and destid=1; +SELECT * FROM graph WHERE latch=1 and origid=666; +SELECT * FROM graph WHERE latch=1 and origid is NULL; +SELECT * FROM graph WHERE latch=2 ; +SELECT * FROM graph WHERE latch=2 and destid=2 and origid=1; +SELECT * FROM graph WHERE latch=2 and origid=1; +SELECT * FROM graph WHERE latch=2 and destid=1; +SELECT * FROM graph WHERE latch=2 and origid=666; +SELECT * FROM graph WHERE latch=2 and origid is NULL; + +--echo # Should this return an error? it seems we treat it as just another bogus latch +SELECT * FROM graph WHERE latch='ThisExceeds32Characters456789012'; +--echo # Expect no result, because of invalid latch +SELECT * FROM graph WHERE latch='bogus'; +SELECT * FROM graph WHERE latch='bogus' and destid=2 and origid=1; +SELECT * FROM graph WHERE latch='bogus' and origid=1; +SELECT * FROM graph WHERE latch='bogus' and destid=1; +SELECT * FROM graph WHERE latch='bogus' and origid=666; +SELECT * FROM graph WHERE latch='bogus' and origid is NULL; +#-- Note the next line couter-intuitively produces no warning +SELECT * FROM graph WHERE latch='666'; +SELECT * FROM graph WHERE latch='666' and destid=2 and origid=1; +SELECT * FROM graph WHERE latch='666' and origid=1; +SELECT * FROM graph WHERE latch='666' and destid=1; +SELECT * FROM graph WHERE latch='666' and origid=666; +#-- Note the next line couter-intuitively produces no warning +SELECT * FROM graph WHERE latch='666' and origid is NULL; +SELECT * FROM graph WHERE latch='-1'; +SELECT * FROM graph WHERE latch='-1' and destid=2 and origid=1; +SELECT * FROM graph WHERE latch='-1' and origid=1; +SELECT * FROM graph WHERE latch='-1' and destid=1; +SELECT * FROM graph WHERE latch='-1' and origid=666; +SELECT * FROM graph WHERE latch='-1' and origid is NULL; + +--echo # Make sure we don't crash if someone passed in a UTF string +#-- Note the next line couter-intuitively produces no warning +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄'; +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and destid=2 and origid=1; +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=1; +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and destid=1; +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid=666; +#-- Note the next line couter-intuitively produces no warning +SELECT * FROM graph WHERE latch='Ω Ohms Tennis Ball 〄' and origid is NULL; + +#--echo # Expect no result, because of NULL latch +#-- FIXME - in v2 according to http://openquery.com/graph/doc NULL latch should +#-- FIXME - return same as select * from graph; +#--https://bugs.launchpad.net/oqgraph/+bug/1196021 +--echo # Return all edges when latch is NULL +SELECT * FROM graph WHERE latch is NULL; +SELECT * FROM graph WHERE latch is NULL and destid=2 and origid=1; +SELECT * FROM graph WHERE latch is NULL and origid=1; +SELECT * FROM graph WHERE latch is NULL and destid=1; +SELECT * FROM graph WHERE latch is NULL and origid=666; +SELECT * FROM graph WHERE latch is NULL and origid is NULL; + +#-- what happens if we have two links the same? primay key violation... +--error 1062 +INSERT INTO graph_base(from_id, to_id) VALUES (1,2); + +DELETE FROM graph_base; +#-- Uncomment the following after fixing https://bugs.launchpad.net/oqgraph/+bug/1195735 +SELECT * FROM graph; + +FLUSH TABLES; + +TRUNCATE TABLE graph_base; +#-- Uncomment the following after fixing https://bugs.launchpad.net/oqgraph/+bug/xxxxxxx - Causes the later select to not fail! +#-- For now don't report a separate bug as it may be a manifestation of https://bugs.launchpad.net/oqgraph/+bug/1195735 +SELECT * FROM graph; + +#-- Expect error if we pull the table out from under +DROP TABLE graph_base; +FLUSH TABLES; + +--error S42S02 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; + +DROP TABLE graph; + diff --git a/storage/oqgraph/mysql-test/oqgraph/connections_mdev5748.result b/storage/oqgraph/mysql-test/oqgraph/connections_mdev5748.result new file mode 100644 index 00000000..3b71112d --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/connections_mdev5748.result @@ -0,0 +1,35 @@ +connect con1,localhost,root,,; +CREATE TABLE oq_backing ( +origid INT UNSIGNED NOT NULL, +destid INT UNSIGNED NOT NULL, +weight DOUBLE NOT NULL, +PRIMARY KEY (origid, destid), +KEY (destid) +); +CREATE TABLE oq_table ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='oq_backing' origid='origid' destid='destid' weight='weight'; +flush tables; +show fields in oq_table; +Field Type Null Key Default Extra +latch varchar(32) YES MUL NULL +origid bigint(20) unsigned YES NULL +destid bigint(20) unsigned YES NULL +weight double YES NULL +seq bigint(20) unsigned YES NULL +linkid bigint(20) unsigned YES NULL +disconnect con1; +connection default; +show tables; +Tables_in_test +oq_backing +oq_table +drop table oq_table, oq_backing; diff --git a/storage/oqgraph/mysql-test/oqgraph/connections_mdev5748.test b/storage/oqgraph/mysql-test/oqgraph/connections_mdev5748.test new file mode 100644 index 00000000..9d7fab72 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/connections_mdev5748.test @@ -0,0 +1,37 @@ +# +# MDEV-5748 Assertion `status_var.memory_used == 0' fails on disconnect after opening an OQGRAPH table +# + +# try to open oqgraph table in one connection and use in another: + +--connect (con1,localhost,root,,) + +CREATE TABLE oq_backing ( + origid INT UNSIGNED NOT NULL, + destid INT UNSIGNED NOT NULL, + weight DOUBLE NOT NULL, + PRIMARY KEY (origid, destid), + KEY (destid) +); + +CREATE TABLE oq_table ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='oq_backing' origid='origid' destid='destid' weight='weight'; + +flush tables; +show fields in oq_table; +--disconnect con1 + +--connection default +show tables; + +drop table oq_table, oq_backing; + diff --git a/storage/oqgraph/mysql-test/oqgraph/create_attr.result b/storage/oqgraph/mysql-test/oqgraph/create_attr.result new file mode 100644 index 00000000..c7c4b068 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/create_attr.result @@ -0,0 +1,127 @@ +DROP TABLE IF EXISTS not_backing; +DROP TABLE IF EXISTS backing; +DROP TABLE IF EXISTS oqtable; +CREATE TABLE `not_backing` ( +id int(10) unsigned NOT NULL DEFAULT '0', +id2 int(10) unsigned NOT NULL DEFAULT '0', +info varchar(20) DEFAULT NULL, +KEY name (info) +) DEFAULT CHARSET=latin1; +CREATE TABLE backing ( +id int(10) unsigned NOT NULL DEFAULT '0', +id2 int(10) unsigned NOT NULL DEFAULT '0', +parent int(10) unsigned DEFAULT NULL, +weight real(10,4) NOT NULL DEFAULT 0.0, +info varchar(20) DEFAULT NULL, +not_id_type varchar(20) DEFAULT NULL, +not_weight_type varchar(20) DEFAULT NULL, +PRIMARY KEY (id), +KEY name (info) +) DEFAULT CHARSET=latin1; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, ORIGID='id', DESTID='id2'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', ORIGID='id', DESTID='id2'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', ORIGID='id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', DESTID='id2'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='bogus', ORIGID='id', DESTID='id2'; +# Expect: 'Table 'test.bogus' doesn't exist'' +DESCRIBE oqtable; +ERROR 42S02: Table 'test.bogus' doesn't exist +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing'; +# Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing', DESTID='id2'; +# Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='', DESTID='id2'; +# Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus', DESTID='id2'; +# Expect Invalid OQGRAPH backing store ('/oqtable'.origid attribute not set to a valid column of 'backing')' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.origid' attribute not set to a valid column of 'backing')' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type', DESTID='id2'; +# Expect 'Column 'backing.not_id_type' is not a not-null integer type' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Column 'backing.not_id_type' (origid) is not a not-null integer type' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id'; +# Expect 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID=''; +# Expect 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='bogus'; +# Expect Invalid OQGRAPH backing store ('/oqtable'.destid attribute not set to a valid column of 'backing')' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.destid' attribute not set to a valid column of 'backing')' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='not_id_type'; +# Expect 'Column 'backing.not_id_type' is not a not-null integer type' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Column 'backing.not_id_type' (destid) is not a not-null integer type or is a different type to origid attribute.' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id'; +# Expect 'Invalid OQGRAPH backing store ('/oqtable'.destid attribute set to same column as origid attribute)' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.destid' attribute set to same column as origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id2',WEIGHT=''; +# Expect 'Invalid OQGRAPH backing store ('/oqtable'.weight attribute not set to a valid column of 'backing')' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.weight' attribute not set to a valid column of 'backing')' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id2',WEIGHT='bogus'; +# Expect 'Invalid OQGRAPH backing store ('/oqtable'.weight attribute not set to a valid column of 'backing')' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.weight' attribute not set to a valid column of 'backing')' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id2',WEIGHT='not_weight_type'; +# Expect 'Column 'backing.not_weight_type' is not a not-null real type' +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Column 'backing.not_weight_type' (weight) is not a not-null real type' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch varchar(32) NULL NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id2',WEIGHT='weight'; +DESCRIBE oqtable; +Field Type Null Key Default Extra +latch varchar(32) YES MUL NULL +origid bigint(20) unsigned YES NULL +destid bigint(20) unsigned YES NULL +weight double YES NULL +seq bigint(20) unsigned YES NULL +linkid bigint(20) unsigned YES NULL +DROP TABLE IF EXISTS oqtable; +DROP TABLE IF EXISTS backing; +DROP TABLE IF EXISTS not_backing; diff --git a/storage/oqgraph/mysql-test/oqgraph/create_attr.test b/storage/oqgraph/mysql-test/oqgraph/create_attr.test new file mode 100644 index 00000000..c2ca4816 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/create_attr.test @@ -0,0 +1,220 @@ +--disable_warnings +DROP TABLE IF EXISTS not_backing; +DROP TABLE IF EXISTS backing; +DROP TABLE IF EXISTS oqtable; +--enable_warnings + + +CREATE TABLE `not_backing` ( + id int(10) unsigned NOT NULL DEFAULT '0', + id2 int(10) unsigned NOT NULL DEFAULT '0', + info varchar(20) DEFAULT NULL, + KEY name (info) +) DEFAULT CHARSET=latin1; + +CREATE TABLE backing ( + id int(10) unsigned NOT NULL DEFAULT '0', + id2 int(10) unsigned NOT NULL DEFAULT '0', + parent int(10) unsigned DEFAULT NULL, + weight real(10,4) NOT NULL DEFAULT 0.0, + info varchar(20) DEFAULT NULL, + not_id_type varchar(20) DEFAULT NULL, + not_weight_type varchar(20) DEFAULT NULL, + PRIMARY KEY (id), + KEY name (info) +) DEFAULT CHARSET=latin1; + + +# oqgraph v2 create table should fail (missing attributes) +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE oqtable; + + +# no table reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, ORIGID='id', DESTID='id2'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE oqtable; + +# empty table reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', ORIGID='id', DESTID='id2'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE oqtable; + +# empty table reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', ORIGID='id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE oqtable; + + +# empty table reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='', DESTID='id2'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE oqtable; + +# non-existent table reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='bogus', ORIGID='id', DESTID='id2'; +--echo # Expect: 'Table 'test.bogus' doesn't exist'' +--disable_warnings +--error 1146 +DESCRIBE oqtable; +--enable_warnings + +# Table exists but no orig or dest specified +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing'; +--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +--error 1296 +DESCRIBE oqtable; + +# missing origid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing', DESTID='id2'; +--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +--error 1296 +DESCRIBE oqtable; + +# empty origid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='', DESTID='id2'; +--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +--error 1296 +DESCRIBE oqtable; + +# invalid origid reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus', DESTID='id2'; +--echo # Expect Invalid OQGRAPH backing store ('/oqtable'.origid attribute not set to a valid column of 'backing')' +--error 1296 +DESCRIBE oqtable; + +# wrong type origid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type', DESTID='id2'; +--echo # Expect 'Column 'backing.not_id_type' is not a not-null integer type' +--error 1296 +DESCRIBE oqtable; + +# missing destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id'; +--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' +--error 1296 +DESCRIBE oqtable; + +# empty destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID=''; +--echo # Expect 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' +--error 1296 +DESCRIBE oqtable; + +# invalid destid reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='bogus'; +--echo # Expect Invalid OQGRAPH backing store ('/oqtable'.destid attribute not set to a valid column of 'backing')' +--error 1296 +DESCRIBE oqtable; + +# wrong type destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='not_id_type'; +--echo # Expect 'Column 'backing.not_id_type' is not a not-null integer type' +--error 1296 +DESCRIBE oqtable; + +# same origid and destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id'; +--echo # Expect 'Invalid OQGRAPH backing store ('/oqtable'.destid attribute set to same column as origid attribute)' +--error 1296 +DESCRIBE oqtable; + +# invalid weight reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id2',WEIGHT=''; +--echo # Expect 'Invalid OQGRAPH backing store ('/oqtable'.weight attribute not set to a valid column of 'backing')' +--error 1296 +DESCRIBE oqtable; + +# invalid weight reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id2',WEIGHT='bogus'; +--echo # Expect 'Invalid OQGRAPH backing store ('/oqtable'.weight attribute not set to a valid column of 'backing')' +--error 1296 +DESCRIBE oqtable; + +# wrong type weight +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id2',WEIGHT='not_weight_type'; +--echo # Expect 'Column 'backing.not_weight_type' is not a not-null real type' +--error 1296 +DESCRIBE oqtable; + +# all valid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch varchar(32) NULL NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id2',WEIGHT='weight'; +DESCRIBE oqtable; + +#-- Expect an error if we attempt to use a view as the backing store +#-- 'VIEWs are not supported for an OQGRAPH backing store.' +#-- TODO + +#-- TODO - what happens if we make two tables with the same backing store? + +#-- TODO - what happens if data_table is a TEMPORARY table? + +# cleanup +--disable_warnings +DROP TABLE IF EXISTS oqtable; +DROP TABLE IF EXISTS backing; +DROP TABLE IF EXISTS not_backing; +--enable_warnings diff --git a/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.result b/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.result new file mode 100644 index 00000000..d3e22b4f --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.result @@ -0,0 +1,150 @@ +DROP TABLE IF EXISTS not_backing; +DROP TABLE IF EXISTS backing; +DROP TABLE IF EXISTS oqtable; +CREATE TABLE `not_backing` ( +id int(10) unsigned NOT NULL DEFAULT '0', +info varchar(20) DEFAULT NULL, +KEY name (info) +) DEFAULT CHARSET=latin1; +CREATE TABLE backing ( +id int(10) unsigned NOT NULL DEFAULT '0', +nullparent int(10) unsigned DEFAULT NULL, +parent int(10) unsigned DEFAULT 1 NOT NULL, +weight real(10,4) NOT NULL DEFAULT 0.0, +info varchar(20) DEFAULT NULL, +not_id_type varchar(20) DEFAULT NULL, +not_weight_type varchar(20) DEFAULT NULL, +PRIMARY KEY (id), +KEY name (info) +) DEFAULT CHARSET=latin1; +SET GLOBAL oqgraph_allow_create_integer_latch=true; +The next warnings 1287 are expected +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE=''; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='bogus'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='Ω Ohms Tennis Ball 〄'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing', ORIGID='id'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID=''; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID=''; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='bogus'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.destid' attribute not set to a valid column of 'backing')' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='not_id_type'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Column 'backing.not_id_type' (destid) is not a not-null integer type or is a different type to origid attribute.' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus',DESTID='id'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.origid' attribute not set to a valid column of 'backing')' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type',DESTID='id'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Column 'backing.not_id_type' (origid) is not a not-null integer type' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.destid' attribute set to same column as origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='bogus'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('oqtable.weight' attribute not set to a valid column of 'backing')' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='not_weight_type'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Column 'backing.not_weight_type' (weight) is not a not-null real type' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='nullparent',DESTID='id',WEIGHT='weight'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Column 'backing.nullparent' (origid) is not a not-null integer type' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='nullparent',WEIGHT='weight'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +ERROR HY000: Got error -1 'Column 'backing.nullparent' (destid) is not a not-null integer type or is a different type to origid attribute.' from OQGRAPH +DROP TABLE IF EXISTS oqtable; +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='weight'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +DESCRIBE oqtable; +Field Type Null Key Default Extra +latch smallint(5) unsigned YES MUL NULL +origid bigint(20) unsigned YES NULL +destid bigint(20) unsigned YES NULL +weight double YES NULL +seq bigint(20) unsigned YES NULL +linkid bigint(20) unsigned YES NULL +DROP TABLE IF EXISTS oqtable; +DROP TABLE IF EXISTS backing; +DROP TABLE IF EXISTS not_backing; +SET GLOBAL oqgraph_allow_create_integer_latch=false; diff --git a/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.test b/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.test new file mode 100644 index 00000000..7fe58d3e --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/create_attr_legacy.test @@ -0,0 +1,202 @@ +--disable_warnings +DROP TABLE IF EXISTS not_backing; +DROP TABLE IF EXISTS backing; +DROP TABLE IF EXISTS oqtable; +--enable_warnings + + +CREATE TABLE `not_backing` ( + id int(10) unsigned NOT NULL DEFAULT '0', + info varchar(20) DEFAULT NULL, + KEY name (info) +) DEFAULT CHARSET=latin1; + +CREATE TABLE backing ( + id int(10) unsigned NOT NULL DEFAULT '0', + nullparent int(10) unsigned DEFAULT NULL, + parent int(10) unsigned DEFAULT 1 NOT NULL, + weight real(10,4) NOT NULL DEFAULT 0.0, + info varchar(20) DEFAULT NULL, + not_id_type varchar(20) DEFAULT NULL, + not_weight_type varchar(20) DEFAULT NULL, + PRIMARY KEY (id), + KEY name (info) +) DEFAULT CHARSET=latin1; + +# Here we enable scaffolding to let us create a deprecated table +# so we can check that the new code will still allow queries to be performed +# on a legacy database +# It should still generate a warning (1287) - but I don't know how to test for that +# +# latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future +# release. Please use 'latch VARCHAR(32) NULL' instead +# +SET GLOBAL oqgraph_allow_create_integer_latch=true; +--echo The next warnings 1287 are expected + + +# oqgraph v2 create table should fail (missing attributes) +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH; +--error 1296 +DESCRIBE oqtable; + +# attributes test +# empty table reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE=''; +--error 1296 +DESCRIBE oqtable; + +# non-existent table reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='bogus'; +--error 1296 +DESCRIBE oqtable; + +# UTF in table name, make sure it doesnt crash +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='Ω Ohms Tennis Ball 〄'; +--error 1296 +DESCRIBE oqtable; + +# Invalid backing table (backing table has no primary key) +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='not_backing', ORIGID='id'; +--error 1296 +DESCRIBE oqtable; + +# table with empty origid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID=''; +--error 1296 +DESCRIBE oqtable; + +# invalid origid reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus'; +--error 1296 +DESCRIBE oqtable; + +# wrong type origid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type'; +--error 1296 +DESCRIBE oqtable; + +# missing destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id'; +--error 1296 +DESCRIBE oqtable; + +# empty destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID=''; +--error 1296 +DESCRIBE oqtable; + +# invalid destid reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='bogus'; +--error 1296 +DESCRIBE oqtable; + +# wrong type destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='not_id_type'; +--error 1296 +DESCRIBE oqtable; + +# invalid origid with valid destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='bogus',DESTID='id'; +--error 1296 +DESCRIBE oqtable; + +# wrong type origid with valid destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='not_id_type',DESTID='id'; +--error 1296 +DESCRIBE oqtable; + +# same origid and destid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='id'; +--error 1296 +DESCRIBE oqtable; + +# invalid weight reference +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='bogus'; +--error 1296 +DESCRIBE oqtable; + +# wrong type weight +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='not_weight_type'; +--error 1296 +DESCRIBE oqtable; + +# NULLABLE ORIGID +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='nullparent',DESTID='id',WEIGHT='weight'; +--error 1296 +DESCRIBE oqtable; + +# NULLABLE DESTID +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='nullparent',WEIGHT='weight'; +--error 1296 +DESCRIBE oqtable; + +# all valid +--disable_warnings +DROP TABLE IF EXISTS oqtable; +--enable_warnings +CREATE TABLE oqtable ( latch SMALLINT UNSIGNED NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH ) ENGINE=OQGRAPH, DATA_TABLE='backing',ORIGID='id',DESTID='parent',WEIGHT='weight'; +DESCRIBE oqtable; + +# cleanup +--disable_warnings +DROP TABLE IF EXISTS oqtable; +DROP TABLE IF EXISTS backing; +DROP TABLE IF EXISTS not_backing; +--enable_warnings +SET GLOBAL oqgraph_allow_create_integer_latch=false; + diff --git a/storage/oqgraph/mysql-test/oqgraph/general-Aria.result b/storage/oqgraph/mysql-test/oqgraph/general-Aria.result new file mode 100644 index 00000000..bd0f7ed9 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/general-Aria.result @@ -0,0 +1,1593 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +Performing OQGraph General test suite for ENGINE=Aria +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE= Aria ; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +select * from graph; +latch origid destid weight seq linkid +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); +INSERT INTO graph_base(from_id, to_id) VALUES (5,7); +INSERT INTO graph_base(from_id, to_id) VALUES (9,9); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +INSERT INTO graph_base(from_id, to_id) VALUES (11,12); +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); +# Return all edges +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +# Currently count should be 13 +SELECT count(*) FROM graph; +count(*) +13 +# Return all edges when latch is NULL - this is different to latch='' and same as no where clause +SELECT * FROM graph where latch is NULL; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +# Return all vertices, and subsets of vertices +SELECT * FROM graph where latch=''; +latch origid destid weight seq linkid + NULL NULL NULL NULL 1 + NULL NULL NULL NULL 2 + NULL NULL NULL NULL 3 + NULL NULL NULL NULL 4 + NULL NULL NULL NULL 5 + NULL NULL NULL NULL 6 + NULL NULL NULL NULL 7 + NULL NULL NULL NULL 9 + NULL NULL NULL NULL 10 + NULL NULL NULL NULL 11 + NULL NULL NULL NULL 12 +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +# Currently count should be 11 +SELECT count(*) FROM graph where latch=''; +count(*) +11 +SELECT * FROM graph where latch='' and linkid = 2; +latch origid destid weight seq linkid + NULL NULL NULL NULL 2 +SELECT * FROM graph where latch='' and (linkid > 2 and linkid < 6); +latch origid destid weight seq linkid + NULL NULL NULL NULL 3 + NULL NULL NULL NULL 4 + NULL NULL NULL NULL 5 +SELECT * FROM graph where latch='' and linkid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph where latch='' and linkid = 666; +latch origid destid weight seq linkid +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 1; +from to +1 3 +1 2 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 2; +from to +2 1 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 4; +from to +4 3 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 9; +from to +9 9 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 10; +from to +10 11 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = NULL; +from to +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 666; +from to +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 1; +from to +3 1 +2 1 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 2; +from to +1 2 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 4; +from to +3 4 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 9; +from to +9 9 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 10; +from to +12 10 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = NULL; +from to +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 666; +from to +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +SELECT count(*) FROM graph where latch='0'; +count(*) +11 +SELECT * FROM graph where latch='0' and linkid = 2; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 2 +SELECT * FROM graph where latch='0' and (linkid > 2 and linkid < 6); +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 1; +from to +1 3 +1 2 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 2; +from to +2 1 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 4; +from to +4 3 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 9; +from to +9 9 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 10; +from to +10 11 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 1; +from to +3 1 +2 1 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 2; +from to +1 2 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 4; +from to +3 4 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 9; +from to +9 9 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 10; +from to +12 10 +# Leaves search tests +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 5; +latch origid destid weight seq linkid +leaves 5 NULL 1 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 6; +latch origid destid weight seq linkid +leaves 6 NULL 2 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 7; +latch origid destid weight seq linkid +leaves 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 9; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 6; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 7; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 9; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +INSERT INTO graph_base(from_id, to_id) VALUES (10,13); +INSERT INTO graph_base(from_id, to_id) VALUES (11,14); +INSERT INTO graph_base(from_id, to_id) VALUES (12,15); +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +leaves 10 NULL 3 3 15 +leaves 10 NULL 2 2 14 +leaves 10 NULL 1 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +leaves 11 NULL 3 3 13 +leaves 11 NULL 2 2 15 +leaves 11 NULL 1 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +leaves 12 NULL 3 3 14 +leaves 12 NULL 2 2 13 +leaves 12 NULL 1 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 13; +latch origid destid weight seq linkid +leaves 13 NULL 0 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 14; +latch origid destid weight seq linkid +leaves 14 NULL 0 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 15; +latch origid destid weight seq linkid +leaves 15 NULL 0 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 13; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 14; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 15; +latch origid destid weight seq linkid +DELETE FROM graph_base where from_id=10 and to_id=13; +DELETE FROM graph_base where from_id=11 and to_id=14; +DELETE FROM graph_base where from_id=12 and to_id=15; +INSERT INTO graph_base(from_id, to_id) VALUES (13,10); +INSERT INTO graph_base(from_id, to_id) VALUES (14,11); +INSERT INTO graph_base(from_id, to_id) VALUES (15,12); +INSERT INTO graph_base(from_id, to_id) VALUES (16,1); +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 13; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 14; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 15; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 16; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +leaves NULL 10 3 3 14 +leaves NULL 10 2 2 15 +leaves NULL 10 1 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +leaves NULL 11 3 3 15 +leaves NULL 11 2 2 13 +leaves NULL 11 1 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +leaves NULL 12 3 3 13 +leaves NULL 12 2 2 14 +leaves NULL 12 1 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 13; +latch origid destid weight seq linkid +leaves NULL 13 0 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 14; +latch origid destid weight seq linkid +leaves NULL 14 0 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 15; +latch origid destid weight seq linkid +leaves NULL 15 0 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 1; +latch origid destid weight seq linkid +leaves NULL 1 1 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 2; +latch origid destid weight seq linkid +leaves NULL 2 2 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 3; +latch origid destid weight seq linkid +leaves NULL 3 2 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 4; +latch origid destid weight seq linkid +leaves NULL 4 3 1 16 +DELETE FROM graph_base where from_id=13 and to_id=10; +DELETE FROM graph_base where from_id=14 and to_id=11; +DELETE FROM graph_base where from_id=15 and to_id=12; +DELETE FROM graph_base where from_id=16 and to_id=1; +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=6 AND destid=7; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +# Breadth-first search tests +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +breadth_first 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 3 4 4 +breadth_first 2 NULL 2 3 3 +breadth_first 2 NULL 1 2 1 +breadth_first 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3; +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +breadth_first 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4; +latch origid destid weight seq linkid +breadth_first 4 NULL 3 4 2 +breadth_first 4 NULL 2 3 1 +breadth_first 4 NULL 1 2 3 +breadth_first 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5; +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +breadth_first 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6; +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +breadth_first 6 NULL 1 2 5 +breadth_first 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7; +latch origid destid weight seq linkid +breadth_first 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9; +latch origid destid weight seq linkid +breadth_first 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10; +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +breadth_first 10 NULL 1 2 11 +breadth_first 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11; +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +breadth_first 11 NULL 1 2 12 +breadth_first 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12; +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +breadth_first 12 NULL 1 2 10 +breadth_first 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 12 NULL 1 2 10 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +count(*) +1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 2 3 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 4 NULL 2 3 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 3; +latch origid destid weight seq linkid +breadth_first 2 NULL 3 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 3; +latch origid destid weight seq linkid +breadth_first 4 NULL 3 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 2 NULL 2 3 3 +breadth_first 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 4 NULL 2 3 1 +breadth_first 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +breadth_first 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +breadth_first 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +breadth_first 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +breadth_first 12 NULL 1 2 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 2 4 4 +breadth_first NULL 1 1 3 3 +breadth_first NULL 1 1 2 2 +breadth_first NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 3 4 4 +breadth_first NULL 2 2 3 3 +breadth_first NULL 2 1 2 1 +breadth_first NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3; +latch origid destid weight seq linkid +breadth_first NULL 3 2 4 2 +breadth_first NULL 3 1 3 4 +breadth_first NULL 3 1 2 1 +breadth_first NULL 3 0 1 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4; +latch origid destid weight seq linkid +breadth_first NULL 4 3 4 2 +breadth_first NULL 4 2 3 1 +breadth_first NULL 4 1 2 3 +breadth_first NULL 4 0 1 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; +latch origid destid weight seq linkid +breadth_first NULL 5 1 2 6 +breadth_first NULL 5 0 1 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; +latch origid destid weight seq linkid +breadth_first NULL 6 1 2 5 +breadth_first NULL 6 0 1 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; +latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +breadth_first NULL 7 1 2 5 +breadth_first NULL 7 0 1 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9; +latch origid destid weight seq linkid +breadth_first NULL 9 0 1 9 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; +latch origid destid weight seq linkid +breadth_first NULL 10 2 3 11 +breadth_first NULL 10 1 2 12 +breadth_first NULL 10 0 1 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; +latch origid destid weight seq linkid +breadth_first NULL 11 2 3 12 +breadth_first NULL 11 1 2 10 +breadth_first NULL 11 0 1 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; +latch origid destid weight seq linkid +breadth_first NULL 12 2 3 10 +breadth_first NULL 12 1 2 11 +breadth_first NULL 12 0 1 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 1 3 3 +breadth_first NULL 1 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 2 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 3 1 3 4 +breadth_first NULL 3 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 4 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 5 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 6 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 7 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 10 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 11 1 2 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 12 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 1 2 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 2 3 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 3 2 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 4 2 3 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 10 2 3 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 11 2 3 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 12 2 3 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; +latch origid destid weight seq linkid +breadth_first NULL 2 3 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 3; +latch origid destid weight seq linkid +breadth_first NULL 4 3 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first'; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +2 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 2; +latch origid destid weight seq linkid +2 2 NULL 3 4 4 +2 2 NULL 2 3 3 +2 2 NULL 1 2 1 +2 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 3; +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +2 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 4; +latch origid destid weight seq linkid +2 4 NULL 3 4 2 +2 4 NULL 2 3 1 +2 4 NULL 1 2 3 +2 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 5; +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +2 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 6; +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +2 6 NULL 1 2 5 +2 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 7; +latch origid destid weight seq linkid +2 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = '2' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9; +latch origid destid weight seq linkid +2 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch = '2' AND origid = 10; +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +2 10 NULL 1 2 11 +2 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch = '2' AND origid = 11; +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +2 11 NULL 1 2 12 +2 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 12; +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +2 12 NULL 1 2 10 +2 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +latch origid destid weight seq linkid +2 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +latch origid destid weight seq linkid +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +latch origid destid weight seq linkid +2 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +latch origid destid weight seq linkid +2 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +latch origid destid weight seq linkid +2 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +latch origid destid weight seq linkid +2 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +latch origid destid weight seq linkid +2 12 NULL 1 2 10 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +count(*) +1 +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 2; +latch origid destid weight seq linkid +2 2 NULL 2 3 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 2; +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 2; +latch origid destid weight seq linkid +2 4 NULL 2 3 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 2; +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 2; +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 2; +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 2; +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 3; +latch origid destid weight seq linkid +2 2 NULL 3 4 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 3; +latch origid destid weight seq linkid +2 4 NULL 3 4 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 2 NULL 2 3 3 +2 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 4 NULL 2 3 1 +2 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +2 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +2 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +2 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +2 12 NULL 1 2 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 1; +latch origid destid weight seq linkid +2 NULL 1 2 4 4 +2 NULL 1 1 3 3 +2 NULL 1 1 2 2 +2 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 2; +latch origid destid weight seq linkid +2 NULL 2 3 4 4 +2 NULL 2 2 3 3 +2 NULL 2 1 2 1 +2 NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 3; +latch origid destid weight seq linkid +2 NULL 3 2 4 2 +2 NULL 3 1 3 4 +2 NULL 3 1 2 1 +2 NULL 3 0 1 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 4; +latch origid destid weight seq linkid +2 NULL 4 3 4 2 +2 NULL 4 2 3 1 +2 NULL 4 1 2 3 +2 NULL 4 0 1 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 5; +latch origid destid weight seq linkid +2 NULL 5 1 2 6 +2 NULL 5 0 1 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 6; +latch origid destid weight seq linkid +2 NULL 6 1 2 5 +2 NULL 6 0 1 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 7; +latch origid destid weight seq linkid +2 NULL 7 2 3 6 +2 NULL 7 1 2 5 +2 NULL 7 0 1 7 +SELECT * FROM graph WHERE latch = '2' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9; +latch origid destid weight seq linkid +2 NULL 9 0 1 9 +SELECT * FROM graph WHERE latch = '2' AND destid = 10; +latch origid destid weight seq linkid +2 NULL 10 2 3 11 +2 NULL 10 1 2 12 +2 NULL 10 0 1 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 11; +latch origid destid weight seq linkid +2 NULL 11 2 3 12 +2 NULL 11 1 2 10 +2 NULL 11 0 1 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 12; +latch origid destid weight seq linkid +2 NULL 12 2 3 10 +2 NULL 12 1 2 11 +2 NULL 12 0 1 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; +latch origid destid weight seq linkid +2 NULL 1 1 3 3 +2 NULL 1 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 1; +latch origid destid weight seq linkid +2 NULL 2 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 1; +latch origid destid weight seq linkid +2 NULL 3 1 3 4 +2 NULL 3 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 1; +latch origid destid weight seq linkid +2 NULL 4 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1; +latch origid destid weight seq linkid +2 NULL 5 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1; +latch origid destid weight seq linkid +2 NULL 6 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1; +latch origid destid weight seq linkid +2 NULL 7 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1; +latch origid destid weight seq linkid +2 NULL 10 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1; +latch origid destid weight seq linkid +2 NULL 11 1 2 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1; +latch origid destid weight seq linkid +2 NULL 12 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2; +latch origid destid weight seq linkid +2 NULL 1 2 4 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 2; +latch origid destid weight seq linkid +2 NULL 2 2 3 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 2; +latch origid destid weight seq linkid +2 NULL 3 2 4 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 2; +latch origid destid weight seq linkid +2 NULL 4 2 3 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2; +latch origid destid weight seq linkid +2 NULL 7 2 3 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2; +latch origid destid weight seq linkid +2 NULL 10 2 3 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2; +latch origid destid weight seq linkid +2 NULL 11 2 3 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2; +latch origid destid weight seq linkid +2 NULL 12 2 3 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3; +latch origid destid weight seq linkid +2 NULL 2 3 4 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 3; +latch origid destid weight seq linkid +2 NULL 4 3 4 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2'; +latch origid destid weight seq linkid +# Dijkstras algorithm tests +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=1; +latch origid destid weight seq linkid +dijkstras 1 1 NULL 0 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +dijkstras 1 2 NULL 0 1 +dijkstras 1 2 1 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2 AND destid=1; +latch origid destid weight seq linkid +dijkstras 2 1 NULL 0 2 +dijkstras 2 1 1 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +dijkstras 1 4 NULL 0 1 +dijkstras 1 4 1 1 3 +dijkstras 1 4 1 2 4 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4 AND destid=1; +latch origid destid weight seq linkid +dijkstras 4 1 NULL 0 4 +dijkstras 4 1 1 1 3 +dijkstras 4 1 1 2 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5 AND destid=7; +latch origid destid weight seq linkid +dijkstras 5 7 NULL 0 5 +dijkstras 5 7 1 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +dijkstras 10 11 NULL 0 10 +dijkstras 10 11 1 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +dijkstras 10 12 NULL 0 10 +dijkstras 10 12 1 1 11 +dijkstras 10 12 1 2 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=10; +latch origid destid weight seq linkid +dijkstras 11 10 NULL 0 11 +dijkstras 11 10 1 1 12 +dijkstras 11 10 1 2 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=12; +latch origid destid weight seq linkid +dijkstras 11 12 NULL 0 11 +dijkstras 11 12 1 1 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=10; +latch origid destid weight seq linkid +dijkstras 12 10 NULL 0 12 +dijkstras 12 10 1 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=11; +latch origid destid weight seq linkid +dijkstras 12 11 NULL 0 12 +dijkstras 12 11 1 1 10 +dijkstras 12 11 1 2 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2; +latch origid destid weight seq linkid +dijkstras 2 NULL 3 4 4 +dijkstras 2 NULL 2 3 3 +dijkstras 2 NULL 1 2 1 +dijkstras 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=3; +latch origid destid weight seq linkid +dijkstras 3 NULL 2 4 2 +dijkstras 3 NULL 1 3 4 +dijkstras 3 NULL 1 2 1 +dijkstras 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4; +latch origid destid weight seq linkid +dijkstras 4 NULL 3 4 2 +dijkstras 4 NULL 2 3 1 +dijkstras 4 NULL 1 2 3 +dijkstras 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5; +latch origid destid weight seq linkid +dijkstras 5 NULL 1 3 7 +dijkstras 5 NULL 1 2 6 +dijkstras 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6; +latch origid destid weight seq linkid +dijkstras 6 NULL 2 3 7 +dijkstras 6 NULL 1 2 5 +dijkstras 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7; +latch origid destid weight seq linkid +dijkstras 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=9; +latch origid destid weight seq linkid +dijkstras 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10; +latch origid destid weight seq linkid +dijkstras 10 NULL 2 3 12 +dijkstras 10 NULL 1 2 11 +dijkstras 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11; +latch origid destid weight seq linkid +dijkstras 11 NULL 2 3 10 +dijkstras 11 NULL 1 2 12 +dijkstras 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12; +latch origid destid weight seq linkid +dijkstras 12 NULL 2 3 11 +dijkstras 12 NULL 1 2 10 +dijkstras 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +latch origid destid weight seq linkid +dijkstras NULL 1 2 4 4 +dijkstras NULL 1 1 3 3 +dijkstras NULL 1 1 2 2 +dijkstras NULL 1 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=2; +latch origid destid weight seq linkid +dijkstras NULL 2 3 4 4 +dijkstras NULL 2 2 3 3 +dijkstras NULL 2 1 2 1 +dijkstras NULL 2 0 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=3; +latch origid destid weight seq linkid +dijkstras NULL 3 2 4 2 +dijkstras NULL 3 1 3 4 +dijkstras NULL 3 1 2 1 +dijkstras NULL 3 0 1 3 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=4; +latch origid destid weight seq linkid +dijkstras NULL 4 3 4 2 +dijkstras NULL 4 2 3 1 +dijkstras NULL 4 1 2 3 +dijkstras NULL 4 0 1 4 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; +latch origid destid weight seq linkid +dijkstras NULL 5 1 2 6 +dijkstras NULL 5 0 1 5 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; +latch origid destid weight seq linkid +dijkstras NULL 6 1 2 5 +dijkstras NULL 6 0 1 6 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; +latch origid destid weight seq linkid +dijkstras NULL 7 2 3 6 +dijkstras NULL 7 1 2 5 +dijkstras NULL 7 0 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND destid=9; +latch origid destid weight seq linkid +dijkstras NULL 9 0 1 9 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; +latch origid destid weight seq linkid +dijkstras NULL 10 2 3 11 +dijkstras NULL 10 1 2 12 +dijkstras NULL 10 0 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; +latch origid destid weight seq linkid +dijkstras NULL 11 2 3 12 +dijkstras NULL 11 1 2 10 +dijkstras NULL 11 0 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; +latch origid destid weight seq linkid +dijkstras NULL 12 2 3 10 +dijkstras NULL 12 1 2 11 +dijkstras NULL 12 0 1 12 +# legacy string number +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; +latch origid destid weight seq linkid +1 1 1 NULL 0 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +1 1 2 NULL 0 1 +1 1 2 1 1 2 +SELECT * FROM graph WHERE latch='1' AND origid=2 AND destid=1; +latch origid destid weight seq linkid +1 2 1 NULL 0 2 +1 2 1 1 1 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +1 1 4 NULL 0 1 +1 1 4 1 1 3 +1 1 4 1 2 4 +SELECT * FROM graph WHERE latch='1' AND origid=4 AND destid=1; +latch origid destid weight seq linkid +1 4 1 NULL 0 4 +1 4 1 1 1 3 +1 4 1 1 2 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=5 AND destid=7; +latch origid destid weight seq linkid +1 5 7 NULL 0 5 +1 5 7 1 1 7 +SELECT * FROM graph WHERE latch='1' AND origid=7 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +1 10 11 NULL 0 10 +1 10 11 1 1 11 +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +1 10 12 NULL 0 10 +1 10 12 1 1 11 +1 10 12 1 2 12 +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=10; +latch origid destid weight seq linkid +1 11 10 NULL 0 11 +1 11 10 1 1 12 +1 11 10 1 2 10 +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=12; +latch origid destid weight seq linkid +1 11 12 NULL 0 11 +1 11 12 1 1 12 +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=10; +latch origid destid weight seq linkid +1 12 10 NULL 0 12 +1 12 10 1 1 10 +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=11; +latch origid destid weight seq linkid +1 12 11 NULL 0 12 +1 12 11 1 1 10 +1 12 11 1 2 11 +SELECT * FROM graph WHERE latch='1' AND origid=1; +latch origid destid weight seq linkid +1 1 NULL 2 4 4 +1 1 NULL 1 3 3 +1 1 NULL 1 2 2 +1 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='1' AND origid=2; +latch origid destid weight seq linkid +1 2 NULL 3 4 4 +1 2 NULL 2 3 3 +1 2 NULL 1 2 1 +1 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch='1' AND origid=3; +latch origid destid weight seq linkid +1 3 NULL 2 4 2 +1 3 NULL 1 3 4 +1 3 NULL 1 2 1 +1 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch='1' AND origid=4; +latch origid destid weight seq linkid +1 4 NULL 3 4 2 +1 4 NULL 2 3 1 +1 4 NULL 1 2 3 +1 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch='1' AND origid=5; +latch origid destid weight seq linkid +1 5 NULL 1 3 7 +1 5 NULL 1 2 6 +1 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch='1' AND origid=6; +latch origid destid weight seq linkid +1 6 NULL 2 3 7 +1 6 NULL 1 2 5 +1 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch='1' AND origid=7; +latch origid destid weight seq linkid +1 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch='1' AND origid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=9; +latch origid destid weight seq linkid +1 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch='1' AND origid=10; +latch origid destid weight seq linkid +1 10 NULL 2 3 12 +1 10 NULL 1 2 11 +1 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch='1' AND origid=11; +latch origid destid weight seq linkid +1 11 NULL 2 3 10 +1 11 NULL 1 2 12 +1 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch='1' AND origid=12; +latch origid destid weight seq linkid +1 12 NULL 2 3 11 +1 12 NULL 1 2 10 +1 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch='1' AND origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND destid=1; +latch origid destid weight seq linkid +1 NULL 1 2 4 4 +1 NULL 1 1 3 3 +1 NULL 1 1 2 2 +1 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch='1' AND destid=2; +latch origid destid weight seq linkid +1 NULL 2 3 4 4 +1 NULL 2 2 3 3 +1 NULL 2 1 2 1 +1 NULL 2 0 1 2 +SELECT * FROM graph WHERE latch='1' AND destid=3; +latch origid destid weight seq linkid +1 NULL 3 2 4 2 +1 NULL 3 1 3 4 +1 NULL 3 1 2 1 +1 NULL 3 0 1 3 +SELECT * FROM graph WHERE latch='1' AND destid=4; +latch origid destid weight seq linkid +1 NULL 4 3 4 2 +1 NULL 4 2 3 1 +1 NULL 4 1 2 3 +1 NULL 4 0 1 4 +SELECT * FROM graph WHERE latch='1' AND destid=5; +latch origid destid weight seq linkid +1 NULL 5 1 2 6 +1 NULL 5 0 1 5 +SELECT * FROM graph WHERE latch='1' AND destid=6; +latch origid destid weight seq linkid +1 NULL 6 1 2 5 +1 NULL 6 0 1 6 +SELECT * FROM graph WHERE latch='1' AND destid=7; +latch origid destid weight seq linkid +1 NULL 7 2 3 6 +1 NULL 7 1 2 5 +1 NULL 7 0 1 7 +SELECT * FROM graph WHERE latch='1' AND destid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND destid=9; +latch origid destid weight seq linkid +1 NULL 9 0 1 9 +SELECT * FROM graph WHERE latch='1' AND destid=10; +latch origid destid weight seq linkid +1 NULL 10 2 3 11 +1 NULL 10 1 2 12 +1 NULL 10 0 1 10 +SELECT * FROM graph WHERE latch='1' AND destid=11; +latch origid destid weight seq linkid +1 NULL 11 2 3 12 +1 NULL 11 1 2 10 +1 NULL 11 0 1 11 +SELECT * FROM graph WHERE latch='1' AND destid=12; +latch origid destid weight seq linkid +1 NULL 12 2 3 10 +1 NULL 12 1 2 11 +1 NULL 12 0 1 12 +INSERT INTO graph_base(from_id, to_id) VALUES (11,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,14); +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 11 +dijkstras 10 13 1 2 13 +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 14 +dijkstras 10 13 1 2 13 +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 11 +dijkstras 10 13 1 2 13 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=21; +latch origid destid weight seq linkid +dijkstras 21 NULL 1 2 22 +dijkstras 21 NULL 0 1 21 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=22; +latch origid destid weight seq linkid +dijkstras 22 NULL 0 1 22 +INSERT INTO graph_base(from_id, to_id) VALUES (4,17); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 3 5 17 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (4,16); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 3 6 17 +dijkstras 1 NULL 3 5 16 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (17,18); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 4 7 18 +dijkstras 1 NULL 3 6 17 +dijkstras 1 NULL 3 5 16 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +latch origid destid weight seq linkid +dijkstras NULL 1 2 4 4 +dijkstras NULL 1 1 3 3 +dijkstras NULL 1 1 2 2 +dijkstras NULL 1 0 1 1 +# Now we add a connection from 4->6 +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); +# And delete all references to node 5 +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; +# which means there is a path in one direction only 1>3>4>6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +dijkstras 1 6 NULL 0 1 +dijkstras 1 6 1 1 3 +dijkstras 1 6 1 2 4 +dijkstras 1 6 1 3 6 +# but not 6>4>3>1 (so no result) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6 AND destid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +1 1 6 NULL 0 1 +1 1 6 1 1 3 +1 1 6 1 2 4 +1 1 6 1 3 6 +SELECT * FROM graph WHERE latch='1' AND origid=6 AND destid=1; +latch origid destid weight seq linkid +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/general-Aria.test b/storage/oqgraph/mysql-test/oqgraph/general-Aria.test new file mode 100644 index 00000000..f2a0146f --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/general-Aria.test @@ -0,0 +1,3 @@ +# This is a maintainer generated file. Generated at Wednesday 5 February 22:26:12 CST 2014. +--let $oqgraph_use_table_type= Aria +--source general.inc diff --git a/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result b/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result new file mode 100644 index 00000000..e5b5e958 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.result @@ -0,0 +1,1593 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +Performing OQGraph General test suite for ENGINE=MyISAM +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE= MyISAM ; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +select * from graph; +latch origid destid weight seq linkid +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); +INSERT INTO graph_base(from_id, to_id) VALUES (5,7); +INSERT INTO graph_base(from_id, to_id) VALUES (9,9); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +INSERT INTO graph_base(from_id, to_id) VALUES (11,12); +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); +# Return all edges +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +# Currently count should be 13 +SELECT count(*) FROM graph; +count(*) +13 +# Return all edges when latch is NULL - this is different to latch='' and same as no where clause +SELECT * FROM graph where latch is NULL; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +# Return all vertices, and subsets of vertices +SELECT * FROM graph where latch=''; +latch origid destid weight seq linkid + NULL NULL NULL NULL 1 + NULL NULL NULL NULL 2 + NULL NULL NULL NULL 3 + NULL NULL NULL NULL 4 + NULL NULL NULL NULL 5 + NULL NULL NULL NULL 6 + NULL NULL NULL NULL 7 + NULL NULL NULL NULL 9 + NULL NULL NULL NULL 10 + NULL NULL NULL NULL 11 + NULL NULL NULL NULL 12 +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +# Currently count should be 11 +SELECT count(*) FROM graph where latch=''; +count(*) +11 +SELECT * FROM graph where latch='' and linkid = 2; +latch origid destid weight seq linkid + NULL NULL NULL NULL 2 +SELECT * FROM graph where latch='' and (linkid > 2 and linkid < 6); +latch origid destid weight seq linkid + NULL NULL NULL NULL 3 + NULL NULL NULL NULL 4 + NULL NULL NULL NULL 5 +SELECT * FROM graph where latch='' and linkid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph where latch='' and linkid = 666; +latch origid destid weight seq linkid +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 1; +from to +1 3 +1 2 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 2; +from to +2 1 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 4; +from to +4 3 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 9; +from to +9 9 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 10; +from to +10 11 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = NULL; +from to +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 666; +from to +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 1; +from to +3 1 +2 1 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 2; +from to +1 2 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 4; +from to +3 4 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 9; +from to +9 9 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 10; +from to +12 10 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = NULL; +from to +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 666; +from to +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +SELECT count(*) FROM graph where latch='0'; +count(*) +11 +SELECT * FROM graph where latch='0' and linkid = 2; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 2 +SELECT * FROM graph where latch='0' and (linkid > 2 and linkid < 6); +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 1; +from to +1 3 +1 2 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 2; +from to +2 1 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 4; +from to +4 3 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 9; +from to +9 9 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 10; +from to +10 11 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 1; +from to +3 1 +2 1 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 2; +from to +1 2 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 4; +from to +3 4 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 9; +from to +9 9 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 10; +from to +12 10 +# Leaves search tests +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 5; +latch origid destid weight seq linkid +leaves 5 NULL 1 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 6; +latch origid destid weight seq linkid +leaves 6 NULL 2 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 7; +latch origid destid weight seq linkid +leaves 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 9; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 6; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 7; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 9; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +INSERT INTO graph_base(from_id, to_id) VALUES (10,13); +INSERT INTO graph_base(from_id, to_id) VALUES (11,14); +INSERT INTO graph_base(from_id, to_id) VALUES (12,15); +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +leaves 10 NULL 3 3 15 +leaves 10 NULL 2 2 14 +leaves 10 NULL 1 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +leaves 11 NULL 3 3 13 +leaves 11 NULL 2 2 15 +leaves 11 NULL 1 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +leaves 12 NULL 3 3 14 +leaves 12 NULL 2 2 13 +leaves 12 NULL 1 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 13; +latch origid destid weight seq linkid +leaves 13 NULL 0 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 14; +latch origid destid weight seq linkid +leaves 14 NULL 0 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 15; +latch origid destid weight seq linkid +leaves 15 NULL 0 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 13; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 14; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 15; +latch origid destid weight seq linkid +DELETE FROM graph_base where from_id=10 and to_id=13; +DELETE FROM graph_base where from_id=11 and to_id=14; +DELETE FROM graph_base where from_id=12 and to_id=15; +INSERT INTO graph_base(from_id, to_id) VALUES (13,10); +INSERT INTO graph_base(from_id, to_id) VALUES (14,11); +INSERT INTO graph_base(from_id, to_id) VALUES (15,12); +INSERT INTO graph_base(from_id, to_id) VALUES (16,1); +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 13; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 14; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 15; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 16; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +leaves NULL 10 3 3 14 +leaves NULL 10 2 2 15 +leaves NULL 10 1 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +leaves NULL 11 3 3 15 +leaves NULL 11 2 2 13 +leaves NULL 11 1 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +leaves NULL 12 3 3 13 +leaves NULL 12 2 2 14 +leaves NULL 12 1 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 13; +latch origid destid weight seq linkid +leaves NULL 13 0 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 14; +latch origid destid weight seq linkid +leaves NULL 14 0 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 15; +latch origid destid weight seq linkid +leaves NULL 15 0 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 1; +latch origid destid weight seq linkid +leaves NULL 1 1 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 2; +latch origid destid weight seq linkid +leaves NULL 2 2 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 3; +latch origid destid weight seq linkid +leaves NULL 3 2 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 4; +latch origid destid weight seq linkid +leaves NULL 4 3 1 16 +DELETE FROM graph_base where from_id=13 and to_id=10; +DELETE FROM graph_base where from_id=14 and to_id=11; +DELETE FROM graph_base where from_id=15 and to_id=12; +DELETE FROM graph_base where from_id=16 and to_id=1; +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=6 AND destid=7; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +# Breadth-first search tests +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +breadth_first 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 3 4 4 +breadth_first 2 NULL 2 3 3 +breadth_first 2 NULL 1 2 1 +breadth_first 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3; +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +breadth_first 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4; +latch origid destid weight seq linkid +breadth_first 4 NULL 3 4 2 +breadth_first 4 NULL 2 3 1 +breadth_first 4 NULL 1 2 3 +breadth_first 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5; +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +breadth_first 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6; +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +breadth_first 6 NULL 1 2 5 +breadth_first 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7; +latch origid destid weight seq linkid +breadth_first 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9; +latch origid destid weight seq linkid +breadth_first 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10; +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +breadth_first 10 NULL 1 2 11 +breadth_first 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11; +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +breadth_first 11 NULL 1 2 12 +breadth_first 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12; +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +breadth_first 12 NULL 1 2 10 +breadth_first 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 12 NULL 1 2 10 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +count(*) +1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 2 3 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 4 NULL 2 3 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 3; +latch origid destid weight seq linkid +breadth_first 2 NULL 3 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 3; +latch origid destid weight seq linkid +breadth_first 4 NULL 3 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 2 NULL 2 3 3 +breadth_first 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 4 NULL 2 3 1 +breadth_first 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +breadth_first 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +breadth_first 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +breadth_first 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +breadth_first 12 NULL 1 2 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 2 4 4 +breadth_first NULL 1 1 3 3 +breadth_first NULL 1 1 2 2 +breadth_first NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 3 4 4 +breadth_first NULL 2 2 3 3 +breadth_first NULL 2 1 2 1 +breadth_first NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3; +latch origid destid weight seq linkid +breadth_first NULL 3 2 4 2 +breadth_first NULL 3 1 3 4 +breadth_first NULL 3 1 2 1 +breadth_first NULL 3 0 1 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4; +latch origid destid weight seq linkid +breadth_first NULL 4 3 4 2 +breadth_first NULL 4 2 3 1 +breadth_first NULL 4 1 2 3 +breadth_first NULL 4 0 1 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; +latch origid destid weight seq linkid +breadth_first NULL 5 1 2 6 +breadth_first NULL 5 0 1 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; +latch origid destid weight seq linkid +breadth_first NULL 6 1 2 5 +breadth_first NULL 6 0 1 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; +latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +breadth_first NULL 7 1 2 5 +breadth_first NULL 7 0 1 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9; +latch origid destid weight seq linkid +breadth_first NULL 9 0 1 9 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; +latch origid destid weight seq linkid +breadth_first NULL 10 2 3 11 +breadth_first NULL 10 1 2 12 +breadth_first NULL 10 0 1 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; +latch origid destid weight seq linkid +breadth_first NULL 11 2 3 12 +breadth_first NULL 11 1 2 10 +breadth_first NULL 11 0 1 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; +latch origid destid weight seq linkid +breadth_first NULL 12 2 3 10 +breadth_first NULL 12 1 2 11 +breadth_first NULL 12 0 1 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 1 3 3 +breadth_first NULL 1 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 2 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 3 1 3 4 +breadth_first NULL 3 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 4 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 5 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 6 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 7 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 10 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 11 1 2 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 12 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 1 2 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 2 3 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 3 2 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 4 2 3 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 10 2 3 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 11 2 3 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 12 2 3 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; +latch origid destid weight seq linkid +breadth_first NULL 2 3 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 3; +latch origid destid weight seq linkid +breadth_first NULL 4 3 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first'; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +2 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 2; +latch origid destid weight seq linkid +2 2 NULL 3 4 4 +2 2 NULL 2 3 3 +2 2 NULL 1 2 1 +2 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 3; +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +2 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 4; +latch origid destid weight seq linkid +2 4 NULL 3 4 2 +2 4 NULL 2 3 1 +2 4 NULL 1 2 3 +2 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 5; +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +2 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 6; +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +2 6 NULL 1 2 5 +2 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 7; +latch origid destid weight seq linkid +2 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = '2' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9; +latch origid destid weight seq linkid +2 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch = '2' AND origid = 10; +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +2 10 NULL 1 2 11 +2 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch = '2' AND origid = 11; +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +2 11 NULL 1 2 12 +2 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 12; +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +2 12 NULL 1 2 10 +2 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +latch origid destid weight seq linkid +2 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +latch origid destid weight seq linkid +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +latch origid destid weight seq linkid +2 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +latch origid destid weight seq linkid +2 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +latch origid destid weight seq linkid +2 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +latch origid destid weight seq linkid +2 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +latch origid destid weight seq linkid +2 12 NULL 1 2 10 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +count(*) +1 +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 2; +latch origid destid weight seq linkid +2 2 NULL 2 3 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 2; +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 2; +latch origid destid weight seq linkid +2 4 NULL 2 3 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 2; +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 2; +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 2; +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 2; +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 3; +latch origid destid weight seq linkid +2 2 NULL 3 4 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 3; +latch origid destid weight seq linkid +2 4 NULL 3 4 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 2 NULL 2 3 3 +2 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 4 NULL 2 3 1 +2 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +2 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +2 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +2 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +2 12 NULL 1 2 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 1; +latch origid destid weight seq linkid +2 NULL 1 2 4 4 +2 NULL 1 1 3 3 +2 NULL 1 1 2 2 +2 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 2; +latch origid destid weight seq linkid +2 NULL 2 3 4 4 +2 NULL 2 2 3 3 +2 NULL 2 1 2 1 +2 NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 3; +latch origid destid weight seq linkid +2 NULL 3 2 4 2 +2 NULL 3 1 3 4 +2 NULL 3 1 2 1 +2 NULL 3 0 1 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 4; +latch origid destid weight seq linkid +2 NULL 4 3 4 2 +2 NULL 4 2 3 1 +2 NULL 4 1 2 3 +2 NULL 4 0 1 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 5; +latch origid destid weight seq linkid +2 NULL 5 1 2 6 +2 NULL 5 0 1 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 6; +latch origid destid weight seq linkid +2 NULL 6 1 2 5 +2 NULL 6 0 1 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 7; +latch origid destid weight seq linkid +2 NULL 7 2 3 6 +2 NULL 7 1 2 5 +2 NULL 7 0 1 7 +SELECT * FROM graph WHERE latch = '2' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9; +latch origid destid weight seq linkid +2 NULL 9 0 1 9 +SELECT * FROM graph WHERE latch = '2' AND destid = 10; +latch origid destid weight seq linkid +2 NULL 10 2 3 11 +2 NULL 10 1 2 12 +2 NULL 10 0 1 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 11; +latch origid destid weight seq linkid +2 NULL 11 2 3 12 +2 NULL 11 1 2 10 +2 NULL 11 0 1 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 12; +latch origid destid weight seq linkid +2 NULL 12 2 3 10 +2 NULL 12 1 2 11 +2 NULL 12 0 1 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; +latch origid destid weight seq linkid +2 NULL 1 1 3 3 +2 NULL 1 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 1; +latch origid destid weight seq linkid +2 NULL 2 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 1; +latch origid destid weight seq linkid +2 NULL 3 1 3 4 +2 NULL 3 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 1; +latch origid destid weight seq linkid +2 NULL 4 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1; +latch origid destid weight seq linkid +2 NULL 5 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1; +latch origid destid weight seq linkid +2 NULL 6 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1; +latch origid destid weight seq linkid +2 NULL 7 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1; +latch origid destid weight seq linkid +2 NULL 10 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1; +latch origid destid weight seq linkid +2 NULL 11 1 2 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1; +latch origid destid weight seq linkid +2 NULL 12 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2; +latch origid destid weight seq linkid +2 NULL 1 2 4 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 2; +latch origid destid weight seq linkid +2 NULL 2 2 3 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 2; +latch origid destid weight seq linkid +2 NULL 3 2 4 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 2; +latch origid destid weight seq linkid +2 NULL 4 2 3 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2; +latch origid destid weight seq linkid +2 NULL 7 2 3 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2; +latch origid destid weight seq linkid +2 NULL 10 2 3 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2; +latch origid destid weight seq linkid +2 NULL 11 2 3 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2; +latch origid destid weight seq linkid +2 NULL 12 2 3 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3; +latch origid destid weight seq linkid +2 NULL 2 3 4 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 3; +latch origid destid weight seq linkid +2 NULL 4 3 4 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2'; +latch origid destid weight seq linkid +# Dijkstras algorithm tests +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=1; +latch origid destid weight seq linkid +dijkstras 1 1 NULL 0 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +dijkstras 1 2 NULL 0 1 +dijkstras 1 2 1 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2 AND destid=1; +latch origid destid weight seq linkid +dijkstras 2 1 NULL 0 2 +dijkstras 2 1 1 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +dijkstras 1 4 NULL 0 1 +dijkstras 1 4 1 1 3 +dijkstras 1 4 1 2 4 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4 AND destid=1; +latch origid destid weight seq linkid +dijkstras 4 1 NULL 0 4 +dijkstras 4 1 1 1 3 +dijkstras 4 1 1 2 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5 AND destid=7; +latch origid destid weight seq linkid +dijkstras 5 7 NULL 0 5 +dijkstras 5 7 1 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +dijkstras 10 11 NULL 0 10 +dijkstras 10 11 1 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +dijkstras 10 12 NULL 0 10 +dijkstras 10 12 1 1 11 +dijkstras 10 12 1 2 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=10; +latch origid destid weight seq linkid +dijkstras 11 10 NULL 0 11 +dijkstras 11 10 1 1 12 +dijkstras 11 10 1 2 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=12; +latch origid destid weight seq linkid +dijkstras 11 12 NULL 0 11 +dijkstras 11 12 1 1 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=10; +latch origid destid weight seq linkid +dijkstras 12 10 NULL 0 12 +dijkstras 12 10 1 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=11; +latch origid destid weight seq linkid +dijkstras 12 11 NULL 0 12 +dijkstras 12 11 1 1 10 +dijkstras 12 11 1 2 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2; +latch origid destid weight seq linkid +dijkstras 2 NULL 3 4 4 +dijkstras 2 NULL 2 3 3 +dijkstras 2 NULL 1 2 1 +dijkstras 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=3; +latch origid destid weight seq linkid +dijkstras 3 NULL 2 4 2 +dijkstras 3 NULL 1 3 4 +dijkstras 3 NULL 1 2 1 +dijkstras 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4; +latch origid destid weight seq linkid +dijkstras 4 NULL 3 4 2 +dijkstras 4 NULL 2 3 1 +dijkstras 4 NULL 1 2 3 +dijkstras 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5; +latch origid destid weight seq linkid +dijkstras 5 NULL 1 3 7 +dijkstras 5 NULL 1 2 6 +dijkstras 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6; +latch origid destid weight seq linkid +dijkstras 6 NULL 2 3 7 +dijkstras 6 NULL 1 2 5 +dijkstras 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7; +latch origid destid weight seq linkid +dijkstras 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=9; +latch origid destid weight seq linkid +dijkstras 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10; +latch origid destid weight seq linkid +dijkstras 10 NULL 2 3 12 +dijkstras 10 NULL 1 2 11 +dijkstras 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11; +latch origid destid weight seq linkid +dijkstras 11 NULL 2 3 10 +dijkstras 11 NULL 1 2 12 +dijkstras 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12; +latch origid destid weight seq linkid +dijkstras 12 NULL 2 3 11 +dijkstras 12 NULL 1 2 10 +dijkstras 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +latch origid destid weight seq linkid +dijkstras NULL 1 2 4 4 +dijkstras NULL 1 1 3 3 +dijkstras NULL 1 1 2 2 +dijkstras NULL 1 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=2; +latch origid destid weight seq linkid +dijkstras NULL 2 3 4 4 +dijkstras NULL 2 2 3 3 +dijkstras NULL 2 1 2 1 +dijkstras NULL 2 0 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=3; +latch origid destid weight seq linkid +dijkstras NULL 3 2 4 2 +dijkstras NULL 3 1 3 4 +dijkstras NULL 3 1 2 1 +dijkstras NULL 3 0 1 3 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=4; +latch origid destid weight seq linkid +dijkstras NULL 4 3 4 2 +dijkstras NULL 4 2 3 1 +dijkstras NULL 4 1 2 3 +dijkstras NULL 4 0 1 4 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; +latch origid destid weight seq linkid +dijkstras NULL 5 1 2 6 +dijkstras NULL 5 0 1 5 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; +latch origid destid weight seq linkid +dijkstras NULL 6 1 2 5 +dijkstras NULL 6 0 1 6 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; +latch origid destid weight seq linkid +dijkstras NULL 7 2 3 6 +dijkstras NULL 7 1 2 5 +dijkstras NULL 7 0 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND destid=9; +latch origid destid weight seq linkid +dijkstras NULL 9 0 1 9 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; +latch origid destid weight seq linkid +dijkstras NULL 10 2 3 11 +dijkstras NULL 10 1 2 12 +dijkstras NULL 10 0 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; +latch origid destid weight seq linkid +dijkstras NULL 11 2 3 12 +dijkstras NULL 11 1 2 10 +dijkstras NULL 11 0 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; +latch origid destid weight seq linkid +dijkstras NULL 12 2 3 10 +dijkstras NULL 12 1 2 11 +dijkstras NULL 12 0 1 12 +# legacy string number +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; +latch origid destid weight seq linkid +1 1 1 NULL 0 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +1 1 2 NULL 0 1 +1 1 2 1 1 2 +SELECT * FROM graph WHERE latch='1' AND origid=2 AND destid=1; +latch origid destid weight seq linkid +1 2 1 NULL 0 2 +1 2 1 1 1 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +1 1 4 NULL 0 1 +1 1 4 1 1 3 +1 1 4 1 2 4 +SELECT * FROM graph WHERE latch='1' AND origid=4 AND destid=1; +latch origid destid weight seq linkid +1 4 1 NULL 0 4 +1 4 1 1 1 3 +1 4 1 1 2 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=5 AND destid=7; +latch origid destid weight seq linkid +1 5 7 NULL 0 5 +1 5 7 1 1 7 +SELECT * FROM graph WHERE latch='1' AND origid=7 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +1 10 11 NULL 0 10 +1 10 11 1 1 11 +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +1 10 12 NULL 0 10 +1 10 12 1 1 11 +1 10 12 1 2 12 +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=10; +latch origid destid weight seq linkid +1 11 10 NULL 0 11 +1 11 10 1 1 12 +1 11 10 1 2 10 +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=12; +latch origid destid weight seq linkid +1 11 12 NULL 0 11 +1 11 12 1 1 12 +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=10; +latch origid destid weight seq linkid +1 12 10 NULL 0 12 +1 12 10 1 1 10 +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=11; +latch origid destid weight seq linkid +1 12 11 NULL 0 12 +1 12 11 1 1 10 +1 12 11 1 2 11 +SELECT * FROM graph WHERE latch='1' AND origid=1; +latch origid destid weight seq linkid +1 1 NULL 2 4 4 +1 1 NULL 1 3 3 +1 1 NULL 1 2 2 +1 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='1' AND origid=2; +latch origid destid weight seq linkid +1 2 NULL 3 4 4 +1 2 NULL 2 3 3 +1 2 NULL 1 2 1 +1 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch='1' AND origid=3; +latch origid destid weight seq linkid +1 3 NULL 2 4 2 +1 3 NULL 1 3 4 +1 3 NULL 1 2 1 +1 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch='1' AND origid=4; +latch origid destid weight seq linkid +1 4 NULL 3 4 2 +1 4 NULL 2 3 1 +1 4 NULL 1 2 3 +1 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch='1' AND origid=5; +latch origid destid weight seq linkid +1 5 NULL 1 3 7 +1 5 NULL 1 2 6 +1 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch='1' AND origid=6; +latch origid destid weight seq linkid +1 6 NULL 2 3 7 +1 6 NULL 1 2 5 +1 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch='1' AND origid=7; +latch origid destid weight seq linkid +1 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch='1' AND origid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=9; +latch origid destid weight seq linkid +1 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch='1' AND origid=10; +latch origid destid weight seq linkid +1 10 NULL 2 3 12 +1 10 NULL 1 2 11 +1 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch='1' AND origid=11; +latch origid destid weight seq linkid +1 11 NULL 2 3 10 +1 11 NULL 1 2 12 +1 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch='1' AND origid=12; +latch origid destid weight seq linkid +1 12 NULL 2 3 11 +1 12 NULL 1 2 10 +1 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch='1' AND origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND destid=1; +latch origid destid weight seq linkid +1 NULL 1 2 4 4 +1 NULL 1 1 3 3 +1 NULL 1 1 2 2 +1 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch='1' AND destid=2; +latch origid destid weight seq linkid +1 NULL 2 3 4 4 +1 NULL 2 2 3 3 +1 NULL 2 1 2 1 +1 NULL 2 0 1 2 +SELECT * FROM graph WHERE latch='1' AND destid=3; +latch origid destid weight seq linkid +1 NULL 3 2 4 2 +1 NULL 3 1 3 4 +1 NULL 3 1 2 1 +1 NULL 3 0 1 3 +SELECT * FROM graph WHERE latch='1' AND destid=4; +latch origid destid weight seq linkid +1 NULL 4 3 4 2 +1 NULL 4 2 3 1 +1 NULL 4 1 2 3 +1 NULL 4 0 1 4 +SELECT * FROM graph WHERE latch='1' AND destid=5; +latch origid destid weight seq linkid +1 NULL 5 1 2 6 +1 NULL 5 0 1 5 +SELECT * FROM graph WHERE latch='1' AND destid=6; +latch origid destid weight seq linkid +1 NULL 6 1 2 5 +1 NULL 6 0 1 6 +SELECT * FROM graph WHERE latch='1' AND destid=7; +latch origid destid weight seq linkid +1 NULL 7 2 3 6 +1 NULL 7 1 2 5 +1 NULL 7 0 1 7 +SELECT * FROM graph WHERE latch='1' AND destid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND destid=9; +latch origid destid weight seq linkid +1 NULL 9 0 1 9 +SELECT * FROM graph WHERE latch='1' AND destid=10; +latch origid destid weight seq linkid +1 NULL 10 2 3 11 +1 NULL 10 1 2 12 +1 NULL 10 0 1 10 +SELECT * FROM graph WHERE latch='1' AND destid=11; +latch origid destid weight seq linkid +1 NULL 11 2 3 12 +1 NULL 11 1 2 10 +1 NULL 11 0 1 11 +SELECT * FROM graph WHERE latch='1' AND destid=12; +latch origid destid weight seq linkid +1 NULL 12 2 3 10 +1 NULL 12 1 2 11 +1 NULL 12 0 1 12 +INSERT INTO graph_base(from_id, to_id) VALUES (11,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,14); +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 11 +dijkstras 10 13 1 2 13 +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 14 +dijkstras 10 13 1 2 13 +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 11 +dijkstras 10 13 1 2 13 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=21; +latch origid destid weight seq linkid +dijkstras 21 NULL 1 2 22 +dijkstras 21 NULL 0 1 21 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=22; +latch origid destid weight seq linkid +dijkstras 22 NULL 0 1 22 +INSERT INTO graph_base(from_id, to_id) VALUES (4,17); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 3 5 17 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (4,16); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 3 6 17 +dijkstras 1 NULL 3 5 16 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (17,18); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 4 7 18 +dijkstras 1 NULL 3 6 17 +dijkstras 1 NULL 3 5 16 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +latch origid destid weight seq linkid +dijkstras NULL 1 2 4 4 +dijkstras NULL 1 1 3 3 +dijkstras NULL 1 1 2 2 +dijkstras NULL 1 0 1 1 +# Now we add a connection from 4->6 +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); +# And delete all references to node 5 +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; +# which means there is a path in one direction only 1>3>4>6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +dijkstras 1 6 NULL 0 1 +dijkstras 1 6 1 1 3 +dijkstras 1 6 1 2 4 +dijkstras 1 6 1 3 6 +# but not 6>4>3>1 (so no result) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6 AND destid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +1 1 6 NULL 0 1 +1 1 6 1 1 3 +1 1 6 1 2 4 +1 1 6 1 3 6 +SELECT * FROM graph WHERE latch='1' AND origid=6 AND destid=1; +latch origid destid weight seq linkid +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.test b/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.test new file mode 100644 index 00000000..f1e59e54 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/general-MyISAM.test @@ -0,0 +1,3 @@ +# This is a maintainer generated file. Generated at Wednesday 5 February 22:26:12 CST 2014. +--let $oqgraph_use_table_type= MyISAM +--source general.inc diff --git a/storage/oqgraph/mysql-test/oqgraph/general-innodb.result b/storage/oqgraph/mysql-test/oqgraph/general-innodb.result new file mode 100644 index 00000000..38e3e0a2 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/general-innodb.result @@ -0,0 +1,1593 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +Performing OQGraph General test suite for ENGINE=innodb +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE= innodb ; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +select * from graph; +latch origid destid weight seq linkid +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); +INSERT INTO graph_base(from_id, to_id) VALUES (5,7); +INSERT INTO graph_base(from_id, to_id) VALUES (9,9); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +INSERT INTO graph_base(from_id, to_id) VALUES (11,12); +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); +# Return all edges +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +# Currently count should be 13 +SELECT count(*) FROM graph; +count(*) +13 +# Return all edges when latch is NULL - this is different to latch='' and same as no where clause +SELECT * FROM graph where latch is NULL; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +# Return all vertices, and subsets of vertices +SELECT * FROM graph where latch=''; +latch origid destid weight seq linkid + NULL NULL NULL NULL 1 + NULL NULL NULL NULL 2 + NULL NULL NULL NULL 3 + NULL NULL NULL NULL 4 + NULL NULL NULL NULL 5 + NULL NULL NULL NULL 6 + NULL NULL NULL NULL 7 + NULL NULL NULL NULL 9 + NULL NULL NULL NULL 10 + NULL NULL NULL NULL 11 + NULL NULL NULL NULL 12 +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +# Currently count should be 11 +SELECT count(*) FROM graph where latch=''; +count(*) +11 +SELECT * FROM graph where latch='' and linkid = 2; +latch origid destid weight seq linkid + NULL NULL NULL NULL 2 +SELECT * FROM graph where latch='' and (linkid > 2 and linkid < 6); +latch origid destid weight seq linkid + NULL NULL NULL NULL 3 + NULL NULL NULL NULL 4 + NULL NULL NULL NULL 5 +SELECT * FROM graph where latch='' and linkid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph where latch='' and linkid = 666; +latch origid destid weight seq linkid +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 1; +from to +1 3 +1 2 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 2; +from to +2 1 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 4; +from to +4 3 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 9; +from to +9 9 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 10; +from to +10 11 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = NULL; +from to +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 666; +from to +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 1; +from to +3 1 +2 1 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 2; +from to +1 2 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 4; +from to +3 4 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 9; +from to +9 9 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 10; +from to +12 10 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = NULL; +from to +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 666; +from to +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +SELECT count(*) FROM graph where latch='0'; +count(*) +11 +SELECT * FROM graph where latch='0' and linkid = 2; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 2 +SELECT * FROM graph where latch='0' and (linkid > 2 and linkid < 6); +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 1; +from to +1 3 +1 2 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 2; +from to +2 1 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 4; +from to +4 3 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 9; +from to +9 9 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 10; +from to +10 11 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 1; +from to +3 1 +2 1 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 2; +from to +1 2 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 4; +from to +3 4 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 9; +from to +9 9 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 10; +from to +12 10 +# Leaves search tests +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 5; +latch origid destid weight seq linkid +leaves 5 NULL 1 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 6; +latch origid destid weight seq linkid +leaves 6 NULL 2 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 7; +latch origid destid weight seq linkid +leaves 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 9; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 6; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 7; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 9; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +INSERT INTO graph_base(from_id, to_id) VALUES (10,13); +INSERT INTO graph_base(from_id, to_id) VALUES (11,14); +INSERT INTO graph_base(from_id, to_id) VALUES (12,15); +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +leaves 10 NULL 3 3 15 +leaves 10 NULL 2 2 14 +leaves 10 NULL 1 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +leaves 11 NULL 3 3 13 +leaves 11 NULL 2 2 15 +leaves 11 NULL 1 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +leaves 12 NULL 3 3 14 +leaves 12 NULL 2 2 13 +leaves 12 NULL 1 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 13; +latch origid destid weight seq linkid +leaves 13 NULL 0 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 14; +latch origid destid weight seq linkid +leaves 14 NULL 0 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 15; +latch origid destid weight seq linkid +leaves 15 NULL 0 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 13; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 14; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 15; +latch origid destid weight seq linkid +DELETE FROM graph_base where from_id=10 and to_id=13; +DELETE FROM graph_base where from_id=11 and to_id=14; +DELETE FROM graph_base where from_id=12 and to_id=15; +INSERT INTO graph_base(from_id, to_id) VALUES (13,10); +INSERT INTO graph_base(from_id, to_id) VALUES (14,11); +INSERT INTO graph_base(from_id, to_id) VALUES (15,12); +INSERT INTO graph_base(from_id, to_id) VALUES (16,1); +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 13; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 14; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 15; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 16; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +latch origid destid weight seq linkid +leaves NULL 10 3 3 14 +leaves NULL 10 2 2 15 +leaves NULL 10 1 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +latch origid destid weight seq linkid +leaves NULL 11 3 3 15 +leaves NULL 11 2 2 13 +leaves NULL 11 1 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +latch origid destid weight seq linkid +leaves NULL 12 3 3 13 +leaves NULL 12 2 2 14 +leaves NULL 12 1 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 13; +latch origid destid weight seq linkid +leaves NULL 13 0 1 13 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 14; +latch origid destid weight seq linkid +leaves NULL 14 0 1 14 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 15; +latch origid destid weight seq linkid +leaves NULL 15 0 1 15 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 1; +latch origid destid weight seq linkid +leaves NULL 1 1 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 2; +latch origid destid weight seq linkid +leaves NULL 2 2 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 3; +latch origid destid weight seq linkid +leaves NULL 3 2 1 16 +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 4; +latch origid destid weight seq linkid +leaves NULL 4 3 1 16 +DELETE FROM graph_base where from_id=13 and to_id=10; +DELETE FROM graph_base where from_id=14 and to_id=11; +DELETE FROM graph_base where from_id=15 and to_id=12; +DELETE FROM graph_base where from_id=16 and to_id=1; +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=6 AND destid=7; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='leaves' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +# Breadth-first search tests +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +breadth_first 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 3 4 4 +breadth_first 2 NULL 2 3 3 +breadth_first 2 NULL 1 2 1 +breadth_first 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3; +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +breadth_first 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4; +latch origid destid weight seq linkid +breadth_first 4 NULL 3 4 2 +breadth_first 4 NULL 2 3 1 +breadth_first 4 NULL 1 2 3 +breadth_first 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5; +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +breadth_first 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6; +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +breadth_first 6 NULL 1 2 5 +breadth_first 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7; +latch origid destid weight seq linkid +breadth_first 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9; +latch origid destid weight seq linkid +breadth_first 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10; +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +breadth_first 10 NULL 1 2 11 +breadth_first 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11; +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +breadth_first 11 NULL 1 2 12 +breadth_first 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12; +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +breadth_first 12 NULL 1 2 10 +breadth_first 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 12 NULL 1 2 10 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +count(*) +1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 2 3 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 4 NULL 2 3 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 3; +latch origid destid weight seq linkid +breadth_first 2 NULL 3 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 3; +latch origid destid weight seq linkid +breadth_first 4 NULL 3 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 2 NULL 2 3 3 +breadth_first 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 4 NULL 2 3 1 +breadth_first 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +breadth_first 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +breadth_first 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +breadth_first 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +breadth_first 12 NULL 1 2 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 2 4 4 +breadth_first NULL 1 1 3 3 +breadth_first NULL 1 1 2 2 +breadth_first NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 3 4 4 +breadth_first NULL 2 2 3 3 +breadth_first NULL 2 1 2 1 +breadth_first NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3; +latch origid destid weight seq linkid +breadth_first NULL 3 2 4 2 +breadth_first NULL 3 1 3 4 +breadth_first NULL 3 1 2 1 +breadth_first NULL 3 0 1 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4; +latch origid destid weight seq linkid +breadth_first NULL 4 3 4 2 +breadth_first NULL 4 2 3 1 +breadth_first NULL 4 1 2 3 +breadth_first NULL 4 0 1 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; +latch origid destid weight seq linkid +breadth_first NULL 5 1 2 6 +breadth_first NULL 5 0 1 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; +latch origid destid weight seq linkid +breadth_first NULL 6 1 2 5 +breadth_first NULL 6 0 1 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; +latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +breadth_first NULL 7 1 2 5 +breadth_first NULL 7 0 1 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9; +latch origid destid weight seq linkid +breadth_first NULL 9 0 1 9 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; +latch origid destid weight seq linkid +breadth_first NULL 10 2 3 11 +breadth_first NULL 10 1 2 12 +breadth_first NULL 10 0 1 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; +latch origid destid weight seq linkid +breadth_first NULL 11 2 3 12 +breadth_first NULL 11 1 2 10 +breadth_first NULL 11 0 1 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; +latch origid destid weight seq linkid +breadth_first NULL 12 2 3 10 +breadth_first NULL 12 1 2 11 +breadth_first NULL 12 0 1 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 1 3 3 +breadth_first NULL 1 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 2 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 3 1 3 4 +breadth_first NULL 3 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 4 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 5 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 6 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 7 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 10 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 11 1 2 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 12 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 1 2 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 2 3 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 3 2 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 4 2 3 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 10 2 3 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 11 2 3 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 12 2 3 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; +latch origid destid weight seq linkid +breadth_first NULL 2 3 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 3; +latch origid destid weight seq linkid +breadth_first NULL 4 3 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first'; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +2 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 2; +latch origid destid weight seq linkid +2 2 NULL 3 4 4 +2 2 NULL 2 3 3 +2 2 NULL 1 2 1 +2 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 3; +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +2 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 4; +latch origid destid weight seq linkid +2 4 NULL 3 4 2 +2 4 NULL 2 3 1 +2 4 NULL 1 2 3 +2 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 5; +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +2 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 6; +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +2 6 NULL 1 2 5 +2 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 7; +latch origid destid weight seq linkid +2 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = '2' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9; +latch origid destid weight seq linkid +2 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch = '2' AND origid = 10; +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +2 10 NULL 1 2 11 +2 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch = '2' AND origid = 11; +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +2 11 NULL 1 2 12 +2 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 12; +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +2 12 NULL 1 2 10 +2 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +latch origid destid weight seq linkid +2 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +latch origid destid weight seq linkid +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +latch origid destid weight seq linkid +2 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +latch origid destid weight seq linkid +2 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +latch origid destid weight seq linkid +2 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +latch origid destid weight seq linkid +2 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +latch origid destid weight seq linkid +2 12 NULL 1 2 10 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +count(*) +1 +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 2; +latch origid destid weight seq linkid +2 2 NULL 2 3 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 2; +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 2; +latch origid destid weight seq linkid +2 4 NULL 2 3 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 2; +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 2; +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 2; +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 2; +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 3; +latch origid destid weight seq linkid +2 2 NULL 3 4 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 3; +latch origid destid weight seq linkid +2 4 NULL 3 4 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 2 NULL 2 3 3 +2 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 4 NULL 2 3 1 +2 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +2 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +2 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +2 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +2 12 NULL 1 2 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 1; +latch origid destid weight seq linkid +2 NULL 1 2 4 4 +2 NULL 1 1 3 3 +2 NULL 1 1 2 2 +2 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 2; +latch origid destid weight seq linkid +2 NULL 2 3 4 4 +2 NULL 2 2 3 3 +2 NULL 2 1 2 1 +2 NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 3; +latch origid destid weight seq linkid +2 NULL 3 2 4 2 +2 NULL 3 1 3 4 +2 NULL 3 1 2 1 +2 NULL 3 0 1 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 4; +latch origid destid weight seq linkid +2 NULL 4 3 4 2 +2 NULL 4 2 3 1 +2 NULL 4 1 2 3 +2 NULL 4 0 1 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 5; +latch origid destid weight seq linkid +2 NULL 5 1 2 6 +2 NULL 5 0 1 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 6; +latch origid destid weight seq linkid +2 NULL 6 1 2 5 +2 NULL 6 0 1 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 7; +latch origid destid weight seq linkid +2 NULL 7 2 3 6 +2 NULL 7 1 2 5 +2 NULL 7 0 1 7 +SELECT * FROM graph WHERE latch = '2' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9; +latch origid destid weight seq linkid +2 NULL 9 0 1 9 +SELECT * FROM graph WHERE latch = '2' AND destid = 10; +latch origid destid weight seq linkid +2 NULL 10 2 3 11 +2 NULL 10 1 2 12 +2 NULL 10 0 1 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 11; +latch origid destid weight seq linkid +2 NULL 11 2 3 12 +2 NULL 11 1 2 10 +2 NULL 11 0 1 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 12; +latch origid destid weight seq linkid +2 NULL 12 2 3 10 +2 NULL 12 1 2 11 +2 NULL 12 0 1 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; +latch origid destid weight seq linkid +2 NULL 1 1 3 3 +2 NULL 1 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 1; +latch origid destid weight seq linkid +2 NULL 2 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 1; +latch origid destid weight seq linkid +2 NULL 3 1 3 4 +2 NULL 3 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 1; +latch origid destid weight seq linkid +2 NULL 4 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1; +latch origid destid weight seq linkid +2 NULL 5 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1; +latch origid destid weight seq linkid +2 NULL 6 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1; +latch origid destid weight seq linkid +2 NULL 7 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1; +latch origid destid weight seq linkid +2 NULL 10 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1; +latch origid destid weight seq linkid +2 NULL 11 1 2 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1; +latch origid destid weight seq linkid +2 NULL 12 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2; +latch origid destid weight seq linkid +2 NULL 1 2 4 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 2; +latch origid destid weight seq linkid +2 NULL 2 2 3 3 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 2; +latch origid destid weight seq linkid +2 NULL 3 2 4 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 2; +latch origid destid weight seq linkid +2 NULL 4 2 3 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2; +latch origid destid weight seq linkid +2 NULL 7 2 3 6 +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2; +latch origid destid weight seq linkid +2 NULL 10 2 3 11 +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2; +latch origid destid weight seq linkid +2 NULL 11 2 3 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2; +latch origid destid weight seq linkid +2 NULL 12 2 3 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3; +latch origid destid weight seq linkid +2 NULL 2 3 4 4 +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 3; +latch origid destid weight seq linkid +2 NULL 4 3 4 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2'; +latch origid destid weight seq linkid +# Dijkstras algorithm tests +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=1; +latch origid destid weight seq linkid +dijkstras 1 1 NULL 0 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +dijkstras 1 2 NULL 0 1 +dijkstras 1 2 1 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2 AND destid=1; +latch origid destid weight seq linkid +dijkstras 2 1 NULL 0 2 +dijkstras 2 1 1 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +dijkstras 1 4 NULL 0 1 +dijkstras 1 4 1 1 3 +dijkstras 1 4 1 2 4 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4 AND destid=1; +latch origid destid weight seq linkid +dijkstras 4 1 NULL 0 4 +dijkstras 4 1 1 1 3 +dijkstras 4 1 1 2 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5 AND destid=7; +latch origid destid weight seq linkid +dijkstras 5 7 NULL 0 5 +dijkstras 5 7 1 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +dijkstras 10 11 NULL 0 10 +dijkstras 10 11 1 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +dijkstras 10 12 NULL 0 10 +dijkstras 10 12 1 1 11 +dijkstras 10 12 1 2 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=10; +latch origid destid weight seq linkid +dijkstras 11 10 NULL 0 11 +dijkstras 11 10 1 1 12 +dijkstras 11 10 1 2 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=12; +latch origid destid weight seq linkid +dijkstras 11 12 NULL 0 11 +dijkstras 11 12 1 1 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=10; +latch origid destid weight seq linkid +dijkstras 12 10 NULL 0 12 +dijkstras 12 10 1 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=11; +latch origid destid weight seq linkid +dijkstras 12 11 NULL 0 12 +dijkstras 12 11 1 1 10 +dijkstras 12 11 1 2 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2; +latch origid destid weight seq linkid +dijkstras 2 NULL 3 4 4 +dijkstras 2 NULL 2 3 3 +dijkstras 2 NULL 1 2 1 +dijkstras 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=3; +latch origid destid weight seq linkid +dijkstras 3 NULL 2 4 2 +dijkstras 3 NULL 1 3 4 +dijkstras 3 NULL 1 2 1 +dijkstras 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4; +latch origid destid weight seq linkid +dijkstras 4 NULL 3 4 2 +dijkstras 4 NULL 2 3 1 +dijkstras 4 NULL 1 2 3 +dijkstras 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5; +latch origid destid weight seq linkid +dijkstras 5 NULL 1 3 7 +dijkstras 5 NULL 1 2 6 +dijkstras 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6; +latch origid destid weight seq linkid +dijkstras 6 NULL 2 3 7 +dijkstras 6 NULL 1 2 5 +dijkstras 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7; +latch origid destid weight seq linkid +dijkstras 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=9; +latch origid destid weight seq linkid +dijkstras 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10; +latch origid destid weight seq linkid +dijkstras 10 NULL 2 3 12 +dijkstras 10 NULL 1 2 11 +dijkstras 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11; +latch origid destid weight seq linkid +dijkstras 11 NULL 2 3 10 +dijkstras 11 NULL 1 2 12 +dijkstras 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12; +latch origid destid weight seq linkid +dijkstras 12 NULL 2 3 11 +dijkstras 12 NULL 1 2 10 +dijkstras 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +latch origid destid weight seq linkid +dijkstras NULL 1 2 4 4 +dijkstras NULL 1 1 3 3 +dijkstras NULL 1 1 2 2 +dijkstras NULL 1 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=2; +latch origid destid weight seq linkid +dijkstras NULL 2 3 4 4 +dijkstras NULL 2 2 3 3 +dijkstras NULL 2 1 2 1 +dijkstras NULL 2 0 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=3; +latch origid destid weight seq linkid +dijkstras NULL 3 2 4 2 +dijkstras NULL 3 1 3 4 +dijkstras NULL 3 1 2 1 +dijkstras NULL 3 0 1 3 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=4; +latch origid destid weight seq linkid +dijkstras NULL 4 3 4 2 +dijkstras NULL 4 2 3 1 +dijkstras NULL 4 1 2 3 +dijkstras NULL 4 0 1 4 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; +latch origid destid weight seq linkid +dijkstras NULL 5 1 2 6 +dijkstras NULL 5 0 1 5 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; +latch origid destid weight seq linkid +dijkstras NULL 6 1 2 5 +dijkstras NULL 6 0 1 6 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; +latch origid destid weight seq linkid +dijkstras NULL 7 2 3 6 +dijkstras NULL 7 1 2 5 +dijkstras NULL 7 0 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND destid=9; +latch origid destid weight seq linkid +dijkstras NULL 9 0 1 9 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; +latch origid destid weight seq linkid +dijkstras NULL 10 2 3 11 +dijkstras NULL 10 1 2 12 +dijkstras NULL 10 0 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; +latch origid destid weight seq linkid +dijkstras NULL 11 2 3 12 +dijkstras NULL 11 1 2 10 +dijkstras NULL 11 0 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; +latch origid destid weight seq linkid +dijkstras NULL 12 2 3 10 +dijkstras NULL 12 1 2 11 +dijkstras NULL 12 0 1 12 +# legacy string number +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; +latch origid destid weight seq linkid +1 1 1 NULL 0 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +1 1 2 NULL 0 1 +1 1 2 1 1 2 +SELECT * FROM graph WHERE latch='1' AND origid=2 AND destid=1; +latch origid destid weight seq linkid +1 2 1 NULL 0 2 +1 2 1 1 1 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +1 1 4 NULL 0 1 +1 1 4 1 1 3 +1 1 4 1 2 4 +SELECT * FROM graph WHERE latch='1' AND origid=4 AND destid=1; +latch origid destid weight seq linkid +1 4 1 NULL 0 4 +1 4 1 1 1 3 +1 4 1 1 2 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=5 AND destid=7; +latch origid destid weight seq linkid +1 5 7 NULL 0 5 +1 5 7 1 1 7 +SELECT * FROM graph WHERE latch='1' AND origid=7 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +1 10 11 NULL 0 10 +1 10 11 1 1 11 +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +1 10 12 NULL 0 10 +1 10 12 1 1 11 +1 10 12 1 2 12 +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=10; +latch origid destid weight seq linkid +1 11 10 NULL 0 11 +1 11 10 1 1 12 +1 11 10 1 2 10 +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=12; +latch origid destid weight seq linkid +1 11 12 NULL 0 11 +1 11 12 1 1 12 +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=10; +latch origid destid weight seq linkid +1 12 10 NULL 0 12 +1 12 10 1 1 10 +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=11; +latch origid destid weight seq linkid +1 12 11 NULL 0 12 +1 12 11 1 1 10 +1 12 11 1 2 11 +SELECT * FROM graph WHERE latch='1' AND origid=1; +latch origid destid weight seq linkid +1 1 NULL 2 4 4 +1 1 NULL 1 3 3 +1 1 NULL 1 2 2 +1 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='1' AND origid=2; +latch origid destid weight seq linkid +1 2 NULL 3 4 4 +1 2 NULL 2 3 3 +1 2 NULL 1 2 1 +1 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch='1' AND origid=3; +latch origid destid weight seq linkid +1 3 NULL 2 4 2 +1 3 NULL 1 3 4 +1 3 NULL 1 2 1 +1 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch='1' AND origid=4; +latch origid destid weight seq linkid +1 4 NULL 3 4 2 +1 4 NULL 2 3 1 +1 4 NULL 1 2 3 +1 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch='1' AND origid=5; +latch origid destid weight seq linkid +1 5 NULL 1 3 7 +1 5 NULL 1 2 6 +1 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch='1' AND origid=6; +latch origid destid weight seq linkid +1 6 NULL 2 3 7 +1 6 NULL 1 2 5 +1 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch='1' AND origid=7; +latch origid destid weight seq linkid +1 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch='1' AND origid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=9; +latch origid destid weight seq linkid +1 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch='1' AND origid=10; +latch origid destid weight seq linkid +1 10 NULL 2 3 12 +1 10 NULL 1 2 11 +1 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch='1' AND origid=11; +latch origid destid weight seq linkid +1 11 NULL 2 3 10 +1 11 NULL 1 2 12 +1 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch='1' AND origid=12; +latch origid destid weight seq linkid +1 12 NULL 2 3 11 +1 12 NULL 1 2 10 +1 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch='1' AND origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND destid=1; +latch origid destid weight seq linkid +1 NULL 1 2 4 4 +1 NULL 1 1 3 3 +1 NULL 1 1 2 2 +1 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch='1' AND destid=2; +latch origid destid weight seq linkid +1 NULL 2 3 4 4 +1 NULL 2 2 3 3 +1 NULL 2 1 2 1 +1 NULL 2 0 1 2 +SELECT * FROM graph WHERE latch='1' AND destid=3; +latch origid destid weight seq linkid +1 NULL 3 2 4 2 +1 NULL 3 1 3 4 +1 NULL 3 1 2 1 +1 NULL 3 0 1 3 +SELECT * FROM graph WHERE latch='1' AND destid=4; +latch origid destid weight seq linkid +1 NULL 4 3 4 2 +1 NULL 4 2 3 1 +1 NULL 4 1 2 3 +1 NULL 4 0 1 4 +SELECT * FROM graph WHERE latch='1' AND destid=5; +latch origid destid weight seq linkid +1 NULL 5 1 2 6 +1 NULL 5 0 1 5 +SELECT * FROM graph WHERE latch='1' AND destid=6; +latch origid destid weight seq linkid +1 NULL 6 1 2 5 +1 NULL 6 0 1 6 +SELECT * FROM graph WHERE latch='1' AND destid=7; +latch origid destid weight seq linkid +1 NULL 7 2 3 6 +1 NULL 7 1 2 5 +1 NULL 7 0 1 7 +SELECT * FROM graph WHERE latch='1' AND destid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND destid=9; +latch origid destid weight seq linkid +1 NULL 9 0 1 9 +SELECT * FROM graph WHERE latch='1' AND destid=10; +latch origid destid weight seq linkid +1 NULL 10 2 3 11 +1 NULL 10 1 2 12 +1 NULL 10 0 1 10 +SELECT * FROM graph WHERE latch='1' AND destid=11; +latch origid destid weight seq linkid +1 NULL 11 2 3 12 +1 NULL 11 1 2 10 +1 NULL 11 0 1 11 +SELECT * FROM graph WHERE latch='1' AND destid=12; +latch origid destid weight seq linkid +1 NULL 12 2 3 10 +1 NULL 12 1 2 11 +1 NULL 12 0 1 12 +INSERT INTO graph_base(from_id, to_id) VALUES (11,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,14); +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 11 +dijkstras 10 13 1 2 13 +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 14 +dijkstras 10 13 1 2 13 +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 11 +dijkstras 10 13 1 2 13 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=21; +latch origid destid weight seq linkid +dijkstras 21 NULL 1 2 22 +dijkstras 21 NULL 0 1 21 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=22; +latch origid destid weight seq linkid +dijkstras 22 NULL 0 1 22 +INSERT INTO graph_base(from_id, to_id) VALUES (4,17); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 3 5 17 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (4,16); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 3 6 17 +dijkstras 1 NULL 3 5 16 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (17,18); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 4 7 18 +dijkstras 1 NULL 3 6 17 +dijkstras 1 NULL 3 5 16 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +latch origid destid weight seq linkid +dijkstras NULL 1 2 4 4 +dijkstras NULL 1 1 3 3 +dijkstras NULL 1 1 2 2 +dijkstras NULL 1 0 1 1 +# Now we add a connection from 4->6 +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); +# And delete all references to node 5 +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; +# which means there is a path in one direction only 1>3>4>6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +dijkstras 1 6 NULL 0 1 +dijkstras 1 6 1 1 3 +dijkstras 1 6 1 2 4 +dijkstras 1 6 1 3 6 +# but not 6>4>3>1 (so no result) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6 AND destid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +1 1 6 NULL 0 1 +1 1 6 1 1 3 +1 1 6 1 2 4 +1 1 6 1 3 6 +SELECT * FROM graph WHERE latch='1' AND origid=6 AND destid=1; +latch origid destid weight seq linkid +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/general-innodb.test b/storage/oqgraph/mysql-test/oqgraph/general-innodb.test new file mode 100644 index 00000000..4534eb41 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/general-innodb.test @@ -0,0 +1,4 @@ +# This is a maintainer generated file. Generated at Wednesday 5 February 22:26:12 CST 2014. +-- source include/have_innodb.inc +--let $oqgraph_use_table_type= innodb +--source general.inc diff --git a/storage/oqgraph/mysql-test/oqgraph/general.inc b/storage/oqgraph/mysql-test/oqgraph/general.inc new file mode 100644 index 00000000..48960f7c --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/general.inc @@ -0,0 +1,730 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +--enable_warnings + +--echo Performing OQGraph General test suite for ENGINE=$oqgraph_use_table_type + +# Create the backing store +eval CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE= $oqgraph_use_table_type ; + +# Since late June 2014 OQGraph supports 'assisted discovery' as per https://mariadb.atlassian.net/browse/MDEV-5871 +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + +# Regression for MDEV-5891 +select * from graph; + +#-- +#-- ASCII art graph of this test data +#-- +-->(2) +#-- ( )<---+ +#-- (1) +#-- ( )<---+ +#-- +-->(3)<------->(4) +#-- +#-- (7)<----------(5)<--------->(6) (9) +#-- +#-- +--->(11) +#-- | | +#-- (10) | +#-- ^ v +#-- +----(12) + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); + +#-- extra unidirected node +INSERT INTO graph_base(from_id, to_id) VALUES (5,7); + +#-- isolated node with no loop - disallowed +#-- so origid 8 below should return an empty rowset +#-- INSERT INTO graph_base(from_id, to_id) VALUES (8,NULL); + +#-- isolated node with a (undirected) loop +#-- we have no way of representing a directed loop on an isolated node, is this valid in pure graph theory? +INSERT INTO graph_base(from_id, to_id) VALUES (9,9); + +#-- directed _cyclic_ graph triangle? +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +INSERT INTO graph_base(from_id, to_id) VALUES (11,12); +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); + +--echo # Return all edges +#-- we note that when weight is NULL it defaults to 1 +SELECT * FROM graph; +--echo # Currently count should be 13 +SELECT count(*) FROM graph; + +--echo # Return all edges when latch is NULL - this is different to latch='' and same as no where clause +SELECT * FROM graph where latch is NULL; + +--echo # Return all vertices, and subsets of vertices +SELECT * FROM graph where latch=''; +SELECT * FROM graph where latch='0'; + +--echo # Currently count should be 11 + +SELECT count(*) FROM graph where latch=''; +#-- get a subset of vertices +SELECT * FROM graph where latch='' and linkid = 2; +SELECT * FROM graph where latch='' and (linkid > 2 and linkid < 6); +SELECT * FROM graph where latch='' and linkid = NULL; +SELECT * FROM graph where latch='' and linkid = 666; + +#-- Query out-edges for vertex (no_search AND origid=N) +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 1; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 2; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 4; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 9; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 10; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = NULL; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 666; + +#-- Query in-edges for vertex (no_search AND destid=N) +#-- linkid will have the other end +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 1; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 2; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 4; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 9; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 10; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = NULL; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 666; + +# The following returns a result that makes no sense... +#-- what happens when we combined orig and dest? +#-- Bug https://bugs.launchpad.net/oqgraph/+bug/1195778 +#SELECT * FROM graph where latch='' and origid = 1; +#SELECT * FROM graph where latch='' and destid = 2; +#SELECT * FROM graph where latch='' and origid=1 and destid = 2; + +SELECT * FROM graph where latch='0'; +SELECT count(*) FROM graph where latch='0'; +SELECT * FROM graph where latch='0' and linkid = 2; +SELECT * FROM graph where latch='0' and (linkid > 2 and linkid < 6); +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 1; +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 2; +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 4; +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 9; +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 10; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 1; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 2; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 4; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 9; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 10; + +--echo # Leaves search tests +#-- We are asking "Are there nodes reachable from origid, from which no other nodes can be reached" +#-- We return a row for each leaf node that is reachable, with its id in 'linkid' +#-- and the weight calculated as "How many _directed_ hops to get there" +#-- If there is no path from origid to another node then there is no row for that linkid +#-- 'seq' is the counted distance of the search, thus, the loop link will always have seq 1 +#-- if there are two reachable neighbours, they will have seq 2,3 and so on +#-- linkid is the other end +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 1; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 2; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 3; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 4; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 5; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 6; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 7; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 8; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 9; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; + +#-- now do it in reverse - using destid find originating vertices +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 1; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 2; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 3; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 4; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 5; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 6; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 7; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 8; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 9; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; + +# Add more leaf nodes +INSERT INTO graph_base(from_id, to_id) VALUES (10,13); +INSERT INTO graph_base(from_id, to_id) VALUES (11,14); +INSERT INTO graph_base(from_id, to_id) VALUES (12,15); + +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 13; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 14; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 15; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 13; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 14; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 15; + +DELETE FROM graph_base where from_id=10 and to_id=13; +DELETE FROM graph_base where from_id=11 and to_id=14; +DELETE FROM graph_base where from_id=12 and to_id=15; + +# Add some root nodes +INSERT INTO graph_base(from_id, to_id) VALUES (13,10); +INSERT INTO graph_base(from_id, to_id) VALUES (14,11); +INSERT INTO graph_base(from_id, to_id) VALUES (15,12); +INSERT INTO graph_base(from_id, to_id) VALUES (16,1); + +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 10; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 11; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 12; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 13; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 14; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 15; +SELECT * FROM graph WHERE latch = 'leaves' AND origid = 16; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 10; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 11; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 12; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 13; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 14; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 15; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 1; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 2; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 3; +SELECT * FROM graph WHERE latch = 'leaves' AND destid = 4; + +DELETE FROM graph_base where from_id=13 and to_id=10; +DELETE FROM graph_base where from_id=14 and to_id=11; +DELETE FROM graph_base where from_id=15 and to_id=12; +DELETE FROM graph_base where from_id=16 and to_id=1; + +# path queries yield no result with "leaves" +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=2; +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=3; +SELECT * FROM graph WHERE latch='leaves' AND origid=1 AND destid=4; +SELECT * FROM graph WHERE latch='leaves' AND origid=6 AND destid=7; +SELECT * FROM graph WHERE latch='leaves' AND origid=10 AND destid=11; +SELECT * FROM graph WHERE latch='leaves' AND origid=10 AND destid=12; + +--echo # Breadth-first search tests +#-- We are asking "Is there a path from node 'origid' to (all) other nodes?" +#-- We return a row for each other node that is reachable, with its id in 'linkid' +#-- and the weight calculated as "How many _directed_ hops to get there" +#-- If there is no path from origid to another node then there is no row for that linkid +#-- We include 'origid' in the set of reachable nodes i.e. as a 'loop', with weight 0 +#-- 'seq' is the counted distance of the search, thus, the loop link will always have seq 1 +#-- if there are two reachable neighbours, they will have seq 2,3 and so on +#-- linkid is the other end +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666; # <-- note, should return nothing +#-- The above results can then be filtered by weight, so the results should be a subset for the corresponding origid above +#-- so effectively, `AND weight=1` returns the neighbours of origid in linkid +#<----- orig test harness - still returns (breadth_first 1 NULL 1 3 3), (breadth_first 1 NULL 1 2 2) +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +#-- so effectively, `count(... AND weight=1)` returns the number of _reachable_ immediate neighbours +#-- included because it allows human to quickly eyeball against the visual ASCII graph for correctness... +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; # <-- note, should return nothing +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +#-- so effectively, `AND weight=2` returns the second-level neighbours of origid in linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 2; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 3; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 3; + +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND (weight = 1 or weight = 2); # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND (weight = 1 or weight = 2); + +#-- now do it in reverse - using destid find originating vertices +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 3; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 3; + +#-- These return empty sets - origid or destid must be specified and non null to get a result set +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = NULL; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = NULL; +SELECT * FROM graph WHERE latch = 'breadth_first' AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first'; + +#-- Repeat the above with legacy string +SELECT * FROM graph WHERE latch = '2' AND origid = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 4; +SELECT * FROM graph WHERE latch = '2' AND origid = 5; +SELECT * FROM graph WHERE latch = '2' AND origid = 6; +SELECT * FROM graph WHERE latch = '2' AND origid = 7; +SELECT * FROM graph WHERE latch = '2' AND origid = 8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9; +SELECT * FROM graph WHERE latch = '2' AND origid = 10; +SELECT * FROM graph WHERE latch = '2' AND origid = 11; +SELECT * FROM graph WHERE latch = '2' AND origid = 12; +SELECT * FROM graph WHERE latch = '2' AND origid = 666; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; # <-- note, should return nothing +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 2; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 3; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 3; + +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND (weight = 1 or weight = 2); # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND (weight = 1 or weight = 2); + +SELECT * FROM graph WHERE latch = '2' AND destid = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 4; +SELECT * FROM graph WHERE latch = '2' AND destid = 5; +SELECT * FROM graph WHERE latch = '2' AND destid = 6; +SELECT * FROM graph WHERE latch = '2' AND destid = 7; +SELECT * FROM graph WHERE latch = '2' AND destid = 8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND destid = 9; +SELECT * FROM graph WHERE latch = '2' AND destid = 10; +SELECT * FROM graph WHERE latch = '2' AND destid = 11; +SELECT * FROM graph WHERE latch = '2' AND destid = 12; +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 1; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 2; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 2; +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 2 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 3 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 4 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 5 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 6 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 7 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 8 and weight = 3; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND destid = 9 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 10 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 11 and weight = 3; +SELECT * FROM graph WHERE latch = '2' AND destid = 12 and weight = 3; + +#-- These return empty sets - origid must be specified and non null to get a result set +SELECT * FROM graph WHERE latch = '2' AND origid = NULL; +SELECT * FROM graph WHERE latch = '2' AND destid = NULL; +SELECT * FROM graph WHERE latch = '2' AND weight = 1; +SELECT * FROM graph WHERE latch = '2'; + + +--echo # Dijkstras algorithm tests +#-- We ask 'What is the shortest path (if any) between 'origid' and 'destid' +#-- This returns the number of directed hops +1 (for the starting node) +#-- 'weight' is NULL for the starting point, or 1 +#-- 'linkid' is the way point id +#-- 'seq' is the distance of the waypoint from the start (counting from zero) +#-- the default order returned is waypoints out from the start +#-- zero hop (1 row) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=1; +#-- one hop +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=2; +#-- one hop in reverse +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2 AND destid=1; +#-- two hops (via 3) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=4; +#-- two hops in reverse direction +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4 AND destid=1; +#-- no result (no connection) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=5; +#-- no result (no destination exists) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=666; + +#-- one hop on a unidirected link +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5 AND destid=7; +#-- zero hop in reverse direction on a unidirected link +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7 AND destid=5; + +#-- Trickery - what about the cyclic loop? +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=11; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=12; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=10; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=12; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=10; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=11; + +#-- reachable vertices +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=3; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='dijkstras' AND origid=9; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=666; # <-- note, should return nothing + +#-- originating vertices +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=2; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=3; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=4; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='dijkstras' AND destid=9; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; + +--echo # legacy string number +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=2; +SELECT * FROM graph WHERE latch='1' AND origid=2 AND destid=1; +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=4; +SELECT * FROM graph WHERE latch='1' AND origid=4 AND destid=1; +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=5; +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=666; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='1' AND origid=5 AND destid=7; +SELECT * FROM graph WHERE latch='1' AND origid=7 AND destid=5; +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=11; +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=12; +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=10; +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=12; +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=10; +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=11; +SELECT * FROM graph WHERE latch='1' AND origid=1; +SELECT * FROM graph WHERE latch='1' AND origid=2; +SELECT * FROM graph WHERE latch='1' AND origid=3; +SELECT * FROM graph WHERE latch='1' AND origid=4; +SELECT * FROM graph WHERE latch='1' AND origid=5; +SELECT * FROM graph WHERE latch='1' AND origid=6; +SELECT * FROM graph WHERE latch='1' AND origid=7; +SELECT * FROM graph WHERE latch='1' AND origid=8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='1' AND origid=9; +SELECT * FROM graph WHERE latch='1' AND origid=10; +SELECT * FROM graph WHERE latch='1' AND origid=11; +SELECT * FROM graph WHERE latch='1' AND origid=12; +SELECT * FROM graph WHERE latch='1' AND origid=666; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='1' AND destid=1; +SELECT * FROM graph WHERE latch='1' AND destid=2; +SELECT * FROM graph WHERE latch='1' AND destid=3; +SELECT * FROM graph WHERE latch='1' AND destid=4; +SELECT * FROM graph WHERE latch='1' AND destid=5; +SELECT * FROM graph WHERE latch='1' AND destid=6; +SELECT * FROM graph WHERE latch='1' AND destid=7; +SELECT * FROM graph WHERE latch='1' AND destid=8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='1' AND destid=9; +SELECT * FROM graph WHERE latch='1' AND destid=10; +SELECT * FROM graph WHERE latch='1' AND destid=11; +SELECT * FROM graph WHERE latch='1' AND destid=12; + +#-- What if we add two equally valid two-hop paths? +#-- +#-- +#-- +--->(14)----------+ +#-- | v +#-- | +--->(11)---->(13) +#-- | | | +#-- +-(10) | +#-- ^ v +#-- +----(12) +#-- +#-- We note it chooses 10,11,13 but will it always? +INSERT INTO graph_base(from_id, to_id) VALUES (11,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,14); +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +#-- We note is _appears_ to use the lowered valued node id if there are two equal paths +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; + +#-- add some extra and check +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=21; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=22; +INSERT INTO graph_base(from_id, to_id) VALUES (4,17); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +INSERT INTO graph_base(from_id, to_id) VALUES (4,16); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +INSERT INTO graph_base(from_id, to_id) VALUES (17,18); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; + +--echo # Now we add a connection from 4->6 +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); + +--echo # And delete all references to node 5 +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; + +--echo # which means there is a path in one direction only 1>3>4>6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +--echo # but not 6>4>3>1 (so no result) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6 AND destid=1; + +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=6; +SELECT * FROM graph WHERE latch='1' AND origid=6 AND destid=1; + + +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; + +DROP TABLE graph_base; +DROP TABLE graph; + +#-- Reminder - the basic spec is at http://openquery.com/graph/doc +#-- Query edges stored in graph engine (latch=NULL) +#-- SELECT * FROM foo; +#-- Results: +#-- vertex id for origin of edge in origid column. +#-- vertex id for destination of edge in destid column. +#-- weight of edge in weight column. +#-- Essentially this returns the values (origid,destid pairs with optional weight) you put in, in this mode OQGRAPH looks very close to a real table. But it also does nothing special, it's just store/retrieve for those columns. The other columns will be returned as NULL. +#-- +#-- Query vertices stored in graph engine (latch=0) +#-- SELECT * FROM foo WHERE latch = 0; +#-- Results: +#-- vertex id in linkid column +#-- +#-- Query out-edges for vertex (latch=0 AND origid=N) +#-- SELECT * FROM foo WHERE latch = 0 AND origid = 2; +#-- Results: +#-- vertex id in linkid column +#-- edge weight in weight column +#-- +#-- Query in-edges for vertex (latch=0 AND destid=N) +#-- SELECT * FROM foo WHERE latch = 0 AND destid = 6; +#-- Results: +#-- vertex id in linkid column +#-- edge weight in weight column +#-- +#-- Dijkstra's shortest path algorithm (latch=1) +#-- Find shortest path: +#-- SELECT * FROM foo WHERE latch = 1 AND origid = 1 AND destid = 6; +#-- Results: +#-- latch, origid, destid are same as input. +#-- vertex id of the current step in linkid column. +#-- weight of traversed edge in weight column. +#-- step counter in seq column, so you can sort and use the result (starting at step 0). +#-- Example: SELECT GROUP_CONCAT(linkid ORDER BY seq) ... +#-- +#-- Find reachable vertices: +#-- SELECT * FROM foo WHERE latch = 1 AND origid = 1; +#-- Results: +#-- latch, origid, destid are same as input. +#-- vertex id in linkid column. +#-- aggregate of weights in weight column. +#-- +#-- Find originating vertices: +#-- SELECT * FROM foo WHERE latch = 1 AND destid = 6; +#-- Results: +#-- latch, origid, destid are same as input. +#-- vertex id in linkid column. +#-- aggregate of weights in weight column. +#-- +#-- Breadth-first search (latch=2, assumes that each vertex is weight 1) +#-- Find shortest path: +#-- SELECT * FROM foo WHERE latch = 2 AND origid = 1 AND destid = 6; +#-- Results: +#-- vertex id in linkid column. +#-- weight column = 1 for each hop. +#-- +#-- Find reachable vertices: +#-- SELECT * FROM foo WHERE latch = 2 AND origid = 1; +#-- Results: +#-- vertex id in linkid column. +#-- computed number of hops in weight column. +#-- +#-- Find originating vertices: +#-- SELECT * FROM foo WHERE latch = 2 AND destid = 6; +#-- Results: +#-- vertex id in linkid column. +#-- computed number of hops in weight column. + + diff --git a/storage/oqgraph/mysql-test/oqgraph/generate_backing_table_tests_suite.sh b/storage/oqgraph/mysql-test/oqgraph/generate_backing_table_tests_suite.sh new file mode 100755 index 00000000..894607fd --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/generate_backing_table_tests_suite.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# This is a template fgenerator or repeating an identical suite of tests for each backing table storage engine +# It generates a set of .test files for the following, for example: +# general-myisam.test +# general-memory.test +# general-innodb.test +# (etc) +# +# We generate these files, because as a general rule the coverage should be identical per backing table engine +# but we might want to pick out and re-reun for an individual backing table engine +# otherwise we could use an MTR loop instead. + +# This is intended to be used by a maintainer; i.e. the resulting .test files are still committed to git. + +# Note on known storage engines: +# See https://mariadb.com/kb/en/information-schema-engines-table/ for a full list +# CSV - doesn't work with OQGraph, attempting to create backing table gives 'failed: 1069: Too many keys specified; max 0 keys allowed' +# BLACKHOLE - makes no sense... but we should make sure it doesnt crash +# FEDERATED, ARCHIVE - consider later + +ENGINES="MyISAM MEMORY Aria" + +for ENGINE in $ENGINES ; do + cat > general-$ENGINE.test <<EOF +# This is a maintainer generated file. Generated at `date`. +--let \$oqgraph_use_table_type= $ENGINE +--source general.inc +EOF +done + +# These engines need an extra check to see if thy are compiled +ENGINES2="innodb" +for ENGINE in $ENGINES2 ; do + cat > general-$ENGINE.test <<EOF +# This is a maintainer generated file. Generated at `date`. +-- source include/have_$ENGINE.inc +--let \$oqgraph_use_table_type= $ENGINE +--source general.inc +EOF +done + +# Generate a script to rerun the test suite as well +# Intended to be run from build as ../storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh + +MGFILE=maintainer-general-record.sh +echo '#!/bin/sh' > $MGFILE +echo '# This is a maintainer generated file. Generated at '`date`'.' >> $MGFILE +for ENGINE in $ENGINES $ENGINES2 ; do + echo mysql-test/mysql-test-run --record oqgraph.general-$ENGINE >> $MGFILE +done + diff --git a/storage/oqgraph/mysql-test/oqgraph/invalid_operations.result b/storage/oqgraph/mysql-test/oqgraph/invalid_operations.result new file mode 100644 index 00000000..930d65af --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/invalid_operations.result @@ -0,0 +1,43 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +call mtr.add_suppression("graph_base is open on delete"); +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,2), (2,3); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +insert into graph values (NULL, 1, 2, 3.0, NULL, NULL); +ERROR HY000: Table 'graph' is read only +delete from graph; +ERROR HY000: Table 'graph' is read only +truncate graph; +ERROR HY000: Table 'graph' is read only +update graph set origid=123; +ERROR HY000: Table 'graph' is read only +DROP TABLE graph_base; +DROP TABLE graph; +# +# End of 10.0 tests +# +# +# MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table in MariaDB 10.5.9 when OQGraph SE is loaded to the server +# +drop table foobar; +ERROR 42S02: Unknown table 'test.foobar' +# +# End of 10.5 tests +# diff --git a/storage/oqgraph/mysql-test/oqgraph/invalid_operations.test b/storage/oqgraph/mysql-test/oqgraph/invalid_operations.test new file mode 100644 index 00000000..24351cc9 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/invalid_operations.test @@ -0,0 +1,63 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +call mtr.add_suppression("graph_base is open on delete"); + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,2), (2,3); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); + +# -- check readonly'ness +--error 1036 +insert into graph values (NULL, 1, 2, 3.0, NULL, NULL); + +--error 1036 +delete from graph; + +--error 1036 +truncate graph; + +# This was hitting bug https://bugs.launchpad.net/oqgraph/+bug/1233113 +--error 1036 +update graph set origid=123; + + +DROP TABLE graph_base; +DROP TABLE graph; + +--echo # +--echo # End of 10.0 tests +--echo # + +--echo # +--echo # MDEV-25373 DROP TABLE doesn't raise error while dropping non-existing table in MariaDB 10.5.9 when OQGraph SE is loaded to the server +--echo # +--error 1051 +drop table foobar; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/storage/oqgraph/mysql-test/oqgraph/isnull.result b/storage/oqgraph/mysql-test/oqgraph/isnull.result new file mode 100644 index 00000000..d9af3322 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/isnull.result @@ -0,0 +1,42 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); +select * from graph where latch is null; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +select * from graph where latch is null and origid=1; +latch origid destid weight seq linkid +NULL 1 NULL 1 2 3 +NULL 1 NULL 1 1 2 +select * from graph where latch is null and destid=2; +latch origid destid weight seq linkid +NULL NULL 2 1 1 1 +DROP TABLE graph; +DROP TABLE graph_base; diff --git a/storage/oqgraph/mysql-test/oqgraph/isnull.test b/storage/oqgraph/mysql-test/oqgraph/isnull.test new file mode 100644 index 00000000..dc7622da --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/isnull.test @@ -0,0 +1,38 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); + +select * from graph where latch is null; +select * from graph where latch is null and origid=1; +select * from graph where latch is null and destid=2; + +DROP TABLE graph; +DROP TABLE graph_base; diff --git a/storage/oqgraph/mysql-test/oqgraph/legacy_upgrade.result b/storage/oqgraph/mysql-test/oqgraph/legacy_upgrade.result new file mode 100644 index 00000000..0b437217 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/legacy_upgrade.result @@ -0,0 +1,99 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +The next error 140 + 1005 is expected +CREATE TABLE graph ( +latch SMALLINT UNSIGNED NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +ERROR HY000: Can't create table `test`.`graph` (errno: 140 "Wrong create options") +SET GLOBAL oqgraph_allow_create_integer_latch=true; +The next warning 1287 is expected +CREATE TABLE graph ( +latch SMALLINT UNSIGNED NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +Warnings: +Warning 1287 'latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future release. Please use 'latch VARCHAR(32) NULL' instead +SET GLOBAL oqgraph_allow_create_integer_latch=false; +The next error 140 + 1005 is expected +CREATE TABLE graph_again ( +latch SMALLINT UNSIGNED NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +ERROR HY000: Can't create table `test`.`graph_again` (errno: 140 "Wrong create options") +# Populating base table +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); +# Exercising latch==2 +SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND (weight = 1 OR weight = 2); +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +# Exercising latch==1 +SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=4; +latch origid destid weight seq linkid +1 1 4 NULL 0 1 +1 1 4 1 1 3 +1 1 4 1 2 4 +SELECT * FROM graph WHERE latch=1 AND origid=4 AND destid=1; +latch origid destid weight seq linkid +1 4 1 NULL 0 4 +1 4 1 1 1 3 +1 4 1 1 2 1 +SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1; +latch origid destid weight seq linkid +0 1 2 1 3 1 +0 1 2 1 2 3 +0 1 2 1 1 2 +# Adding new row to base table +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); +# Deleting rows from base table +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; +# Execising latch==1 on new data +SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6; +latch origid destid weight seq linkid +1 1 6 NULL 0 1 +1 1 6 1 1 3 +1 1 6 1 2 4 +1 1 6 1 3 6 +SELECT * FROM graph WHERE latch=1 AND origid=6 AND destid=1; +latch origid destid weight seq linkid +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph_base; diff --git a/storage/oqgraph/mysql-test/oqgraph/legacy_upgrade.test b/storage/oqgraph/mysql-test/oqgraph/legacy_upgrade.test new file mode 100644 index 00000000..ae548b5e --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/legacy_upgrade.test @@ -0,0 +1,106 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + +# Backwards compatibility test +# First we ensure the scaffolding is disabled (default situation) +# and check we cant create a table with an integer latch +# Assume this is the default, so don't explicity set false yet: +# SET GLOBAL oqgraph_allow_create_integer_latch=false; +--echo The next error 140 + 1005 is expected +--error 140 +--error 1005 +CREATE TABLE graph ( + latch SMALLINT UNSIGNED NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + +# Here we enable scaffolding to let us create a deprecated table +# so we can check that the new code will still allow queries to be performed +# on a legacy database +# It should still generate a warning (1287) - but I don't know how to test for that +# +# latch SMALLINT UNSIGNED NULL' is deprecated and will be removed in a future +# release. Please use 'latch VARCHAR(32) NULL' instead +# +SET GLOBAL oqgraph_allow_create_integer_latch=true; +--echo The next warning 1287 is expected +CREATE TABLE graph ( + latch SMALLINT UNSIGNED NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + +# Prevent further tables being create this way again +# and make sure the set is effective ... +SET GLOBAL oqgraph_allow_create_integer_latch=false; +--echo The next error 140 + 1005 is expected +--error 140 +--error 1005 +CREATE TABLE graph_again ( + latch SMALLINT UNSIGNED NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + +# Regression test expected v2 behaviour in this situation + +--echo # Populating base table +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); + +--echo # Exercising latch==2 +SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 1; +SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND weight = 2; +SELECT * FROM graph WHERE latch = 2 AND origid = 1 AND (weight = 1 OR weight = 2); +--echo # Exercising latch==1 +SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6; +SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=4; +SELECT * FROM graph WHERE latch=1 AND origid=4 AND destid=1; + +SELECT * FROM graph WHERE latch=0 and destid=2 and origid=1; + + +--echo # Adding new row to base table +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); + +--echo # Deleting rows from base table +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; + +--echo # Execising latch==1 on new data +SELECT * FROM graph WHERE latch=1 AND origid=1 AND destid=6; + +SELECT * FROM graph WHERE latch=1 AND origid=6 AND destid=1; + +# FIXME - if the following DROPs are missing then mysql will segfault on exit +# indicating an ordering dependency on destruction somewhere... +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph_base; + diff --git a/storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh b/storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh new file mode 100755 index 00000000..7af12013 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/maintainer-general-record.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# This is a maintainer generated file. Generated at Wednesday 5 February 22:26:12 CST 2014. +mysql-test/mysql-test-run --record oqgraph.general-MyISAM +mysql-test/mysql-test-run --record oqgraph.general-MEMORY +mysql-test/mysql-test-run --record oqgraph.general-Aria +mysql-test/mysql-test-run --record oqgraph.general-innodb diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1133093.result b/storage/oqgraph/mysql-test/oqgraph/regression_1133093.result new file mode 100644 index 00000000..e5a99d39 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1133093.result @@ -0,0 +1,44 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +another_id INT UNSIGNED NOT NULL DEFAULT 1, +w DOUBLE NOT NULL DEFAULT 1, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id', WEIGHT='w'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,4), (4,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +SELECT * from graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 1 4 1 NULL NULL +NULL 4 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +SELECT * FROM graph WHERE latch='1' and destid=2 and origid=1; +latch origid destid weight seq linkid +1 1 2 NULL 0 1 +1 1 2 1 1 2 +SELECT * FROM graph WHERE latch='1' and destid=2 and origid=1 order by seq; +latch origid destid weight seq linkid +1 1 2 NULL 0 1 +1 1 2 1 1 2 +DROP TABLE graph; +DROP TABLE graph_base; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1133093.test b/storage/oqgraph/mysql-test/oqgraph/regression_1133093.test new file mode 100644 index 00000000..c3a9a996 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1133093.test @@ -0,0 +1,46 @@ +# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1133093 +# Reproduce bug where order by seq crashes +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + another_id INT UNSIGNED NOT NULL DEFAULT 1, + w DOUBLE NOT NULL DEFAULT 1, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id', WEIGHT='w'; + +# -- do some stuff + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,4), (4,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); + +SELECT * from graph; +SELECT * FROM graph WHERE latch='1' and destid=2 and origid=1; +SELECT * FROM graph WHERE latch='1' and destid=2 and origid=1 order by seq; + +DROP TABLE graph; +DROP TABLE graph_base; + + +# Probably a separate issue: if the test is exited without dropping the tables at all +# then there is a memory leak reported diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1134355.result b/storage/oqgraph/mysql-test/oqgraph/regression_1134355.result new file mode 100644 index 00000000..015b42ab --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1134355.result @@ -0,0 +1,46 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +another_id INT UNSIGNED NOT NULL DEFAULT 1, +w DOUBLE NOT NULL DEFAULT 1, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id', WEIGHT='w'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,4), (4,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +SELECT * from graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 1 4 1 NULL NULL +NULL 4 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +SELECT * FROM graph WHERE destid=2 and origid=1; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +alter table graph ORIGID = 'another_id'; +ERROR HY000: Storage engine OQGRAPH of the table `test`.`graph` doesn't have this option +alter table graph ORIGID = 'something_else'; +ERROR HY000: Storage engine OQGRAPH of the table `test`.`graph` doesn't have this option +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1134355.test b/storage/oqgraph/mysql-test/oqgraph/regression_1134355.test new file mode 100644 index 00000000..ca9c7e36 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1134355.test @@ -0,0 +1,59 @@ +# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1134355 +#--reproduce bug where renaming a column in the graph crashes instead of returning an error +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + another_id INT UNSIGNED NOT NULL DEFAULT 1, + w DOUBLE NOT NULL DEFAULT 1, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id', WEIGHT='w'; + +# -- do some stuff + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,4), (4,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); + +SELECT * from graph; +SELECT * FROM graph WHERE destid=2 and origid=1; + +# We cant do this anyway because of read onlyness of table.... 1036 == read only +# In any case I changed the flags to make alter unsupported; later we can try and work out why the core doesnt help us clean up properly +# --error 1036 +--error 1031 +alter table graph ORIGID = 'another_id'; + +# But we need that to hold even in an invalid situation! +# -- bug was: the following alter table would crash, instead of returning error 1296 +# -- currently following may not crash, but does with the previous error 1036 causing statement present +# 'attribute not set to a valid column of 'xxx' - note currently truncating to graph_b instead of graph_base for some reason... +#--error 1296 +--error 1031 +alter table graph ORIGID = 'something_else'; + +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1195735.result b/storage/oqgraph/mysql-test/oqgraph/regression_1195735.result new file mode 100644 index 00000000..67aa885d --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1195735.result @@ -0,0 +1,32 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +One select of any clauses at all on graph here caused a hang on the select after the DELETE FROM +SELECT * FROM graph WHERE destid=2 and origid=1; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +DELETE FROM graph_base; +SELECT * from graph; +latch origid destid weight seq linkid +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +ERROR 42S02: Table 'test.graph_base' doesn't exist +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1195735.test b/storage/oqgraph/mysql-test/oqgraph/regression_1195735.test new file mode 100644 index 00000000..12ab7ecb --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1195735.test @@ -0,0 +1,44 @@ +# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1195735 +#--reproduce bug where select * from graph after delete from graph_base hangs the server +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); + +--echo One select of any clauses at all on graph here caused a hang on the select after the DELETE FROM +#-- even this if it is the only one - but it doesnt hang here ... SELECT * FROM graph; +SELECT * FROM graph WHERE destid=2 and origid=1; + +DELETE FROM graph_base; +#-- Bug 1195735 hangs on the next line +SELECT * from graph; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +--error S42S02 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +DROP TABLE graph; + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1196020.result b/storage/oqgraph/mysql-test/oqgraph/regression_1196020.result new file mode 100644 index 00000000..3ffc5a0e --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1196020.result @@ -0,0 +1,68 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '1' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '1' AND destid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 666 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 666 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '1' AND origid = 666 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 666 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = 666 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 666 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '1' AND destid = 666 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '0' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch is NULL AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '' AND destid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '0' AND destid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch is NULL AND destid = 666; +latch origid destid weight seq linkid +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1196020.test b/storage/oqgraph/mysql-test/oqgraph/regression_1196020.test new file mode 100644 index 00000000..a4df1790 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1196020.test @@ -0,0 +1,71 @@ +# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1196020 +#-- bug where select blah with origid = X where X does not exist, returns a row +#-- bug where select blah with destid = X where X does not exist, returns a row +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); + +# All the following should return no result because no vertex 666 exists in the graph + +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666; +SELECT * FROM graph WHERE latch = '2' AND origid = 666; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 666; +SELECT * FROM graph WHERE latch = '1' AND origid = 666; + +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 666; +SELECT * FROM graph WHERE latch = '2' AND destid = 666; +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 666; +SELECT * FROM graph WHERE latch = '1' AND destid = 666; + +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 666 and weight = 1; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 666 and weight = 1; +SELECT * FROM graph WHERE latch = '1' AND origid = 666 and weight = 1; + +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 666 and weight = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 666 and weight = 1; +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 666 and weight = 1; +SELECT * FROM graph WHERE latch = '1' AND destid = 666 and weight = 1; + +# Sanity check for no-search +SELECT * FROM graph WHERE latch = '' AND origid = 666; +SELECT * FROM graph WHERE latch = '0' AND origid = 666; +SELECT * FROM graph WHERE latch is NULL AND origid = 666; + +SELECT * FROM graph WHERE latch = '' AND destid = 666; +SELECT * FROM graph WHERE latch = '0' AND destid = 666; +SELECT * FROM graph WHERE latch is NULL AND destid = 666; + + + +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; + +DROP TABLE graph_base; +DROP TABLE graph; + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1196027.result b/storage/oqgraph/mysql-test/oqgraph/regression_1196027.result new file mode 100644 index 00000000..6c42374d --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1196027.result @@ -0,0 +1,56 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 1 2 2 +breadth_first NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 1 2 1 +breadth_first NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 1 2 2 +breadth_first 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 1 2 1 +breadth_first 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND destid = 1; +latch origid destid weight seq linkid +2 NULL 1 1 2 2 +2 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 2; +latch origid destid weight seq linkid +2 NULL 2 1 2 1 +2 NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 1; +latch origid destid weight seq linkid +2 1 NULL 1 2 2 +2 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 2; +latch origid destid weight seq linkid +2 2 NULL 1 2 1 +2 2 NULL 0 1 2 +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1196027.test b/storage/oqgraph/mysql-test/oqgraph/regression_1196027.test new file mode 100644 index 00000000..5e7017bd --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1196027.test @@ -0,0 +1,51 @@ +# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1196027 +#-- These were returning NULL which is incorrect +#-- https://bugs.launchpad.net/oqgraph/+bug/1196027 +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); + +# All the following should return no result because no vertex 666 exists in the graph + +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2; + +SELECT * FROM graph WHERE latch = '2' AND destid = 1; +SELECT * FROM graph WHERE latch = '2' AND destid = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 2; + + +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; + +DROP TABLE graph_base; +DROP TABLE graph; + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result b/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result new file mode 100644 index 00000000..c372a0c0 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1196036.result @@ -0,0 +1,103 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +weight FLOAT NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id', WEIGHT='weight'; +INSERT INTO graph_base(from_id, to_id, weight) VALUES (1,2,16), (2,1,16); +INSERT INTO graph_base(from_id, to_id, weight) VALUES (2,3,256), (3,2,256); +INSERT INTO graph_base(from_id, to_id, weight) VALUES (3,4,65536), (4,3,65536); +INSERT INTO graph_base(from_id, to_id, weight) VALUES (2,4,768); +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1; +latch origid destid weight seq linkid +dijkstras 1 NULL 784 4 4 +dijkstras 1 NULL 272 3 3 +dijkstras 1 NULL 16 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2; +latch origid destid weight seq linkid +dijkstras 2 NULL 768 4 4 +dijkstras 2 NULL 256 3 3 +dijkstras 2 NULL 16 2 1 +dijkstras 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3; +latch origid destid weight seq linkid +dijkstras 3 NULL 1024 4 4 +dijkstras 3 NULL 272 3 1 +dijkstras 3 NULL 256 2 2 +dijkstras 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 1; +latch origid destid weight seq linkid +dijkstras NULL 1 65808 4 4 +dijkstras NULL 1 272 3 3 +dijkstras NULL 1 16 2 2 +dijkstras NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 2; +latch origid destid weight seq linkid +dijkstras NULL 2 65792 4 4 +dijkstras NULL 2 256 3 3 +dijkstras NULL 2 16 2 1 +dijkstras NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 3; +latch origid destid weight seq linkid +dijkstras NULL 3 65536 4 4 +dijkstras NULL 3 272 3 1 +dijkstras NULL 3 256 2 2 +dijkstras NULL 3 0 1 3 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and destid=3; +latch origid destid weight seq linkid +dijkstras 1 3 NULL 0 1 +dijkstras 1 3 16 1 2 +dijkstras 1 3 256 2 3 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and destid=4; +latch origid destid weight seq linkid +dijkstras 1 4 NULL 0 1 +dijkstras 1 4 16 1 2 +dijkstras 1 4 768 2 4 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=16; +latch origid destid weight seq linkid +dijkstras 1 NULL 16 2 2 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=16; +latch origid destid weight seq linkid +dijkstras 2 NULL 16 2 1 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=16; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=784; +latch origid destid weight seq linkid +dijkstras 1 NULL 784 4 4 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=784; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=784; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=256; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=256; +latch origid destid weight seq linkid +dijkstras 2 NULL 256 3 3 +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=256; +latch origid destid weight seq linkid +dijkstras 3 NULL 256 2 2 +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1196036.test b/storage/oqgraph/mysql-test/oqgraph/regression_1196036.test new file mode 100644 index 00000000..a95a1c6d --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1196036.test @@ -0,0 +1,68 @@ +# Regression test for https://bugs.launchpad.net/oqgraph/+bug/1196036 +#-- bug with Djikstras algorithm - find reachable vertices (origid=X) returns weight=0 instead of weight=count of hops +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + weight FLOAT NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id', WEIGHT='weight'; + + +INSERT INTO graph_base(from_id, to_id, weight) VALUES (1,2,16), (2,1,16); +INSERT INTO graph_base(from_id, to_id, weight) VALUES (2,3,256), (3,2,256); +INSERT INTO graph_base(from_id, to_id, weight) VALUES (3,4,65536), (4,3,65536); +INSERT INTO graph_base(from_id, to_id, weight) VALUES (2,4,768); + +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3; + +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 1; +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 2; +SELECT * FROM graph WHERE latch = 'dijkstras' AND destid = 3; + +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and destid=3; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and destid=4; + +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=1; # <-- should return nothing +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=1; # <-- should return nothing +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=1; # <-- should return nothing + +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=16; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=16; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=16; # <-- should return nothing + +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=784; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=784; # <-- should return nothing +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=784; # <-- should return nothing + +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 1 and weight=256; # <-- should return nothing +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 2 and weight=256; +SELECT * FROM graph WHERE latch = 'dijkstras' AND origid = 3 and weight=256; + +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; + +DROP TABLE graph_base; +DROP TABLE graph; + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result b/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result new file mode 100644 index 00000000..642c0aa3 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1213120.result @@ -0,0 +1,1345 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); +INSERT INTO graph_base(from_id, to_id) VALUES (5,7); +INSERT INTO graph_base(from_id, to_id) VALUES (9,9); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +INSERT INTO graph_base(from_id, to_id) VALUES (11,12); +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); +# Return all edges +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +# Currently count should be 13 +SELECT count(*) FROM graph; +count(*) +13 +SELECT count(*) FROM graph_base; +count(*) +13 +# Return all edges when latch is NULL - this is different to latch='' and same as no where clause +SELECT * FROM graph where latch is NULL; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +# Return all vertices, and subsets of vertices +SELECT * FROM graph where latch=''; +latch origid destid weight seq linkid + NULL NULL NULL NULL 1 + NULL NULL NULL NULL 2 + NULL NULL NULL NULL 3 + NULL NULL NULL NULL 4 + NULL NULL NULL NULL 5 + NULL NULL NULL NULL 6 + NULL NULL NULL NULL 7 + NULL NULL NULL NULL 9 + NULL NULL NULL NULL 10 + NULL NULL NULL NULL 11 + NULL NULL NULL NULL 12 +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +# Currently count should be 11 +SELECT count(*) FROM graph where latch=''; +count(*) +11 +SELECT * FROM graph where latch='' and linkid = 2; +latch origid destid weight seq linkid + NULL NULL NULL NULL 2 +SELECT * FROM graph where latch='' and (linkid > 2 and linkid < 6); +latch origid destid weight seq linkid + NULL NULL NULL NULL 3 + NULL NULL NULL NULL 4 + NULL NULL NULL NULL 5 +SELECT * FROM graph where latch='' and linkid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph where latch='' and linkid = 666; +latch origid destid weight seq linkid +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 1; +from to +1 3 +1 2 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 2; +from to +2 1 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 4; +from to +4 3 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 9; +from to +9 9 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 10; +from to +10 11 +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = NULL; +from to +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 666; +from to +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 1; +from to +3 1 +2 1 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 2; +from to +1 2 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 4; +from to +3 4 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 9; +from to +9 9 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 10; +from to +12 10 +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = NULL; +from to +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 666; +from to +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +SELECT count(*) FROM graph where latch='0'; +count(*) +11 +SELECT * FROM graph where latch='0' and linkid = 2; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 2 +SELECT * FROM graph where latch='0' and (linkid > 2 and linkid < 6); +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 1; +from to +1 3 +1 2 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 2; +from to +2 1 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 4; +from to +4 3 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 9; +from to +9 9 +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 10; +from to +10 11 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 1; +from to +3 1 +2 1 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 2; +from to +1 2 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 4; +from to +3 4 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 9; +from to +9 9 +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 10; +from to +12 10 +# Breadth-first search tests +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +breadth_first 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 3 4 4 +breadth_first 2 NULL 2 3 3 +breadth_first 2 NULL 1 2 1 +breadth_first 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3; +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +breadth_first 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4; +latch origid destid weight seq linkid +breadth_first 4 NULL 3 4 2 +breadth_first 4 NULL 2 3 1 +breadth_first 4 NULL 1 2 3 +breadth_first 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5; +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +breadth_first 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6; +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +breadth_first 6 NULL 1 2 5 +breadth_first 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7; +latch origid destid weight seq linkid +breadth_first 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9; +latch origid destid weight seq linkid +breadth_first 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10; +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +breadth_first 10 NULL 1 2 11 +breadth_first 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11; +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +breadth_first 11 NULL 1 2 12 +breadth_first 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12; +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +breadth_first 12 NULL 1 2 10 +breadth_first 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +latch origid destid weight seq linkid +breadth_first 12 NULL 1 2 10 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +count(*) +1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 2 NULL 2 3 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 4 NULL 2 3 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 2; +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 3; +latch origid destid weight seq linkid +breadth_first 2 NULL 3 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 3; +latch origid destid weight seq linkid +breadth_first 4 NULL 3 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 1 NULL 2 4 4 +breadth_first 1 NULL 1 3 3 +breadth_first 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 2 NULL 2 3 3 +breadth_first 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 3 NULL 2 4 2 +breadth_first 3 NULL 1 3 4 +breadth_first 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 4 NULL 2 3 1 +breadth_first 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 5 NULL 1 3 7 +breadth_first 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 6 NULL 2 3 7 +breadth_first 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 10 NULL 2 3 12 +breadth_first 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 11 NULL 2 3 10 +breadth_first 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +breadth_first 12 NULL 2 3 11 +breadth_first 12 NULL 1 2 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 2 4 4 +breadth_first NULL 1 1 3 3 +breadth_first NULL 1 1 2 2 +breadth_first NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 3 4 4 +breadth_first NULL 2 2 3 3 +breadth_first NULL 2 1 2 1 +breadth_first NULL 2 0 1 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3; +latch origid destid weight seq linkid +breadth_first NULL 3 2 4 2 +breadth_first NULL 3 1 3 4 +breadth_first NULL 3 1 2 1 +breadth_first NULL 3 0 1 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4; +latch origid destid weight seq linkid +breadth_first NULL 4 3 4 2 +breadth_first NULL 4 2 3 1 +breadth_first NULL 4 1 2 3 +breadth_first NULL 4 0 1 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; +latch origid destid weight seq linkid +breadth_first NULL 5 1 2 6 +breadth_first NULL 5 0 1 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; +latch origid destid weight seq linkid +breadth_first NULL 6 1 2 5 +breadth_first NULL 6 0 1 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; +latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +breadth_first NULL 7 1 2 5 +breadth_first NULL 7 0 1 7 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9; +latch origid destid weight seq linkid +breadth_first NULL 9 0 1 9 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; +latch origid destid weight seq linkid +breadth_first NULL 10 2 3 11 +breadth_first NULL 10 1 2 12 +breadth_first NULL 10 0 1 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; +latch origid destid weight seq linkid +breadth_first NULL 11 2 3 12 +breadth_first NULL 11 1 2 10 +breadth_first NULL 11 0 1 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; +latch origid destid weight seq linkid +breadth_first NULL 12 2 3 10 +breadth_first NULL 12 1 2 11 +breadth_first NULL 12 0 1 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 1 1 3 3 +breadth_first NULL 1 1 2 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 2 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 3 1 3 4 +breadth_first NULL 3 1 2 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 4 1 2 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 5 1 2 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 6 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 7 1 2 5 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 10 1 2 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 11 1 2 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; +latch origid destid weight seq linkid +breadth_first NULL 12 1 2 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 1 2 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 2 2 3 3 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 3 2 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 4 2 3 1 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 7 2 3 6 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 10 2 3 11 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 11 2 3 12 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; +latch origid destid weight seq linkid +breadth_first NULL 12 2 3 10 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; +latch origid destid weight seq linkid +breadth_first NULL 2 3 4 4 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 3; +latch origid destid weight seq linkid +breadth_first NULL 4 3 4 2 +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = 'breadth_first'; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +2 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 2; +latch origid destid weight seq linkid +2 2 NULL 3 4 4 +2 2 NULL 2 3 3 +2 2 NULL 1 2 1 +2 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 3; +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +2 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 4; +latch origid destid weight seq linkid +2 4 NULL 3 4 2 +2 4 NULL 2 3 1 +2 4 NULL 1 2 3 +2 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 5; +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +2 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 6; +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +2 6 NULL 1 2 5 +2 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 7; +latch origid destid weight seq linkid +2 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch = '2' AND origid = 8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9; +latch origid destid weight seq linkid +2 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch = '2' AND origid = 10; +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +2 10 NULL 1 2 11 +2 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch = '2' AND origid = 11; +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +2 11 NULL 1 2 12 +2 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 12; +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +2 12 NULL 1 2 10 +2 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +latch origid destid weight seq linkid +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +latch origid destid weight seq linkid +2 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +latch origid destid weight seq linkid +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +latch origid destid weight seq linkid +2 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +latch origid destid weight seq linkid +2 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +latch origid destid weight seq linkid +2 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +latch origid destid weight seq linkid +2 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +latch origid destid weight seq linkid +2 12 NULL 1 2 10 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +count(*) +2 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +count(*) +0 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +count(*) +1 +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +count(*) +1 +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 2; +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 2; +latch origid destid weight seq linkid +2 2 NULL 2 3 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 2; +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 2; +latch origid destid weight seq linkid +2 4 NULL 2 3 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 2; +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 2; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 2; +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 2; +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 2; +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 3; +latch origid destid weight seq linkid +2 2 NULL 3 4 4 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 3; +latch origid destid weight seq linkid +2 4 NULL 3 4 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 3; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 1 NULL 2 4 4 +2 1 NULL 1 3 3 +2 1 NULL 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 2 NULL 2 3 3 +2 2 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 3 NULL 2 4 2 +2 3 NULL 1 3 4 +2 3 NULL 1 2 1 +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 4 NULL 2 3 1 +2 4 NULL 1 2 3 +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 5 NULL 1 3 7 +2 5 NULL 1 2 6 +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 6 NULL 2 3 7 +2 6 NULL 1 2 5 +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 10 NULL 2 3 12 +2 10 NULL 1 2 11 +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 11 NULL 2 3 10 +2 11 NULL 1 2 12 +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND (weight = 1 or weight = 2); +latch origid destid weight seq linkid +2 12 NULL 2 3 11 +2 12 NULL 1 2 10 +SELECT * FROM graph WHERE latch = '2' AND destid = 1; +latch origid destid weight seq linkid +2 NULL 1 2 4 4 +2 NULL 1 1 3 3 +2 NULL 1 1 2 2 +2 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch = '2' AND destid = 12; +latch origid destid weight seq linkid +2 NULL 12 2 3 10 +2 NULL 12 1 2 11 +2 NULL 12 0 1 12 +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; +latch origid destid weight seq linkid +2 NULL 1 1 3 3 +2 NULL 1 1 2 2 +SELECT * FROM graph WHERE latch = '2' AND origid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND destid = NULL; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2' AND weight = 1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch = '2'; +latch origid destid weight seq linkid +# Dijkstras algorithm tests +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=1; +latch origid destid weight seq linkid +dijkstras 1 1 NULL 0 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +dijkstras 1 2 NULL 0 1 +dijkstras 1 2 1 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2 AND destid=1; +latch origid destid weight seq linkid +dijkstras 2 1 NULL 0 2 +dijkstras 2 1 1 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +dijkstras 1 4 NULL 0 1 +dijkstras 1 4 1 1 3 +dijkstras 1 4 1 2 4 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4 AND destid=1; +latch origid destid weight seq linkid +dijkstras 4 1 NULL 0 4 +dijkstras 4 1 1 1 3 +dijkstras 4 1 1 2 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5 AND destid=7; +latch origid destid weight seq linkid +dijkstras 5 7 NULL 0 5 +dijkstras 5 7 1 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +dijkstras 10 11 NULL 0 10 +dijkstras 10 11 1 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +dijkstras 10 12 NULL 0 10 +dijkstras 10 12 1 1 11 +dijkstras 10 12 1 2 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=10; +latch origid destid weight seq linkid +dijkstras 11 10 NULL 0 11 +dijkstras 11 10 1 1 12 +dijkstras 11 10 1 2 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=12; +latch origid destid weight seq linkid +dijkstras 11 12 NULL 0 11 +dijkstras 11 12 1 1 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=10; +latch origid destid weight seq linkid +dijkstras 12 10 NULL 0 12 +dijkstras 12 10 1 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=11; +latch origid destid weight seq linkid +dijkstras 12 11 NULL 0 12 +dijkstras 12 11 1 1 10 +dijkstras 12 11 1 2 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2; +latch origid destid weight seq linkid +dijkstras 2 NULL 3 4 4 +dijkstras 2 NULL 2 3 3 +dijkstras 2 NULL 1 2 1 +dijkstras 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=3; +latch origid destid weight seq linkid +dijkstras 3 NULL 2 4 2 +dijkstras 3 NULL 1 3 4 +dijkstras 3 NULL 1 2 1 +dijkstras 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4; +latch origid destid weight seq linkid +dijkstras 4 NULL 3 4 2 +dijkstras 4 NULL 2 3 1 +dijkstras 4 NULL 1 2 3 +dijkstras 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5; +latch origid destid weight seq linkid +dijkstras 5 NULL 1 3 7 +dijkstras 5 NULL 1 2 6 +dijkstras 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6; +latch origid destid weight seq linkid +dijkstras 6 NULL 2 3 7 +dijkstras 6 NULL 1 2 5 +dijkstras 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7; +latch origid destid weight seq linkid +dijkstras 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND origid=9; +latch origid destid weight seq linkid +dijkstras 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10; +latch origid destid weight seq linkid +dijkstras 10 NULL 2 3 12 +dijkstras 10 NULL 1 2 11 +dijkstras 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11; +latch origid destid weight seq linkid +dijkstras 11 NULL 2 3 10 +dijkstras 11 NULL 1 2 12 +dijkstras 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12; +latch origid destid weight seq linkid +dijkstras 12 NULL 2 3 11 +dijkstras 12 NULL 1 2 10 +dijkstras 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +latch origid destid weight seq linkid +dijkstras NULL 1 2 4 4 +dijkstras NULL 1 1 3 3 +dijkstras NULL 1 1 2 2 +dijkstras NULL 1 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=2; +latch origid destid weight seq linkid +dijkstras NULL 2 3 4 4 +dijkstras NULL 2 2 3 3 +dijkstras NULL 2 1 2 1 +dijkstras NULL 2 0 1 2 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=3; +latch origid destid weight seq linkid +dijkstras NULL 3 2 4 2 +dijkstras NULL 3 1 3 4 +dijkstras NULL 3 1 2 1 +dijkstras NULL 3 0 1 3 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=4; +latch origid destid weight seq linkid +dijkstras NULL 4 3 4 2 +dijkstras NULL 4 2 3 1 +dijkstras NULL 4 1 2 3 +dijkstras NULL 4 0 1 4 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; +latch origid destid weight seq linkid +dijkstras NULL 5 1 2 6 +dijkstras NULL 5 0 1 5 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; +latch origid destid weight seq linkid +dijkstras NULL 6 1 2 5 +dijkstras NULL 6 0 1 6 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; +latch origid destid weight seq linkid +dijkstras NULL 7 2 3 6 +dijkstras NULL 7 1 2 5 +dijkstras NULL 7 0 1 7 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='dijkstras' AND destid=9; +latch origid destid weight seq linkid +dijkstras NULL 9 0 1 9 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; +latch origid destid weight seq linkid +dijkstras NULL 10 2 3 11 +dijkstras NULL 10 1 2 12 +dijkstras NULL 10 0 1 10 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; +latch origid destid weight seq linkid +dijkstras NULL 11 2 3 12 +dijkstras NULL 11 1 2 10 +dijkstras NULL 11 0 1 11 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; +latch origid destid weight seq linkid +dijkstras NULL 12 2 3 10 +dijkstras NULL 12 1 2 11 +dijkstras NULL 12 0 1 12 +# legacy string number +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; +latch origid destid weight seq linkid +1 1 1 NULL 0 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=2; +latch origid destid weight seq linkid +1 1 2 NULL 0 1 +1 1 2 1 1 2 +SELECT * FROM graph WHERE latch='1' AND origid=2 AND destid=1; +latch origid destid weight seq linkid +1 2 1 NULL 0 2 +1 2 1 1 1 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=4; +latch origid destid weight seq linkid +1 1 4 NULL 0 1 +1 1 4 1 1 3 +1 1 4 1 2 4 +SELECT * FROM graph WHERE latch='1' AND origid=4 AND destid=1; +latch origid destid weight seq linkid +1 4 1 NULL 0 4 +1 4 1 1 1 3 +1 4 1 1 2 1 +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=5 AND destid=7; +latch origid destid weight seq linkid +1 5 7 NULL 0 5 +1 5 7 1 1 7 +SELECT * FROM graph WHERE latch='1' AND origid=7 AND destid=5; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=11; +latch origid destid weight seq linkid +1 10 11 NULL 0 10 +1 10 11 1 1 11 +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=12; +latch origid destid weight seq linkid +1 10 12 NULL 0 10 +1 10 12 1 1 11 +1 10 12 1 2 12 +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=10; +latch origid destid weight seq linkid +1 11 10 NULL 0 11 +1 11 10 1 1 12 +1 11 10 1 2 10 +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=12; +latch origid destid weight seq linkid +1 11 12 NULL 0 11 +1 11 12 1 1 12 +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=10; +latch origid destid weight seq linkid +1 12 10 NULL 0 12 +1 12 10 1 1 10 +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=11; +latch origid destid weight seq linkid +1 12 11 NULL 0 12 +1 12 11 1 1 10 +1 12 11 1 2 11 +SELECT * FROM graph WHERE latch='1' AND origid=1; +latch origid destid weight seq linkid +1 1 NULL 2 4 4 +1 1 NULL 1 3 3 +1 1 NULL 1 2 2 +1 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='1' AND origid=2; +latch origid destid weight seq linkid +1 2 NULL 3 4 4 +1 2 NULL 2 3 3 +1 2 NULL 1 2 1 +1 2 NULL 0 1 2 +SELECT * FROM graph WHERE latch='1' AND origid=3; +latch origid destid weight seq linkid +1 3 NULL 2 4 2 +1 3 NULL 1 3 4 +1 3 NULL 1 2 1 +1 3 NULL 0 1 3 +SELECT * FROM graph WHERE latch='1' AND origid=4; +latch origid destid weight seq linkid +1 4 NULL 3 4 2 +1 4 NULL 2 3 1 +1 4 NULL 1 2 3 +1 4 NULL 0 1 4 +SELECT * FROM graph WHERE latch='1' AND origid=5; +latch origid destid weight seq linkid +1 5 NULL 1 3 7 +1 5 NULL 1 2 6 +1 5 NULL 0 1 5 +SELECT * FROM graph WHERE latch='1' AND origid=6; +latch origid destid weight seq linkid +1 6 NULL 2 3 7 +1 6 NULL 1 2 5 +1 6 NULL 0 1 6 +SELECT * FROM graph WHERE latch='1' AND origid=7; +latch origid destid weight seq linkid +1 7 NULL 0 1 7 +SELECT * FROM graph WHERE latch='1' AND origid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=9; +latch origid destid weight seq linkid +1 9 NULL 0 1 9 +SELECT * FROM graph WHERE latch='1' AND origid=10; +latch origid destid weight seq linkid +1 10 NULL 2 3 12 +1 10 NULL 1 2 11 +1 10 NULL 0 1 10 +SELECT * FROM graph WHERE latch='1' AND origid=11; +latch origid destid weight seq linkid +1 11 NULL 2 3 10 +1 11 NULL 1 2 12 +1 11 NULL 0 1 11 +SELECT * FROM graph WHERE latch='1' AND origid=12; +latch origid destid weight seq linkid +1 12 NULL 2 3 11 +1 12 NULL 1 2 10 +1 12 NULL 0 1 12 +SELECT * FROM graph WHERE latch='1' AND origid=666; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND destid=1; +latch origid destid weight seq linkid +1 NULL 1 2 4 4 +1 NULL 1 1 3 3 +1 NULL 1 1 2 2 +1 NULL 1 0 1 1 +SELECT * FROM graph WHERE latch='1' AND destid=2; +latch origid destid weight seq linkid +1 NULL 2 3 4 4 +1 NULL 2 2 3 3 +1 NULL 2 1 2 1 +1 NULL 2 0 1 2 +SELECT * FROM graph WHERE latch='1' AND destid=3; +latch origid destid weight seq linkid +1 NULL 3 2 4 2 +1 NULL 3 1 3 4 +1 NULL 3 1 2 1 +1 NULL 3 0 1 3 +SELECT * FROM graph WHERE latch='1' AND destid=4; +latch origid destid weight seq linkid +1 NULL 4 3 4 2 +1 NULL 4 2 3 1 +1 NULL 4 1 2 3 +1 NULL 4 0 1 4 +SELECT * FROM graph WHERE latch='1' AND destid=5; +latch origid destid weight seq linkid +1 NULL 5 1 2 6 +1 NULL 5 0 1 5 +SELECT * FROM graph WHERE latch='1' AND destid=6; +latch origid destid weight seq linkid +1 NULL 6 1 2 5 +1 NULL 6 0 1 6 +SELECT * FROM graph WHERE latch='1' AND destid=7; +latch origid destid weight seq linkid +1 NULL 7 2 3 6 +1 NULL 7 1 2 5 +1 NULL 7 0 1 7 +SELECT * FROM graph WHERE latch='1' AND destid=8; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND destid=9; +latch origid destid weight seq linkid +1 NULL 9 0 1 9 +SELECT * FROM graph WHERE latch='1' AND destid=10; +latch origid destid weight seq linkid +1 NULL 10 2 3 11 +1 NULL 10 1 2 12 +1 NULL 10 0 1 10 +SELECT * FROM graph WHERE latch='1' AND destid=11; +latch origid destid weight seq linkid +1 NULL 11 2 3 12 +1 NULL 11 1 2 10 +1 NULL 11 0 1 11 +SELECT * FROM graph WHERE latch='1' AND destid=12; +latch origid destid weight seq linkid +1 NULL 12 2 3 10 +1 NULL 12 1 2 11 +1 NULL 12 0 1 12 +SELECT count(*) FROM graph; +count(*) +13 +SELECT count(*) FROM graph_base; +count(*) +13 +INSERT INTO graph_base(from_id, to_id) VALUES (11,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,14); +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 11 +dijkstras 10 13 1 2 13 +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 14 +dijkstras 10 13 1 2 13 +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +latch origid destid weight seq linkid +dijkstras 10 13 NULL 0 10 +dijkstras 10 13 1 1 11 +dijkstras 10 13 1 2 13 +SELECT count(*) FROM graph; +count(*) +18 +SELECT count(*) FROM graph_base; +count(*) +18 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=21; +latch origid destid weight seq linkid +dijkstras 21 NULL 1 2 22 +dijkstras 21 NULL 0 1 21 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=22; +latch origid destid weight seq linkid +dijkstras 22 NULL 0 1 22 +INSERT INTO graph_base(from_id, to_id) VALUES (4,17); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 3 5 17 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (4,16); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 3 6 17 +dijkstras 1 NULL 3 5 16 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +INSERT INTO graph_base(from_id, to_id) VALUES (17,18); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +latch origid destid weight seq linkid +dijkstras 1 NULL 4 7 18 +dijkstras 1 NULL 3 6 17 +dijkstras 1 NULL 3 5 16 +dijkstras 1 NULL 2 4 4 +dijkstras 1 NULL 1 3 3 +dijkstras 1 NULL 1 2 2 +dijkstras 1 NULL 0 1 1 +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +latch origid destid weight seq linkid +dijkstras NULL 1 2 4 4 +dijkstras NULL 1 1 3 3 +dijkstras NULL 1 1 2 2 +dijkstras NULL 1 0 1 1 +# Now we add a connection from 4->6 +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 15 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +NULL 11 13 1 NULL NULL +NULL 10 14 1 NULL NULL +NULL 14 13 1 NULL NULL +NULL 15 13 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 21 22 1 NULL NULL +NULL 4 17 1 NULL NULL +NULL 4 16 1 NULL NULL +NULL 17 18 1 NULL NULL +NULL 4 6 1 NULL NULL +SELECT count(*) FROM graph; +count(*) +23 +SELECT count(*) FROM graph_base; +count(*) +23 +# And delete all references to node 5 +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; +# which means there is a path in one direction only 1>3>4>6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +dijkstras 1 6 NULL 0 1 +dijkstras 1 6 1 1 3 +dijkstras 1 6 1 2 4 +dijkstras 1 6 1 3 6 +# but not 6>4>3>1 (so no result) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6 AND destid=1; +latch origid destid weight seq linkid +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +1 1 6 NULL 0 1 +1 1 6 1 1 3 +1 1 6 1 2 4 +1 1 6 1 3 6 +SELECT * FROM graph WHERE latch='1' AND origid=6 AND destid=1; +latch origid destid weight seq linkid +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1213120.test b/storage/oqgraph/mysql-test/oqgraph/regression_1213120.test new file mode 100644 index 00000000..0f11f91c --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1213120.test @@ -0,0 +1,548 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph2; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + +#-- +#-- ASCII art graph of this test data +#-- +-->(2) +#-- ( )<---+ +#-- (1) +#-- ( )<---+ +#-- +-->(3)<------->(4) +#-- +#-- (7)<----------(5)<--------->(6) (9) +#-- +#-- +--->(11) +#-- | | +#-- (10) | +#-- ^ v +#-- +----(12) + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); + +#-- extra unidirected node +INSERT INTO graph_base(from_id, to_id) VALUES (5,7); + +#-- isolated node with no loop - disallowed +#-- so origid 8 below should return an empty rowset +#-- INSERT INTO graph_base(from_id, to_id) VALUES (8,NULL); + +#-- isolated node with a (undirected) loop +#-- we have no way of representing a directed loop on an isolated node, is this valid in pure graph theory? +INSERT INTO graph_base(from_id, to_id) VALUES (9,9); + +#-- directed _cyclic_ graph triangle? +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +INSERT INTO graph_base(from_id, to_id) VALUES (11,12); +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); + +--echo # Return all edges +#-- we note that when weight is NULL it defaults to 1 +SELECT * FROM graph; +--echo # Currently count should be 13 +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +--echo # Return all edges when latch is NULL - this is different to latch='' and same as no where clause +SELECT * FROM graph where latch is NULL; + +--echo # Return all vertices, and subsets of vertices +SELECT * FROM graph where latch=''; +SELECT * FROM graph where latch='0'; + +--echo # Currently count should be 11 + +SELECT count(*) FROM graph where latch=''; +#-- get a subset of vertices +SELECT * FROM graph where latch='' and linkid = 2; +SELECT * FROM graph where latch='' and (linkid > 2 and linkid < 6); +SELECT * FROM graph where latch='' and linkid = NULL; +SELECT * FROM graph where latch='' and linkid = 666; + +#-- Query out-edges for vertex (no_search AND origid=N) +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 1; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 2; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 4; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 9; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 10; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = NULL; +SELECT origid as `from`, linkid as `to` FROM graph where latch='' and origid = 666; + +#-- Query in-edges for vertex (no_search AND destid=N) +#-- linkid will have the other end +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 1; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 2; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 4; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 9; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 10; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = NULL; +SELECT linkid as `from`, destid as `to` FROM graph where latch='' and destid = 666; + +# The following returns a result that makes no sense... +#-- what happens when we combined orig and dest? +#-- Bug https://bugs.launchpad.net/oqgraph/+bug/1195778 +#SELECT * FROM graph where latch='' and origid = 1; +#SELECT * FROM graph where latch='' and destid = 2; +#SELECT * FROM graph where latch='' and origid=1 and destid = 2; + +SELECT * FROM graph where latch='0'; +SELECT count(*) FROM graph where latch='0'; +SELECT * FROM graph where latch='0' and linkid = 2; +SELECT * FROM graph where latch='0' and (linkid > 2 and linkid < 6); +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 1; +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 2; +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 4; +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 9; +SELECT origid as `from`, linkid as `to` FROM graph where latch='0' and origid = 10; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 1; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 2; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 4; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 9; +SELECT linkid as `from`, destid as `to` FROM graph where latch='0' and destid = 10; + +--echo # Breadth-first search tests +#-- We are asking "Is there a path from node 'origid' to (all) other nodes?" +#-- We return a row for each other node that is reachable, with its id in 'linkid' +#-- and the weight calculated as "How many _directed_ hops to get there" +#-- If there is no path from origid to another node then there is no row for that linkid +#-- We include 'origid' in the set of reachable nodes i.e. as a 'loop', with weight 0 +#-- 'seq' is the counted distance of the search, thus, the loop link will always have seq 1 +#-- if there are two reachable neighbours, they will have seq 2,3 and so on +#-- linkid is the other end +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 666; # <-- note, should return nothing +#-- The above results can then be filtered by weight, so the results should be a subset for the corresponding origid above +#-- so effectively, `AND weight=1` returns the neighbours of origid in linkid +#<----- orig test harness - still returns (breadth_first 1 NULL 1 3 3), (breadth_first 1 NULL 1 2 2) +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +#-- so effectively, `count(... AND weight=1)` returns the number of _reachable_ immediate neighbours +#-- included because it allows human to quickly eyeball against the visual ASCII graph for correctness... +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 1; # <-- note, should return nothing +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 1; +#-- so effectively, `AND weight=2` returns the second-level neighbours of origid in linkid +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 2; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND weight = 3; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND weight = 3; + +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 1 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 2 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 3 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 4 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 5 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 6 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 7 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 8 AND (weight = 1 or weight = 2); # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 9 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 10 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 11 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = 12 AND (weight = 1 or weight = 2); + +#-- now do it in reverse - using destid find originating vertices +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 1; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 2; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 2; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 1 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 2 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 3 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 4 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 5 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 6 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 7 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 8 and weight = 3; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 9 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 10 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 11 and weight = 3; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = 12 and weight = 3; + +#-- These return empty sets - origid or destid must be specified and non null to get a result set +SELECT * FROM graph WHERE latch = 'breadth_first' AND origid = NULL; +SELECT * FROM graph WHERE latch = 'breadth_first' AND destid = NULL; +SELECT * FROM graph WHERE latch = 'breadth_first' AND weight = 1; +SELECT * FROM graph WHERE latch = 'breadth_first'; + +#-- Repeat the above with legacy string +SELECT * FROM graph WHERE latch = '2' AND origid = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 4; +SELECT * FROM graph WHERE latch = '2' AND origid = 5; +SELECT * FROM graph WHERE latch = '2' AND origid = 6; +SELECT * FROM graph WHERE latch = '2' AND origid = 7; +SELECT * FROM graph WHERE latch = '2' AND origid = 8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9; +SELECT * FROM graph WHERE latch = '2' AND origid = 10; +SELECT * FROM graph WHERE latch = '2' AND origid = 11; +SELECT * FROM graph WHERE latch = '2' AND origid = 12; +SELECT * FROM graph WHERE latch = '2' AND origid = 666; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 1 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 2 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 3 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 4 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 5 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 6 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 7 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 8 AND weight = 1; # <-- note, should return nothing +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 9 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 10 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 11 AND weight = 1; +SELECT count(*) FROM graph WHERE latch = '2' AND origid = 12 AND weight = 1; +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 2; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 2; +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND weight = 3; # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND weight = 3; +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND weight = 3; + +SELECT * FROM graph WHERE latch = '2' AND origid = 1 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 2 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 3 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 4 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 5 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 6 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 7 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 8 AND (weight = 1 or weight = 2); # <-- note, should return nothing +SELECT * FROM graph WHERE latch = '2' AND origid = 9 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 10 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 11 AND (weight = 1 or weight = 2); +SELECT * FROM graph WHERE latch = '2' AND origid = 12 AND (weight = 1 or weight = 2); + +SELECT * FROM graph WHERE latch = '2' AND destid = 1; + +SELECT * FROM graph WHERE latch = '2' AND destid = 12; +SELECT * FROM graph WHERE latch = '2' AND destid = 1 and weight = 1; + + +#-- These return empty sets - origid must be specified and non null to get a result set +SELECT * FROM graph WHERE latch = '2' AND origid = NULL; +SELECT * FROM graph WHERE latch = '2' AND destid = NULL; +SELECT * FROM graph WHERE latch = '2' AND weight = 1; +SELECT * FROM graph WHERE latch = '2'; + + +--echo # Dijkstras algorithm tests +#-- We ask 'What is the shortest path (if any) between 'origid' and 'destid' +#-- This returns the number of directed hops +1 (for the starting node) +#-- 'weight' is NULL for the starting point, or 1 +#-- 'linkid' is the way point id +#-- 'seq' is the distance of the waypoint from the start (counting from zero) +#-- the default order returned is waypoints out from the start +#-- zero hop (1 row) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=1; +#-- one hop +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=2; +#-- one hop in reverse +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2 AND destid=1; +#-- two hops (via 3) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=4; +#-- two hops in reverse direction +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4 AND destid=1; +#-- no result (no connection) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=5; +#-- no result (no destination exists) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=666; + +#-- one hop on a unidirected link +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5 AND destid=7; +#-- zero hop in reverse direction on a unidirected link +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7 AND destid=5; + +#-- Trickery - what about the cyclic loop? +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=11; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=12; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=10; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11 AND destid=12; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=10; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12 AND destid=11; + +#-- reachable vertices +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=2; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=3; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=4; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=5; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=7; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='dijkstras' AND origid=9; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=11; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=12; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=666; # <-- note, should return nothing + +#-- originating vertices +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=2; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=3; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=4; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=5; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=6; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=7; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='dijkstras' AND destid=9; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=10; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=11; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=12; + +--echo # legacy string number +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=1; +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=2; +SELECT * FROM graph WHERE latch='1' AND origid=2 AND destid=1; +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=4; +SELECT * FROM graph WHERE latch='1' AND origid=4 AND destid=1; +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=5; +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=666; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='1' AND origid=5 AND destid=7; +SELECT * FROM graph WHERE latch='1' AND origid=7 AND destid=5; +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=11; +SELECT * FROM graph WHERE latch='1' AND origid=10 AND destid=12; +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=10; +SELECT * FROM graph WHERE latch='1' AND origid=11 AND destid=12; +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=10; +SELECT * FROM graph WHERE latch='1' AND origid=12 AND destid=11; +SELECT * FROM graph WHERE latch='1' AND origid=1; +SELECT * FROM graph WHERE latch='1' AND origid=2; +SELECT * FROM graph WHERE latch='1' AND origid=3; +SELECT * FROM graph WHERE latch='1' AND origid=4; +SELECT * FROM graph WHERE latch='1' AND origid=5; +SELECT * FROM graph WHERE latch='1' AND origid=6; +SELECT * FROM graph WHERE latch='1' AND origid=7; +SELECT * FROM graph WHERE latch='1' AND origid=8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='1' AND origid=9; +SELECT * FROM graph WHERE latch='1' AND origid=10; +SELECT * FROM graph WHERE latch='1' AND origid=11; +SELECT * FROM graph WHERE latch='1' AND origid=12; +SELECT * FROM graph WHERE latch='1' AND origid=666; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='1' AND destid=1; +SELECT * FROM graph WHERE latch='1' AND destid=2; +SELECT * FROM graph WHERE latch='1' AND destid=3; +SELECT * FROM graph WHERE latch='1' AND destid=4; +SELECT * FROM graph WHERE latch='1' AND destid=5; +SELECT * FROM graph WHERE latch='1' AND destid=6; +SELECT * FROM graph WHERE latch='1' AND destid=7; +SELECT * FROM graph WHERE latch='1' AND destid=8; # <-- note, should return nothing +SELECT * FROM graph WHERE latch='1' AND destid=9; +SELECT * FROM graph WHERE latch='1' AND destid=10; +SELECT * FROM graph WHERE latch='1' AND destid=11; +SELECT * FROM graph WHERE latch='1' AND destid=12; + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +#-- What if we add two equally valid two-hop paths? +#-- +#-- +#-- +--->(14)----------+ +#-- | v +#-- | +--->(11)---->(13) +#-- | | | +#-- +-(10) | +#-- ^ v +#-- +----(12) +#-- +#-- We note it chooses 10,11,13 but will it always? +INSERT INTO graph_base(from_id, to_id) VALUES (11,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,14); +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +#-- We note is _appears_ to use the lowered valued node id if there are two equal paths +SELECT * FROM graph WHERE latch='dijkstras' AND origid=10 AND destid=13; + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +#-- add some extra and check +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=21; +SELECT * FROM graph WHERE latch='dijkstras' AND origid=22; +INSERT INTO graph_base(from_id, to_id) VALUES (4,17); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +INSERT INTO graph_base(from_id, to_id) VALUES (4,16); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +INSERT INTO graph_base(from_id, to_id) VALUES (17,18); +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1; +SELECT * FROM graph WHERE latch='dijkstras' AND destid=1; + +--echo # Now we add a connection from 4->6 +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); + +SELECT * FROM graph; + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +--echo # And delete all references to node 5 +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; + +#-- The following queries would currently return incorrect results +#-- 6 rows instead of 21 +#-- Maybe manifestation of https://bugs.launchpad.net/oqgraph/+bug/796647 +#-- SELECT count(*) FROM graph; +#-- SELECT count(*) FROM graph_base; + +--echo # which means there is a path in one direction only 1>3>4>6 +SELECT * FROM graph WHERE latch='dijkstras' AND origid=1 AND destid=6; +--echo # but not 6>4>3>1 (so no result) +SELECT * FROM graph WHERE latch='dijkstras' AND origid=6 AND destid=1; + +SELECT * FROM graph WHERE latch='1' AND origid=1 AND destid=6; +SELECT * FROM graph WHERE latch='1' AND origid=6 AND destid=1; + +DELETE FROM graph_base; + +#-- The following line would hang mysqld currently, see bug https://bugs.launchpad.net/oqgraph/+bug/1195735 +#-- SELECT * FROM graph; + +FLUSH TABLES; +TRUNCATE TABLE graph_base; + +DROP TABLE graph_base; +DROP TABLE graph; + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1233113.result b/storage/oqgraph/mysql-test/oqgraph/regression_1233113.result new file mode 100644 index 00000000..2b0ea4b2 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1233113.result @@ -0,0 +1,26 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +call mtr.add_suppression("graph_base is open on delete"); +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,2), (2,3); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +update graph set origid=123; +ERROR HY000: Table 'graph' is read only +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_1233113.test b/storage/oqgraph/mysql-test/oqgraph/regression_1233113.test new file mode 100644 index 00000000..db53b2b3 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_1233113.test @@ -0,0 +1,40 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +call mtr.add_suppression("graph_base is open on delete"); + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,2), (2,3); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); + +# The following line crashes when MTR run with --gdb, see bug https://bugs.launchpad.net/oqgraph/+bug/1233113 +--error 1036 +update graph set origid=123; + +# Otherwise, MTR hangs on the next line +DROP TABLE graph_base; +DROP TABLE graph; + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_796647.result b/storage/oqgraph/mysql-test/oqgraph/regression_796647.result new file mode 100644 index 00000000..36bd00b8 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_796647.result @@ -0,0 +1,40 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +von INT NOT NULL, +nach INT NOT NULL, +weight DOUBLE NOT NULL, +PRIMARY KEY (von,nach), +INDEX (von) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='von' DESTID='nach' WEIGHT='weight'; +INSERT INTO graph_base(von,nach,weight) VALUES (3,5,2), (5,4,1), (5,6,1); +SELECT * FROM graph_base; +von nach weight +3 5 2 +5 4 1 +5 6 1 +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 3 5 2 NULL NULL +NULL 5 4 1 NULL NULL +NULL 5 6 1 NULL NULL +INSERT INTO graph_base(von,nach,weight) VALUES (6,3,1); +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 3 5 2 NULL NULL +NULL 5 4 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 3 1 NULL NULL +FLUSH TABLES; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_796647.test b/storage/oqgraph/mysql-test/oqgraph/regression_796647.test new file mode 100644 index 00000000..aaecee74 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_796647.test @@ -0,0 +1,43 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + + +# Create the backing store +CREATE TABLE graph_base ( + von INT NOT NULL, + nach INT NOT NULL, + weight DOUBLE NOT NULL, + PRIMARY KEY (von,nach), + INDEX (von) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='von' DESTID='nach' WEIGHT='weight'; + +INSERT INTO graph_base(von,nach,weight) VALUES (3,5,2), (5,4,1), (5,6,1); + +SELECT * FROM graph_base; + +SELECT * FROM graph; + +INSERT INTO graph_base(von,nach,weight) VALUES (6,3,1); + +SELECT * FROM graph; + +FLUSH TABLES; + +DROP TABLE graph_base; +DROP TABLE graph; + + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_796647b.result b/storage/oqgraph/mysql-test/oqgraph/regression_796647b.result new file mode 100644 index 00000000..2a5e632b --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_796647b.result @@ -0,0 +1,221 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); +SELECT count(*) FROM graph; +count(*) +8 +SELECT count(*) FROM graph_base; +count(*) +8 +INSERT INTO graph_base(from_id, to_id) VALUES (5,7); +INSERT INTO graph_base(from_id, to_id) VALUES (9,9); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +INSERT INTO graph_base(from_id, to_id) VALUES (11,12); +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); +SELECT count(*) FROM graph; +count(*) +13 +SELECT count(*) FROM graph_base; +count(*) +13 +INSERT INTO graph_base(from_id, to_id) VALUES (11,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,14); +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); +SELECT count(*) FROM graph; +count(*) +16 +SELECT count(*) FROM graph_base; +count(*) +16 +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +SELECT count(*) FROM graph; +count(*) +18 +SELECT count(*) FROM graph_base; +count(*) +18 +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +INSERT INTO graph_base(from_id, to_id) VALUES (4,17); +INSERT INTO graph_base(from_id, to_id) VALUES (4,16); +INSERT INTO graph_base(from_id, to_id) VALUES (17,18); +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); +SELECT count(*) FROM graph; +count(*) +23 +SELECT count(*) FROM graph_base; +count(*) +23 +SELECT * from graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 5 6 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 5 7 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 15 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +NULL 11 13 1 NULL NULL +NULL 10 14 1 NULL NULL +NULL 14 13 1 NULL NULL +NULL 15 13 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 21 22 1 NULL NULL +NULL 4 17 1 NULL NULL +NULL 4 16 1 NULL NULL +NULL 17 18 1 NULL NULL +NULL 4 6 1 NULL NULL +SELECT * from graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 7 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 15 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +0 NULL NULL NULL NULL 13 +0 NULL NULL NULL NULL 14 +0 NULL NULL NULL NULL 21 +0 NULL NULL NULL NULL 22 +0 NULL NULL NULL NULL 17 +0 NULL NULL NULL NULL 16 +0 NULL NULL NULL NULL 18 +SELECT * from graph_base; +from_id to_id +1 2 +1 3 +2 1 +3 1 +3 4 +4 3 +4 6 +4 16 +4 17 +5 6 +5 7 +6 5 +9 9 +10 11 +10 14 +10 15 +11 12 +11 13 +12 10 +14 13 +15 13 +17 18 +21 22 +# And delete all references to node 5 +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; +# This is currently bogus: +SELECT count(*) FROM graph; +count(*) +21 +SELECT count(*) FROM graph_base; +count(*) +21 +SELECT * from graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +NULL 1 3 1 NULL NULL +NULL 3 1 1 NULL NULL +NULL 3 4 1 NULL NULL +NULL 4 3 1 NULL NULL +NULL 6 5 1 NULL NULL +NULL 9 9 1 NULL NULL +NULL 10 15 1 NULL NULL +NULL 11 12 1 NULL NULL +NULL 12 10 1 NULL NULL +NULL 11 13 1 NULL NULL +NULL 10 14 1 NULL NULL +NULL 14 13 1 NULL NULL +NULL 15 13 1 NULL NULL +NULL 10 11 1 NULL NULL +NULL 21 22 1 NULL NULL +NULL 4 17 1 NULL NULL +NULL 4 16 1 NULL NULL +NULL 17 18 1 NULL NULL +NULL 4 6 1 NULL NULL +SELECT * from graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 3 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 6 +0 NULL NULL NULL NULL 5 +0 NULL NULL NULL NULL 9 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 15 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 12 +0 NULL NULL NULL NULL 13 +0 NULL NULL NULL NULL 14 +0 NULL NULL NULL NULL 21 +0 NULL NULL NULL NULL 22 +0 NULL NULL NULL NULL 17 +0 NULL NULL NULL NULL 16 +0 NULL NULL NULL NULL 18 +SELECT * from graph_base; +from_id to_id +1 2 +1 3 +2 1 +3 1 +3 4 +4 3 +4 6 +4 16 +4 17 +6 5 +9 9 +10 11 +10 14 +10 15 +11 12 +11 13 +12 10 +14 13 +15 13 +17 18 +21 22 +DELETE FROM graph_base; +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_796647b.test b/storage/oqgraph/mysql-test/oqgraph/regression_796647b.test new file mode 100644 index 00000000..c3b81fd0 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_796647b.test @@ -0,0 +1,97 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +INSERT INTO graph_base(from_id, to_id) VALUES (1,3), (3,1); +INSERT INTO graph_base(from_id, to_id) VALUES (3,4), (4,3); +INSERT INTO graph_base(from_id, to_id) VALUES (5,6), (6,5); + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +INSERT INTO graph_base(from_id, to_id) VALUES (5,7); +INSERT INTO graph_base(from_id, to_id) VALUES (9,9); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +INSERT INTO graph_base(from_id, to_id) VALUES (11,12); +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +INSERT INTO graph_base(from_id, to_id) VALUES (11,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,14); +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +INSERT INTO graph_base(from_id, to_id) VALUES (4,17); +INSERT INTO graph_base(from_id, to_id) VALUES (4,16); +INSERT INTO graph_base(from_id, to_id) VALUES (17,18); +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); + +#-- Without this when the line immediately after gets executed +#-- we get a segfault +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; +SELECT * from graph; +SELECT * from graph where latch='0'; +SELECT * from graph_base; + +--echo # And delete all references to node 5 +DELETE FROM graph_base WHERE from_id=5; +DELETE FROM graph_base WHERE from_id=3 AND to_id=5; + +#-- The following queries would currently return incorrect results +#-- 6 rows instead of 21 +#-- Maybe manifestation of https://bugs.launchpad.net/oqgraph/+bug/796647 +--echo # This is currently bogus: +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; +SELECT * from graph; +SELECT * from graph where latch='0'; +SELECT * from graph_base; + +DELETE FROM graph_base; + +#-- The following line would hang mysqld currently, see bug https://bugs.launchpad.net/oqgraph/+bug/1195735 +#-- SELECT * FROM graph; + +FLUSH TABLES; +TRUNCATE TABLE graph_base; + +DROP TABLE graph_base; +DROP TABLE graph; + + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_796647c.result b/storage/oqgraph/mysql-test/oqgraph/regression_796647c.result new file mode 100644 index 00000000..d648e7ff --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_796647c.result @@ -0,0 +1,127 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +SELECT count(*) FROM graph; +count(*) +2 +SELECT count(*) FROM graph_base; +count(*) +2 +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); +SELECT count(*) FROM graph; +count(*) +3 +SELECT count(*) FROM graph_base; +count(*) +3 +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); +SELECT count(*) FROM graph; +count(*) +4 +SELECT count(*) FROM graph_base; +count(*) +4 +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); +SELECT count(*) FROM graph; +count(*) +7 +SELECT count(*) FROM graph_base; +count(*) +7 +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); +SELECT count(*) FROM graph; +count(*) +9 +SELECT count(*) FROM graph_base; +count(*) +9 +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 1 +0 NULL NULL NULL NULL 2 +0 NULL NULL NULL NULL 12 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 14 +0 NULL NULL NULL NULL 13 +0 NULL NULL NULL NULL 15 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 21 +0 NULL NULL NULL NULL 22 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 6 +SELECT * FROM graph_base; +from_id to_id +1 2 +2 1 +4 6 +10 11 +10 15 +12 10 +14 13 +15 13 +21 22 +# And delete all references to node 2 +DELETE FROM graph_base WHERE from_id=2; +DELETE FROM graph_base WHERE to_id=2; +SELECT count(*) FROM graph; +count(*) +7 +SELECT count(*) FROM graph_base; +count(*) +7 +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +0 NULL NULL NULL NULL 12 +0 NULL NULL NULL NULL 10 +0 NULL NULL NULL NULL 14 +0 NULL NULL NULL NULL 13 +0 NULL NULL NULL NULL 15 +0 NULL NULL NULL NULL 11 +0 NULL NULL NULL NULL 21 +0 NULL NULL NULL NULL 22 +0 NULL NULL NULL NULL 4 +0 NULL NULL NULL NULL 6 +SELECT * FROM graph_base; +from_id to_id +4 6 +10 11 +10 15 +12 10 +14 13 +15 13 +21 22 +DELETE FROM graph_base; +SELECT count(*) FROM graph; +count(*) +0 +SELECT count(*) FROM graph_base; +count(*) +0 +SELECT * FROM graph where latch='0'; +latch origid destid weight seq linkid +SELECT * FROM graph_base; +from_id to_id +FLUSH TABLES; +TRUNCATE TABLE graph_base; +DROP TABLE graph_base; +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_796647c.test b/storage/oqgraph/mysql-test/oqgraph/regression_796647c.test new file mode 100644 index 00000000..e0406122 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_796647c.test @@ -0,0 +1,84 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +INSERT INTO graph_base(from_id, to_id) VALUES (12,10); + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +INSERT INTO graph_base(from_id, to_id) VALUES (14,13); + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +DELETE FROM graph_base where from_id=10 and to_id=11; +INSERT INTO graph_base(from_id, to_id) VALUES (10,15); +INSERT INTO graph_base(from_id, to_id) VALUES (15,13); +INSERT INTO graph_base(from_id, to_id) VALUES (10,11); + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; + +INSERT INTO graph_base(from_id, to_id) VALUES (21,22); +INSERT INTO graph_base (from_id,to_id) VALUES (4,6); + +#-- Without this when the line immediately after gets executed +#-- we get a segfault +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; +SELECT * FROM graph where latch='0'; +SELECT * FROM graph_base; + +--echo # And delete all references to node 2 +DELETE FROM graph_base WHERE from_id=2; +DELETE FROM graph_base WHERE to_id=2; + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; +SELECT * FROM graph where latch='0'; +SELECT * FROM graph_base; + +DELETE FROM graph_base; + +SELECT count(*) FROM graph; +SELECT count(*) FROM graph_base; +SELECT * FROM graph where latch='0'; +SELECT * FROM graph_base; + +#-- The following line would hang mysqld currently, see bug https://bugs.launchpad.net/oqgraph/+bug/1195735 +#-- SELECT * FROM graph; + +FLUSH TABLES; +TRUNCATE TABLE graph_base; + +DROP TABLE graph_base; +DROP TABLE graph; + + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_drop_after.result b/storage/oqgraph/mysql-test/oqgraph/regression_drop_after.result new file mode 100644 index 00000000..cace2c40 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_drop_after.result @@ -0,0 +1,29 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +call mtr.add_suppression("graph_base is open on delete"); +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +DROP TABLE graph_base; +FLUSH TABLES; +SELECT * FROM graph; +ERROR 42S02: Table 'test.graph_base' doesn't exist +DROP TABLE graph; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_drop_after.test b/storage/oqgraph/mysql-test/oqgraph/regression_drop_after.test new file mode 100644 index 00000000..673eb867 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_drop_after.test @@ -0,0 +1,40 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +call mtr.add_suppression("graph_base is open on delete"); + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +SELECT * FROM graph; +DROP TABLE graph_base; +FLUSH TABLES; # <-- without this, we still had it open so never see error... +--error S42S02 +SELECT * FROM graph; +DROP TABLE graph; + +# gdb script: +# bre ha_oqgraph::rnd_init +# ignore 1 1 +# run diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.opt b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.opt new file mode 100644 index 00000000..a4548161 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.opt @@ -0,0 +1 @@ +--query_cache_type=ON diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.result new file mode 100644 index 00000000..731c6726 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.result @@ -0,0 +1,42 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +call mtr.add_suppression("graph_base is open on delete"); +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); +SET @query_cache_size.saved = @@query_cache_size; +SET GLOBAL query_cache_size = 1024*1024; +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 1 2 1 NULL NULL +NULL 2 1 1 NULL NULL +UPDATE graph_base SET to_id = 20 WHERE from_id = 1; +SELECT * FROM graph; +latch origid destid weight seq linkid +NULL 1 20 1 NULL NULL +NULL 2 1 1 NULL NULL +SELECT SQL_NO_CACHE * FROM graph; +latch origid destid weight seq linkid +NULL 1 20 1 NULL NULL +NULL 2 1 1 NULL NULL +SET GLOBAL query_cache_size = 0; +SELECT SQL_NO_CACHE * FROM graph; +latch origid destid weight seq linkid +NULL 1 20 1 NULL NULL +NULL 2 1 1 NULL NULL +DROP TABLE graph_base, graph; +SET GLOBAL query_cache_size = @query_cache_size.saved; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.test new file mode 100644 index 00000000..19cbfe7d --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5744.test @@ -0,0 +1,50 @@ +# Regression test for https://mariadb.atlassian.net/browse/MDEV-5744 +#--reproduce bug where changes to backing table data are not reflected +# in a graph table due to query caching + +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +call mtr.add_suppression("graph_base is open on delete"); + +# Create the backing store +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + + +CREATE TABLE graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id', DESTID='to_id'; + + +INSERT INTO graph_base(from_id, to_id) VALUES (1,2), (2,1); + +SET @query_cache_size.saved = @@query_cache_size; +SET GLOBAL query_cache_size = 1024*1024; + +SELECT * FROM graph; +UPDATE graph_base SET to_id = 20 WHERE from_id = 1; + +SELECT * FROM graph; +SELECT SQL_NO_CACHE * FROM graph; + +SET GLOBAL query_cache_size = 0; + +SELECT SQL_NO_CACHE * FROM graph; + +DROP TABLE graph_base, graph; +SET GLOBAL query_cache_size = @query_cache_size.saved; + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.result new file mode 100644 index 00000000..d2dfc46d --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.result @@ -0,0 +1,86 @@ +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +CREATE TABLE graph_base ( +from_id INT UNSIGNED NOT NULL, +to_id INT UNSIGNED NOT NULL, +weight DOUBLE NOT NULL, +PRIMARY KEY (from_id,to_id), +INDEX (to_id) +) ENGINE=MyISAM; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id'; +DESCRIBE graph; +Field Type Null Key Default Extra +latch varchar(32) YES MUL NULL +origid bigint(20) unsigned YES NULL +destid bigint(20) unsigned YES NULL +weight double YES NULL +seq bigint(20) unsigned YES NULL +linkid bigint(20) unsigned YES NULL +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id' WEIGHT='weight'; +DESCRIBE graph; +Field Type Null Key Default Extra +latch varchar(32) YES MUL NULL +origid bigint(20) unsigned YES NULL +destid bigint(20) unsigned YES NULL +weight double YES NULL +seq bigint(20) unsigned YES NULL +linkid bigint(20) unsigned YES NULL +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base_xxx' ORIGID='from_id' DESTID='to_id_xxx' WEIGHT='weight'; +# Expect 'Table 'test.graph_base_xxx' doesn't exist' +DESCRIBE graph; +ERROR 42S02: Table 'test.graph_base_xxx' doesn't exist +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id' WEIGHT='weight_xxx'; +# Expect 'Invalid OQGRAPH backing store description ('graph.weight' attribute not set to a valid column of 'graph_base')' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('graph.weight' attribute not set to a valid column of 'graph_base')' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id_xxx' WEIGHT='weight'; +# Expect 'Invalid OQGRAPH backing store description ('graph.destid' attribute not set to a valid column of 'graph_base')' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('graph.destid' attribute not set to a valid column of 'graph_base')' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id_xxx' DESTID='to_id' WEIGHT='weight'; +# Expect 'Invalid OQGRAPH backing store description ('graph.origid' attribute not set to a valid column of 'graph_base')' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store ('graph.origid' attribute not set to a valid column of 'graph_base')' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' DESTID='to_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH ORIGID='from_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH DESTID='to_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +CREATE TABLE graph ENGINE=OQGRAPH ORIGID='from_id', DESTID='to_id'; +# Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +DESCRIBE graph; +ERROR HY000: Got error -1 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' from OQGRAPH +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph_base; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test new file mode 100644 index 00000000..15d1eff0 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5871.test @@ -0,0 +1,121 @@ +--disable_warnings +DROP TABLE IF EXISTS graph_base; +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph_base ( + from_id INT UNSIGNED NOT NULL, + to_id INT UNSIGNED NOT NULL, + weight DOUBLE NOT NULL, + PRIMARY KEY (from_id,to_id), + INDEX (to_id) + ) ENGINE=MyISAM; + +# Since late June 2014 OQGraph supports 'assisted discovery' as per https://mariadb.atlassian.net/browse/MDEV-5871 + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id'; +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id' WEIGHT='weight'; +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base_xxx' ORIGID='from_id' DESTID='to_id_xxx' WEIGHT='weight'; +--echo # Expect 'Table 'test.graph_base_xxx' doesn't exist' +--error 1146 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id' WEIGHT='weight_xxx'; +--echo # Expect 'Invalid OQGRAPH backing store description ('graph.weight' attribute not set to a valid column of 'graph_base')' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id' DESTID='to_id_xxx' WEIGHT='weight'; +--echo # Expect 'Invalid OQGRAPH backing store description ('graph.destid' attribute not set to a valid column of 'graph_base')' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id_xxx' DESTID='to_id' WEIGHT='weight'; +--echo # Expect 'Invalid OQGRAPH backing store description ('graph.origid' attribute not set to a valid column of 'graph_base')' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +# The following combinations should be invalid +CREATE TABLE graph ENGINE=OQGRAPH; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' ORIGID='from_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty destid attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DATA_TABLE='graph_base' DESTID='to_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty origid attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH ORIGID='from_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH DESTID='to_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +CREATE TABLE graph ENGINE=OQGRAPH ORIGID='from_id', DESTID='to_id'; +--echo # Expect: 'Invalid OQGRAPH backing store description (unspecified or empty data_table attribute)' +--error 1296 +DESCRIBE graph; +--disable_warnings +DROP TABLE IF EXISTS graph; +--enable_warnings + +--disable_warnings +DROP TABLE IF EXISTS graph; +DROP TABLE IF EXISTS graph_base; +--enable_warnings + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.inc b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.inc new file mode 100644 index 00000000..c0e4aa75 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.inc @@ -0,0 +1,53 @@ +# Regression test for https://mariadb.atlassian.net/browse/MDEV-5996 +--echo Performing OQGraph regression test mdev5996 - using db=`$oqgraph_database_name`, table=`$oqgraph_table_name` + +--disable_warnings +use test; +if ($oqgraph_database_name) { + eval drop database if exists `$oqgraph_database_name` ; + eval create database `$oqgraph_database_name` ; + eval use `$oqgraph_database_name` ; +} +eval drop table if exists `$oqgraph_table_name` ; +drop table if exists vvvvvvv_hhhhhhh; +--enable_warnings + +eval CREATE TABLE `$oqgraph_table_name` ( + `version` varchar(10) NOT NULL, + `updateJSON` mediumtext, + `prevVersion` varchar(10) NOT NULL, + `nodeID` bigint(20) unsigned NOT NULL DEFAULT '0', + `prevNodeID` bigint(20) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`prevNodeID`,`nodeID`), + KEY `prevVersion` (`prevVersion`) USING BTREE, + KEY `version` (`version`) USING BTREE, + KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +eval insert into `$oqgraph_table_name` values ( 'x', 'y', 'z', 0, 0); + +eval select * from `$oqgraph_table_name`; + +eval CREATE TABLE IF NOT EXISTS vvvvvvv_hhhhhhh ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH + data_table='$oqgraph_table_name' + origid='prevNodeID' + destid='nodeID'; + +select * from vvvvvvv_hhhhhhh; + +eval drop table if exists `$oqgraph_table_name`; +drop table if exists vvvvvvv_hhhhhhh; + +if ($oqgraph_database_name) { + eval drop database if exists `$oqgraph_database_name`; +} + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.result new file mode 100644 index 00000000..39e476b2 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.result @@ -0,0 +1,284 @@ +call mtr.add_suppression("99999999 is open on delete"); +Performing OQGraph regression test mdev5996 - using db=``, table=`999999999` +use test; +drop table if exists `999999999` ; +drop table if exists vvvvvvv_hhhhhhh; +CREATE TABLE `999999999` ( +`version` varchar(10) NOT NULL, +`updateJSON` mediumtext, +`prevVersion` varchar(10) NOT NULL, +`nodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +`prevNodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (`prevNodeID`,`nodeID`), +KEY `prevVersion` (`prevVersion`) USING BTREE, +KEY `version` (`version`) USING BTREE, +KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +insert into `999999999` values ( 'x', 'y', 'z', 0, 0); +select * from `999999999`; +version updateJSON prevVersion nodeID prevNodeID +x y z 0 0 +CREATE TABLE IF NOT EXISTS vvvvvvv_hhhhhhh ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='999999999' + origid='prevNodeID' + destid='nodeID'; +select * from vvvvvvv_hhhhhhh; +latch origid destid weight seq linkid +NULL 0 0 1 NULL NULL +drop table if exists `999999999`; +drop table if exists vvvvvvv_hhhhhhh; +Performing OQGraph regression test mdev5996 - using db=`1`, table=`999999999` +use test; +drop database if exists `1` ; +create database `1` ; +use `1` ; +drop table if exists `999999999` ; +drop table if exists vvvvvvv_hhhhhhh; +CREATE TABLE `999999999` ( +`version` varchar(10) NOT NULL, +`updateJSON` mediumtext, +`prevVersion` varchar(10) NOT NULL, +`nodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +`prevNodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (`prevNodeID`,`nodeID`), +KEY `prevVersion` (`prevVersion`) USING BTREE, +KEY `version` (`version`) USING BTREE, +KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +insert into `999999999` values ( 'x', 'y', 'z', 0, 0); +select * from `999999999`; +version updateJSON prevVersion nodeID prevNodeID +x y z 0 0 +CREATE TABLE IF NOT EXISTS vvvvvvv_hhhhhhh ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='999999999' + origid='prevNodeID' + destid='nodeID'; +select * from vvvvvvv_hhhhhhh; +latch origid destid weight seq linkid +NULL 0 0 1 NULL NULL +drop table if exists `999999999`; +drop table if exists vvvvvvv_hhhhhhh; +drop database if exists `1`; +Performing OQGraph regression test mdev5996 - using db=`1112222233_4444444`, table=`999999999` +use test; +drop database if exists `1112222233_4444444` ; +create database `1112222233_4444444` ; +use `1112222233_4444444` ; +drop table if exists `999999999` ; +drop table if exists vvvvvvv_hhhhhhh; +CREATE TABLE `999999999` ( +`version` varchar(10) NOT NULL, +`updateJSON` mediumtext, +`prevVersion` varchar(10) NOT NULL, +`nodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +`prevNodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (`prevNodeID`,`nodeID`), +KEY `prevVersion` (`prevVersion`) USING BTREE, +KEY `version` (`version`) USING BTREE, +KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +insert into `999999999` values ( 'x', 'y', 'z', 0, 0); +select * from `999999999`; +version updateJSON prevVersion nodeID prevNodeID +x y z 0 0 +CREATE TABLE IF NOT EXISTS vvvvvvv_hhhhhhh ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='999999999' + origid='prevNodeID' + destid='nodeID'; +select * from vvvvvvv_hhhhhhh; +latch origid destid weight seq linkid +NULL 0 0 1 NULL NULL +drop table if exists `999999999`; +drop table if exists vvvvvvv_hhhhhhh; +drop database if exists `1112222233_4444444`; +Performing OQGraph regression test mdev5996 - using db=`1112222233_44444444`, table=`999999999` +use test; +drop database if exists `1112222233_44444444` ; +create database `1112222233_44444444` ; +use `1112222233_44444444` ; +drop table if exists `999999999` ; +drop table if exists vvvvvvv_hhhhhhh; +CREATE TABLE `999999999` ( +`version` varchar(10) NOT NULL, +`updateJSON` mediumtext, +`prevVersion` varchar(10) NOT NULL, +`nodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +`prevNodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (`prevNodeID`,`nodeID`), +KEY `prevVersion` (`prevVersion`) USING BTREE, +KEY `version` (`version`) USING BTREE, +KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +insert into `999999999` values ( 'x', 'y', 'z', 0, 0); +select * from `999999999`; +version updateJSON prevVersion nodeID prevNodeID +x y z 0 0 +CREATE TABLE IF NOT EXISTS vvvvvvv_hhhhhhh ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='999999999' + origid='prevNodeID' + destid='nodeID'; +select * from vvvvvvv_hhhhhhh; +latch origid destid weight seq linkid +NULL 0 0 1 NULL NULL +drop table if exists `999999999`; +drop table if exists vvvvvvv_hhhhhhh; +drop database if exists `1112222233_44444444`; +Performing OQGraph regression test mdev5996 - using db=`1112222233_444444444`, table=`999999999` +use test; +drop database if exists `1112222233_444444444` ; +create database `1112222233_444444444` ; +use `1112222233_444444444` ; +drop table if exists `999999999` ; +drop table if exists vvvvvvv_hhhhhhh; +CREATE TABLE `999999999` ( +`version` varchar(10) NOT NULL, +`updateJSON` mediumtext, +`prevVersion` varchar(10) NOT NULL, +`nodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +`prevNodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (`prevNodeID`,`nodeID`), +KEY `prevVersion` (`prevVersion`) USING BTREE, +KEY `version` (`version`) USING BTREE, +KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +insert into `999999999` values ( 'x', 'y', 'z', 0, 0); +select * from `999999999`; +version updateJSON prevVersion nodeID prevNodeID +x y z 0 0 +CREATE TABLE IF NOT EXISTS vvvvvvv_hhhhhhh ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='999999999' + origid='prevNodeID' + destid='nodeID'; +select * from vvvvvvv_hhhhhhh; +latch origid destid weight seq linkid +NULL 0 0 1 NULL NULL +drop table if exists `999999999`; +drop table if exists vvvvvvv_hhhhhhh; +drop database if exists `1112222233_444444444`; +Performing OQGraph regression test mdev5996 - using db=`1112222233_444444444`, table=`99999999` +use test; +drop database if exists `1112222233_444444444` ; +create database `1112222233_444444444` ; +use `1112222233_444444444` ; +drop table if exists `99999999` ; +drop table if exists vvvvvvv_hhhhhhh; +CREATE TABLE `99999999` ( +`version` varchar(10) NOT NULL, +`updateJSON` mediumtext, +`prevVersion` varchar(10) NOT NULL, +`nodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +`prevNodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (`prevNodeID`,`nodeID`), +KEY `prevVersion` (`prevVersion`) USING BTREE, +KEY `version` (`version`) USING BTREE, +KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +insert into `99999999` values ( 'x', 'y', 'z', 0, 0); +select * from `99999999`; +version updateJSON prevVersion nodeID prevNodeID +x y z 0 0 +CREATE TABLE IF NOT EXISTS vvvvvvv_hhhhhhh ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='99999999' + origid='prevNodeID' + destid='nodeID'; +select * from vvvvvvv_hhhhhhh; +latch origid destid weight seq linkid +NULL 0 0 1 NULL NULL +drop table if exists `99999999`; +drop table if exists vvvvvvv_hhhhhhh; +drop database if exists `1112222233_444444444`; +Performing OQGraph regression test mdev5996 - using db=`1112222233_444444444`, table=`9999999999` +use test; +drop database if exists `1112222233_444444444` ; +create database `1112222233_444444444` ; +use `1112222233_444444444` ; +drop table if exists `9999999999` ; +drop table if exists vvvvvvv_hhhhhhh; +CREATE TABLE `9999999999` ( +`version` varchar(10) NOT NULL, +`updateJSON` mediumtext, +`prevVersion` varchar(10) NOT NULL, +`nodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +`prevNodeID` bigint(20) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (`prevNodeID`,`nodeID`), +KEY `prevVersion` (`prevVersion`) USING BTREE, +KEY `version` (`version`) USING BTREE, +KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +insert into `9999999999` values ( 'x', 'y', 'z', 0, 0); +select * from `9999999999`; +version updateJSON prevVersion nodeID prevNodeID +x y z 0 0 +CREATE TABLE IF NOT EXISTS vvvvvvv_hhhhhhh ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH +data_table='9999999999' + origid='prevNodeID' + destid='nodeID'; +select * from vvvvvvv_hhhhhhh; +latch origid destid weight seq linkid +NULL 0 0 1 NULL NULL +drop table if exists `9999999999`; +drop table if exists vvvvvvv_hhhhhhh; +drop database if exists `1112222233_444444444`; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.test new file mode 100644 index 00000000..cb4563a5 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev5996.test @@ -0,0 +1,35 @@ +# Regression test for https://mariadb.atlassian.net/browse/MDEV-5996 +# MidSchipDB_unstable +--let $oqgraph_table_name= 999999999 + +call mtr.add_suppression("99999999 is open on delete"); + +--let $oqgraph_database_name= +--source regression_mdev5996.inc + +--let $oqgraph_database_name= 1 +--source regression_mdev5996.inc + +# Various cases - although actual bug was a broken zero termination +# name of backing store shorter, same and longer than table + +--let $oqgraph_database_name= 1112222233_4444444 +--source regression_mdev5996.inc + +--let $oqgraph_database_name= 1112222233_44444444 +--source regression_mdev5996.inc + +--let $oqgraph_database_name= 1112222233_444444444 +--source regression_mdev5996.inc + +--let $oqgraph_table_name= 99999999 +--source regression_mdev5996.inc + +--let $oqgraph_table_name= 9999999999 +--source regression_mdev5996.inc + +# Fails: + +# 1/9999 +# test/99999999 +# 1112222233_444444444/999999999 diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result new file mode 100644 index 00000000..3ef61cc3 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.result @@ -0,0 +1,43 @@ +connect con1,localhost,root,,test; +CREATE TABLE `db_history` ( +`version` VARCHAR(10) NOT NULL, +`updateJSON` MEDIUMTEXT, +`prevVersion` VARCHAR(10) NOT NULL, +`nodeID` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', +`prevNodeID` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', +PRIMARY KEY (`prevNodeID`,`nodeID`), +KEY `version` (`version`) USING BTREE, +KEY `prevVersion` (`prevVersion`) USING BTREE, +KEY `nodeID` (`nodeID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; +INSERT INTO `db_history` VALUES +('0.0.1','{}','0.0.0',1,0), +('0.0.2','{\"data\":{\"add\":{},\"update\":{},\"delete\":{}}}','0.0.1',2,1), +('0.0.3','{\"data\":{\"add\":{},\"update\":{},\"delete\":{}}}','0.0.2',3,2); +CREATE TABLE IF NOT EXISTS version_history ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH DATA_TABLE='db_history' ORIGID='prevNodeID' DESTID='nodeID'; +SELECT `db`.`version`, `db`.`nodeID` +FROM `version_history` AS `v` INNER JOIN `db_history` AS `db` ON `db`.`nodeID` = `v`.`linkid` +WHERE `latch` = 'breadth_first' AND `origid` = '1' ORDER BY `weight` DESC LIMIT 1; +version nodeID +0.0.3 3 +disconnect con1; +connect con2,localhost,root,,test; +SELECT `db`.`version`, `db`.`nodeID` +FROM `version_history` AS `v` INNER JOIN `db_history` AS `db` ON `db`.`nodeID` = `v`.`linkid` +WHERE `latch` = 'breadth_first' AND `origid` = '1' ORDER BY `weight` DESC LIMIT 1; +version nodeID +0.0.3 3 +disconnect con2; +connect con3,localhost,root,,test; +DROP TABLE version_history; +DROP TABLE db_history; +disconnect con3; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test new file mode 100644 index 00000000..b8f0ae55 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6282.test @@ -0,0 +1,47 @@ +--connect (con1,localhost,root,,test) + + CREATE TABLE `db_history` ( + `version` VARCHAR(10) NOT NULL, + `updateJSON` MEDIUMTEXT, + `prevVersion` VARCHAR(10) NOT NULL, + `nodeID` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', + `prevNodeID` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0', + PRIMARY KEY (`prevNodeID`,`nodeID`), + KEY `version` (`version`) USING BTREE, + KEY `prevVersion` (`prevVersion`) USING BTREE, + KEY `nodeID` (`nodeID`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + + INSERT INTO `db_history` VALUES + ('0.0.1','{}','0.0.0',1,0), + ('0.0.2','{\"data\":{\"add\":{},\"update\":{},\"delete\":{}}}','0.0.1',2,1), + ('0.0.3','{\"data\":{\"add\":{},\"update\":{},\"delete\":{}}}','0.0.2',3,2); + + CREATE TABLE IF NOT EXISTS version_history ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH + ) ENGINE=OQGRAPH DATA_TABLE='db_history' ORIGID='prevNodeID' DESTID='nodeID'; + + SELECT `db`.`version`, `db`.`nodeID` + FROM `version_history` AS `v` INNER JOIN `db_history` AS `db` ON `db`.`nodeID` = `v`.`linkid` + WHERE `latch` = 'breadth_first' AND `origid` = '1' ORDER BY `weight` DESC LIMIT 1; +--disconnect con1 + +--connect (con2,localhost,root,,test) + SELECT `db`.`version`, `db`.`nodeID` + FROM `version_history` AS `v` INNER JOIN `db_history` AS `db` ON `db`.`nodeID` = `v`.`linkid` + WHERE `latch` = 'breadth_first' AND `origid` = '1' ORDER BY `weight` DESC LIMIT 1; +--disconnect con2 + +--connect (con3,localhost,root,,test) +DROP TABLE version_history; +DROP TABLE db_history; +--disconnect con3 + + diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result new file mode 100644 index 00000000..68002ce9 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.result @@ -0,0 +1,12 @@ +DROP TABLE IF EXISTS oq_backing; +DROP TABLE IF EXISTS oq_graph; +CREATE TABLE oq_backing (origid INT UNSIGNED NOT NULL, destid INT UNSIGNED NOT NULL, PRIMARY KEY (origid, destid), KEY (destid)); +INSERT INTO oq_backing(origid, destid) VALUES (1,2), (2,3), (3,4), (4,5), (2,6), (5,6); +CREATE TABLE oq_graph (latch VARCHAR(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH) ENGINE=OQGRAPH data_table='oq_backing' origid='origid' destid='destid'; +SELECT * FROM oq_graph WHERE latch='breadth_first' AND origid=1 AND destid=6; +latch origid destid weight seq linkid +breadth_first 1 6 NULL 0 1 +breadth_first 1 6 1 1 2 +breadth_first 1 6 1 2 6 +DROP TABLE IF EXISTS oq_graph; +DROP TABLE IF EXISTS oq_backing; diff --git a/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test new file mode 100644 index 00000000..fefd03a7 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/regression_mdev6345.test @@ -0,0 +1,19 @@ +#-- This test is probably not right, because the real bug manifested over a network connection on a busy server. + +--disable_warnings +DROP TABLE IF EXISTS oq_backing; +DROP TABLE IF EXISTS oq_graph; +--enable_warnings + + +CREATE TABLE oq_backing (origid INT UNSIGNED NOT NULL, destid INT UNSIGNED NOT NULL, PRIMARY KEY (origid, destid), KEY (destid)); + +INSERT INTO oq_backing(origid, destid) VALUES (1,2), (2,3), (3,4), (4,5), (2,6), (5,6); + +CREATE TABLE oq_graph (latch VARCHAR(32) NULL, origid BIGINT UNSIGNED NULL, destid BIGINT UNSIGNED NULL, weight DOUBLE NULL, seq BIGINT UNSIGNED NULL, linkid BIGINT UNSIGNED NULL, KEY (latch, origid, destid) USING HASH, KEY (latch, destid, origid) USING HASH) ENGINE=OQGRAPH data_table='oq_backing' origid='origid' destid='destid'; + +SELECT * FROM oq_graph WHERE latch='breadth_first' AND origid=1 AND destid=6; + +DROP TABLE IF EXISTS oq_graph; +DROP TABLE IF EXISTS oq_backing; + diff --git a/storage/oqgraph/mysql-test/oqgraph/social.result b/storage/oqgraph/mysql-test/oqgraph/social.result new file mode 100644 index 00000000..9b47701f --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/social.result @@ -0,0 +1,111 @@ +DROP TABLE IF EXISTS rsb, rsb_graph; +CREATE TABLE rsb ( +f INT UNSIGNED NOT NULL, +t INT UNSIGNED NOT NULL, +weight FLOAT NOT NULL, +PRIMARY KEY (`f`,`t`), +KEY `t` (`t`) +) ENGINE=MyISAM; +CREATE TABLE rsb_graph ( +latch VARCHAR(32) NULL, +origid BIGINT UNSIGNED NULL, +destid BIGINT UNSIGNED NULL, +weight DOUBLE NULL, +seq BIGINT UNSIGNED NULL, +linkid BIGINT UNSIGNED NULL, +KEY (latch, origid, destid) USING HASH, +KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH data_table='rsb' origid='f' destid='t' weight='weight'; +DROP PROCEDURE IF EXISTS randnotx| +CREATE PROCEDURE randnotx (INOUT rseed INT, IN items INT, IN x INT, OUT rval INT) DETERMINISTIC +BEGIN +REPEAT +# Simple LCG (BSD) +SET rseed = (rseed * 1103515245 + 12345) & 2147483647; +SET rval = ((rseed >> 16) & 32767) MOD items; +UNTIL rval <> x +END REPEAT; +END;| +DROP PROCEDURE IF EXISTS randgraphproc| +CREATE PROCEDURE randgraphproc (IN items INT, IN friends INT, IN fanof INT, IN maxweight INT) DETERMINISTIC +BEGIN +DECLARE i,j,weight,rseed,rval INT; +SET rseed = items; +SET i = 0; +WHILE i < items DO +SET j = 0; +WHILE j < (friends + fanof) DO +CALL randnotx(rseed,items,i,rval); +IF (maxweight > 0) THEN +CALL randnotx(rseed,items,-1,weight); +SET weight = weight MOD maxweight; +ELSE +SET weight = 0; +END IF; +INSERT IGNORE rsb VALUES (i,rval,weight); +IF (j < friends) THEN +INSERT IGNORE rsb VALUES (rval,i,weight); +END IF; +SET j = j + 1; +END WHILE; +SET i = i + 1; +END WHILE; +END;| +CALL randgraphproc(10000,5,2,3); +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1 AND destid=20; +GROUP_CONCAT(linkid ORDER BY seq) +1,5378,9993,8029,5613,9338,3730,7694,3546,9658,2825,6157,6461,1246,8678,8811,20 +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1 AND destid=77; +GROUP_CONCAT(linkid ORDER BY seq) +1,5378,9993,8029,5613,9338,3730,7694,3546,2367,9994,3130,9577,7992,7995,53,8735,8654,9850,587,177,6509,8447,6927,6690,5454,1277,77 +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1 AND destid=203; +GROUP_CONCAT(linkid ORDER BY seq) +1,5378,9993,8597,6078,2632,8846,6514,3189,8336,3327,4653,203 +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1595 AND destid=8358; +GROUP_CONCAT(linkid ORDER BY seq) +1595,6255,7652,394,1532,3451,5615,9737,5886,8214,7462,6984,5822,5711,6363,2743,8584,7759,8683,7525,1874,212,5923,2399,3138,740,932,8358 +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1 AND destid=9999; +GROUP_CONCAT(linkid ORDER BY seq) +1,5378,9993,8597,6078,2632,7381,6403,9177,1637,9762,2610,319,1310,3579,9999 +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=6841 AND destid=615; +GROUP_CONCAT(linkid ORDER BY seq) +6841,2979,9109,8306,7777,620,9982,8535,8151,6118,8654,9428,611,9696,3082,7219,9868,615 +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=369 AND destid=1845; +GROUP_CONCAT(linkid ORDER BY seq) +369,4586,6078,8597,9993,8029,5613,2993,1637,9177,3451,5615,9104,4004,2818,8311,8996,9023,9975,3847,4988,4480,6739,7520,6040,4585,7632,3956,1319,2427,6606,3443,9114,2907,1130,2389,8613,1534,4856,6961,6636,9136,7504,2777,8273,8215,7681,8859,1480,7167,663,3433,4719,3773,1845 +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=73 AND destid=914; +GROUP_CONCAT(linkid ORDER BY seq) +73,4247,9061,9994,3130,8274,9298,8790,8465,712,9028,646,1255,7384,6554,3193,914 +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=12345 AND destid=500; +GROUP_CONCAT(linkid ORDER BY seq) +NULL +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=300 AND destid=54321; +GROUP_CONCAT(linkid ORDER BY seq) +NULL +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND origid=1; +COUNT(*) +10000 +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND origid=8365; +COUNT(*) +10000 +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND origid=976; +COUNT(*) +10000 +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND origid=74; +COUNT(*) +10000 +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND destid=1; +COUNT(*) +10000 +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND destid=9999; +COUNT(*) +10000 +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND destid=52; +COUNT(*) +10000 +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND destid=6483; +COUNT(*) +10000 +DROP TABLE rsb_graph, rsb; +DROP PROCEDURE randgraphproc; +DROP PROCEDURE randnotx; diff --git a/storage/oqgraph/mysql-test/oqgraph/social.test b/storage/oqgraph/mysql-test/oqgraph/social.test new file mode 100644 index 00000000..a71b160c --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/social.test @@ -0,0 +1,134 @@ +# The test can take very long time with valgrind +--source include/not_valgrind.inc + +--disable_warnings +DROP TABLE IF EXISTS rsb, rsb_graph; +--enable_warnings + +CREATE TABLE rsb ( + f INT UNSIGNED NOT NULL, + t INT UNSIGNED NOT NULL, + weight FLOAT NOT NULL, + PRIMARY KEY (`f`,`t`), + KEY `t` (`t`) +) ENGINE=MyISAM; + +CREATE TABLE rsb_graph ( + latch VARCHAR(32) NULL, + origid BIGINT UNSIGNED NULL, + destid BIGINT UNSIGNED NULL, + weight DOUBLE NULL, + seq BIGINT UNSIGNED NULL, + linkid BIGINT UNSIGNED NULL, + KEY (latch, origid, destid) USING HASH, + KEY (latch, destid, origid) USING HASH +) ENGINE=OQGRAPH data_table='rsb' origid='f' destid='t' weight='weight'; + + +# this graph generator is designed to be deterministic +# (so we don't need to ship a large test dataset) +# --source suite/oqgraph/randgraphproc.inc + +# SQL implementation of randsocial.c for OQGRAPH +# Copyright (C) 2013 by Arjen Lentz <arjen@openquery.com> for Open Query +# GPL v2+ licensed with the rest of OQGRAPH +# for use in mysql-test +# 2013-03-01 first implementation based on randsocial.c in old oqgraph v2 tree + +delimiter |; +--disable_warnings +DROP PROCEDURE IF EXISTS randnotx| +--enable_warnings +CREATE PROCEDURE randnotx (INOUT rseed INT, IN items INT, IN x INT, OUT rval INT) DETERMINISTIC +BEGIN + REPEAT + # Simple LCG (BSD) + SET rseed = (rseed * 1103515245 + 12345) & 2147483647; + SET rval = ((rseed >> 16) & 32767) MOD items; + UNTIL rval <> x + END REPEAT; +END;| + + +# this procedure is deterministic with its private seeded random generator +--disable_warnings +DROP PROCEDURE IF EXISTS randgraphproc| +--enable_warnings +CREATE PROCEDURE randgraphproc (IN items INT, IN friends INT, IN fanof INT, IN maxweight INT) DETERMINISTIC +BEGIN + DECLARE i,j,weight,rseed,rval INT; + + SET rseed = items; + + SET i = 0; + WHILE i < items DO + SET j = 0; + WHILE j < (friends + fanof) DO + CALL randnotx(rseed,items,i,rval); + + IF (maxweight > 0) THEN + CALL randnotx(rseed,items,-1,weight); + SET weight = weight MOD maxweight; + ELSE + SET weight = 0; + END IF; + + INSERT IGNORE rsb VALUES (i,rval,weight); + + IF (j < friends) THEN + INSERT IGNORE rsb VALUES (rval,i,weight); + END IF; + + SET j = j + 1; + END WHILE; + + SET i = i + 1; + END WHILE; +END;| + +DELIMITER ;| + + +# generate social graph of 10000 people having 5 friends (two-way) and being fan of 2 others (one-way)), max weight 3 +CALL randgraphproc(10000,5,2,3); + +# some random paths +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1 AND destid=20; +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1 AND destid=77; +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1 AND destid=203; +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1595 AND destid=8358; +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=1 AND destid=9999; +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=6841 AND destid=615; +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=369 AND destid=1845; +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=73 AND destid=914; + +# nonexistent origin +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=12345 AND destid=500; + +# noexistent destination +SELECT GROUP_CONCAT(linkid ORDER BY seq) FROM rsb_graph WHERE latch='dijkstras' AND origid=300 AND destid=54321; + +# how many possible destinations from here +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND origid=1; +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND origid=8365; +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND origid=976; +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND origid=74; + +# how many possible sources to here +# this doesn't appear to work right now in v3 ? #if 0 in code. check with Antony +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND destid=1; +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND destid=9999; +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND destid=52; +SELECT COUNT(*) FROM rsb_graph WHERE latch='dijkstras' AND destid=6483; + +# breadth first +# other algorithms +# joins + +# cleaning up our tables +DROP TABLE rsb_graph, rsb; + +# cleaning up procs from randgraphproc.inc +DROP PROCEDURE randgraphproc; +DROP PROCEDURE randnotx; + diff --git a/storage/oqgraph/mysql-test/oqgraph/suite.opt b/storage/oqgraph/mysql-test/oqgraph/suite.opt new file mode 100644 index 00000000..9f10d4e0 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/suite.opt @@ -0,0 +1 @@ +--plugin-load-add=$HA_OQGRAPH_SO --enable-oqgraph diff --git a/storage/oqgraph/mysql-test/oqgraph/suite.pm b/storage/oqgraph/mysql-test/oqgraph/suite.pm new file mode 100644 index 00000000..118ecfa7 --- /dev/null +++ b/storage/oqgraph/mysql-test/oqgraph/suite.pm @@ -0,0 +1,14 @@ +package My::Suite::OQGraph; + +@ISA = qw(My::Suite); + +return "No OQGraph" unless $ENV{HA_OQGRAPH_SO} or + $::mysqld_variables{'oqgraph'} eq "ON"; + +# as long as OQGraph defines MYSQL_SERVER it cannot run in embedded +return "Not run for embedded server" if $::opt_embedded_server; + +sub is_default { 1 } + +bless { }; + |