From 0388abcb7d6dc533c485cf588a574dee84ee6461 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Sun, 30 Jun 2024 14:16:44 +0200 Subject: [PATCH] wip sql: use goldenscript for DML tests --- src/sql/mod.rs | 13 +- src/sql/testscripts/writes/delete | 87 +++++ src/sql/testscripts/writes/delete_index | 129 ++++++++ src/sql/testscripts/writes/delete_reference | 163 +++++++++ src/sql/testscripts/writes/delete_where | 90 +++++ src/sql/testscripts/writes/insert | 79 +++++ src/sql/testscripts/writes/insert_datatypes | 128 +++++++ src/sql/testscripts/writes/insert_default | 64 ++++ src/sql/testscripts/writes/insert_index | 311 ++++++++++++++++++ src/sql/testscripts/writes/insert_null | 36 ++ src/sql/testscripts/writes/insert_primary_key | 100 ++++++ src/sql/testscripts/writes/insert_reference | 158 +++++++++ src/sql/testscripts/writes/insert_unique | 291 ++++++++++++++++ src/sql/testscripts/writes/update | 59 ++++ tests/sql/mutation.rs | 30 -- tests/sql/mutation/delete_all | 18 - tests/sql/mutation/delete_bare | 24 -- tests/sql/mutation/delete_bare_from | 24 -- tests/sql/mutation/delete_bare_where | 24 -- tests/sql/mutation/delete_case | 22 -- .../sql/mutation/delete_missing_column_where | 24 -- tests/sql/mutation/delete_missing_table | 24 -- tests/sql/mutation/delete_multiple_tables | 24 -- tests/sql/mutation/delete_where | 22 -- tests/sql/mutation/delete_where_and | 22 -- tests/sql/mutation/delete_where_expr | 22 -- tests/sql/mutation/delete_where_false | 24 -- tests/sql/mutation/delete_where_float | 24 -- tests/sql/mutation/delete_where_integer | 24 -- tests/sql/mutation/delete_where_null | 24 -- tests/sql/mutation/delete_where_string | 24 -- tests/sql/mutation/delete_where_true | 18 - tests/sql/schema.rs | 177 ---------- tests/sql/schema/delete_index_all | 11 - tests/sql/schema/delete_index_only | 14 - tests/sql/schema/delete_index_single | 15 - tests/sql/schema/delete_ref_conflict | 24 -- tests/sql/schema/delete_ref_noref | 23 -- tests/sql/schema/delete_ref_self | 16 - tests/sql/schema/delete_ref_self_all | 11 - tests/sql/schema/delete_ref_self_conflict | 18 - tests/sql/schema/delete_ref_source | 22 -- tests/sql/schema/insert_boolean_false | 12 - tests/sql/schema/insert_boolean_float | 11 - tests/sql/schema/insert_boolean_float_zero | 11 - tests/sql/schema/insert_boolean_integer | 11 - tests/sql/schema/insert_boolean_integer_zero | 11 - tests/sql/schema/insert_boolean_null | 12 - tests/sql/schema/insert_boolean_string | 11 - tests/sql/schema/insert_boolean_string_empty | 11 - tests/sql/schema/insert_boolean_true | 12 - tests/sql/schema/insert_default | 14 - tests/sql/schema/insert_default_missing | 13 - tests/sql/schema/insert_default_override | 14 - tests/sql/schema/insert_default_override_null | 14 - tests/sql/schema/insert_default_unnamed | 14 - tests/sql/schema/insert_float | 12 - tests/sql/schema/insert_float_boolean | 11 - tests/sql/schema/insert_float_infinity | 12 - .../sql/schema/insert_float_infinity_negative | 12 - tests/sql/schema/insert_float_integer | 11 - tests/sql/schema/insert_float_max | 12 - tests/sql/schema/insert_float_max_negative | 12 - tests/sql/schema/insert_float_min | 12 - tests/sql/schema/insert_float_min_negative | 12 - tests/sql/schema/insert_float_min_round | 12 - tests/sql/schema/insert_float_nan | 12 - tests/sql/schema/insert_float_null | 12 - tests/sql/schema/insert_float_string | 11 - tests/sql/schema/insert_float_string_empty | 11 - tests/sql/schema/insert_index_exists | 17 - tests/sql/schema/insert_index_new | 18 - tests/sql/schema/insert_index_null | 18 - tests/sql/schema/insert_integer | 12 - tests/sql/schema/insert_integer_boolean | 11 - tests/sql/schema/insert_integer_float | 11 - .../sql/schema/insert_integer_float_infinity | 11 - tests/sql/schema/insert_integer_float_nan | 11 - tests/sql/schema/insert_integer_max | 12 - tests/sql/schema/insert_integer_min | 12 - tests/sql/schema/insert_integer_null | 12 - tests/sql/schema/insert_integer_string | 11 - tests/sql/schema/insert_integer_string_empty | 11 - tests/sql/schema/insert_nulls | 11 - tests/sql/schema/insert_nulls_default | 11 - tests/sql/schema/insert_nulls_required | 10 - tests/sql/schema/insert_pk_boolean | 9 - tests/sql/schema/insert_pk_boolean_conflict | 8 - tests/sql/schema/insert_pk_boolean_null | 8 - tests/sql/schema/insert_pk_float | 12 - tests/sql/schema/insert_pk_float_conflict | 11 - tests/sql/schema/insert_pk_float_infinity | 11 - tests/sql/schema/insert_pk_float_nan | 11 - tests/sql/schema/insert_pk_float_negative | 12 - tests/sql/schema/insert_pk_float_null | 11 - tests/sql/schema/insert_pk_float_zero | 12 - tests/sql/schema/insert_pk_integer | 10 - tests/sql/schema/insert_pk_integer_conflict | 9 - tests/sql/schema/insert_pk_integer_negative | 10 - tests/sql/schema/insert_pk_integer_null | 9 - tests/sql/schema/insert_pk_integer_zero | 10 - tests/sql/schema/insert_pk_string | 10 - tests/sql/schema/insert_pk_string_case | 10 - tests/sql/schema/insert_pk_string_conflict | 9 - tests/sql/schema/insert_pk_string_empty | 10 - tests/sql/schema/insert_pk_string_null | 9 - tests/sql/schema/insert_ref_boolean | 17 - tests/sql/schema/insert_ref_boolean_missing | 15 - tests/sql/schema/insert_ref_boolean_null | 17 - tests/sql/schema/insert_ref_float | 18 - tests/sql/schema/insert_ref_float_missing | 16 - tests/sql/schema/insert_ref_float_null | 18 - tests/sql/schema/insert_ref_integer | 19 -- tests/sql/schema/insert_ref_integer_missing | 17 - tests/sql/schema/insert_ref_integer_null | 19 -- tests/sql/schema/insert_ref_self | 19 -- tests/sql/schema/insert_ref_self_missing | 18 - tests/sql/schema/insert_ref_self_null | 19 -- tests/sql/schema/insert_ref_self_self | 20 -- tests/sql/schema/insert_ref_string | 18 - tests/sql/schema/insert_ref_string_case | 16 - tests/sql/schema/insert_ref_string_missing | 16 - tests/sql/schema/insert_ref_string_null | 18 - tests/sql/schema/insert_string | 12 - tests/sql/schema/insert_string_boolean | 11 - tests/sql/schema/insert_string_empty | 12 - tests/sql/schema/insert_string_float | 11 - tests/sql/schema/insert_string_integer | 11 - tests/sql/schema/insert_string_null | 12 - tests/sql/schema/insert_string_unicode | 12 - tests/sql/schema/insert_unique_boolean | 31 -- .../schema/insert_unique_boolean_duplicate | 29 -- tests/sql/schema/insert_unique_float | 31 -- .../sql/schema/insert_unique_float_duplicate | 29 -- tests/sql/schema/insert_unique_integer | 31 -- .../schema/insert_unique_integer_duplicate | 29 -- tests/sql/schema/insert_unique_nulls | 30 -- tests/sql/schema/insert_unique_string | 31 -- tests/sql/schema/insert_unique_string_case | 31 -- .../sql/schema/insert_unique_string_duplicate | 29 -- 140 files changed, 1706 insertions(+), 2168 deletions(-) create mode 100644 src/sql/testscripts/writes/delete create mode 100644 src/sql/testscripts/writes/delete_index create mode 100644 src/sql/testscripts/writes/delete_reference create mode 100644 src/sql/testscripts/writes/delete_where create mode 100644 src/sql/testscripts/writes/insert create mode 100644 src/sql/testscripts/writes/insert_datatypes create mode 100644 src/sql/testscripts/writes/insert_default create mode 100644 src/sql/testscripts/writes/insert_index create mode 100644 src/sql/testscripts/writes/insert_null create mode 100644 src/sql/testscripts/writes/insert_primary_key create mode 100644 src/sql/testscripts/writes/insert_reference create mode 100644 src/sql/testscripts/writes/insert_unique create mode 100644 src/sql/testscripts/writes/update delete mode 100644 tests/sql/mutation/delete_all delete mode 100644 tests/sql/mutation/delete_bare delete mode 100644 tests/sql/mutation/delete_bare_from delete mode 100644 tests/sql/mutation/delete_bare_where delete mode 100644 tests/sql/mutation/delete_case delete mode 100644 tests/sql/mutation/delete_missing_column_where delete mode 100644 tests/sql/mutation/delete_missing_table delete mode 100644 tests/sql/mutation/delete_multiple_tables delete mode 100644 tests/sql/mutation/delete_where delete mode 100644 tests/sql/mutation/delete_where_and delete mode 100644 tests/sql/mutation/delete_where_expr delete mode 100644 tests/sql/mutation/delete_where_false delete mode 100644 tests/sql/mutation/delete_where_float delete mode 100644 tests/sql/mutation/delete_where_integer delete mode 100644 tests/sql/mutation/delete_where_null delete mode 100644 tests/sql/mutation/delete_where_string delete mode 100644 tests/sql/mutation/delete_where_true delete mode 100644 tests/sql/schema/delete_index_all delete mode 100644 tests/sql/schema/delete_index_only delete mode 100644 tests/sql/schema/delete_index_single delete mode 100644 tests/sql/schema/delete_ref_conflict delete mode 100644 tests/sql/schema/delete_ref_noref delete mode 100644 tests/sql/schema/delete_ref_self delete mode 100644 tests/sql/schema/delete_ref_self_all delete mode 100644 tests/sql/schema/delete_ref_self_conflict delete mode 100644 tests/sql/schema/delete_ref_source delete mode 100644 tests/sql/schema/insert_boolean_false delete mode 100644 tests/sql/schema/insert_boolean_float delete mode 100644 tests/sql/schema/insert_boolean_float_zero delete mode 100644 tests/sql/schema/insert_boolean_integer delete mode 100644 tests/sql/schema/insert_boolean_integer_zero delete mode 100644 tests/sql/schema/insert_boolean_null delete mode 100644 tests/sql/schema/insert_boolean_string delete mode 100644 tests/sql/schema/insert_boolean_string_empty delete mode 100644 tests/sql/schema/insert_boolean_true delete mode 100644 tests/sql/schema/insert_default delete mode 100644 tests/sql/schema/insert_default_missing delete mode 100644 tests/sql/schema/insert_default_override delete mode 100644 tests/sql/schema/insert_default_override_null delete mode 100644 tests/sql/schema/insert_default_unnamed delete mode 100644 tests/sql/schema/insert_float delete mode 100644 tests/sql/schema/insert_float_boolean delete mode 100644 tests/sql/schema/insert_float_infinity delete mode 100644 tests/sql/schema/insert_float_infinity_negative delete mode 100644 tests/sql/schema/insert_float_integer delete mode 100644 tests/sql/schema/insert_float_max delete mode 100644 tests/sql/schema/insert_float_max_negative delete mode 100644 tests/sql/schema/insert_float_min delete mode 100644 tests/sql/schema/insert_float_min_negative delete mode 100644 tests/sql/schema/insert_float_min_round delete mode 100644 tests/sql/schema/insert_float_nan delete mode 100644 tests/sql/schema/insert_float_null delete mode 100644 tests/sql/schema/insert_float_string delete mode 100644 tests/sql/schema/insert_float_string_empty delete mode 100644 tests/sql/schema/insert_index_exists delete mode 100644 tests/sql/schema/insert_index_new delete mode 100644 tests/sql/schema/insert_index_null delete mode 100644 tests/sql/schema/insert_integer delete mode 100644 tests/sql/schema/insert_integer_boolean delete mode 100644 tests/sql/schema/insert_integer_float delete mode 100644 tests/sql/schema/insert_integer_float_infinity delete mode 100644 tests/sql/schema/insert_integer_float_nan delete mode 100644 tests/sql/schema/insert_integer_max delete mode 100644 tests/sql/schema/insert_integer_min delete mode 100644 tests/sql/schema/insert_integer_null delete mode 100644 tests/sql/schema/insert_integer_string delete mode 100644 tests/sql/schema/insert_integer_string_empty delete mode 100644 tests/sql/schema/insert_nulls delete mode 100644 tests/sql/schema/insert_nulls_default delete mode 100644 tests/sql/schema/insert_nulls_required delete mode 100644 tests/sql/schema/insert_pk_boolean delete mode 100644 tests/sql/schema/insert_pk_boolean_conflict delete mode 100644 tests/sql/schema/insert_pk_boolean_null delete mode 100644 tests/sql/schema/insert_pk_float delete mode 100644 tests/sql/schema/insert_pk_float_conflict delete mode 100644 tests/sql/schema/insert_pk_float_infinity delete mode 100644 tests/sql/schema/insert_pk_float_nan delete mode 100644 tests/sql/schema/insert_pk_float_negative delete mode 100644 tests/sql/schema/insert_pk_float_null delete mode 100644 tests/sql/schema/insert_pk_float_zero delete mode 100644 tests/sql/schema/insert_pk_integer delete mode 100644 tests/sql/schema/insert_pk_integer_conflict delete mode 100644 tests/sql/schema/insert_pk_integer_negative delete mode 100644 tests/sql/schema/insert_pk_integer_null delete mode 100644 tests/sql/schema/insert_pk_integer_zero delete mode 100644 tests/sql/schema/insert_pk_string delete mode 100644 tests/sql/schema/insert_pk_string_case delete mode 100644 tests/sql/schema/insert_pk_string_conflict delete mode 100644 tests/sql/schema/insert_pk_string_empty delete mode 100644 tests/sql/schema/insert_pk_string_null delete mode 100644 tests/sql/schema/insert_ref_boolean delete mode 100644 tests/sql/schema/insert_ref_boolean_missing delete mode 100644 tests/sql/schema/insert_ref_boolean_null delete mode 100644 tests/sql/schema/insert_ref_float delete mode 100644 tests/sql/schema/insert_ref_float_missing delete mode 100644 tests/sql/schema/insert_ref_float_null delete mode 100644 tests/sql/schema/insert_ref_integer delete mode 100644 tests/sql/schema/insert_ref_integer_missing delete mode 100644 tests/sql/schema/insert_ref_integer_null delete mode 100644 tests/sql/schema/insert_ref_self delete mode 100644 tests/sql/schema/insert_ref_self_missing delete mode 100644 tests/sql/schema/insert_ref_self_null delete mode 100644 tests/sql/schema/insert_ref_self_self delete mode 100644 tests/sql/schema/insert_ref_string delete mode 100644 tests/sql/schema/insert_ref_string_case delete mode 100644 tests/sql/schema/insert_ref_string_missing delete mode 100644 tests/sql/schema/insert_ref_string_null delete mode 100644 tests/sql/schema/insert_string delete mode 100644 tests/sql/schema/insert_string_boolean delete mode 100644 tests/sql/schema/insert_string_empty delete mode 100644 tests/sql/schema/insert_string_float delete mode 100644 tests/sql/schema/insert_string_integer delete mode 100644 tests/sql/schema/insert_string_null delete mode 100644 tests/sql/schema/insert_string_unicode delete mode 100644 tests/sql/schema/insert_unique_boolean delete mode 100644 tests/sql/schema/insert_unique_boolean_duplicate delete mode 100644 tests/sql/schema/insert_unique_float delete mode 100644 tests/sql/schema/insert_unique_float_duplicate delete mode 100644 tests/sql/schema/insert_unique_integer delete mode 100644 tests/sql/schema/insert_unique_integer_duplicate delete mode 100644 tests/sql/schema/insert_unique_nulls delete mode 100644 tests/sql/schema/insert_unique_string delete mode 100644 tests/sql/schema/insert_unique_string_case delete mode 100644 tests/sql/schema/insert_unique_string_duplicate diff --git a/src/sql/mod.rs b/src/sql/mod.rs index 648e97953..a5227d746 100644 --- a/src/sql/mod.rs +++ b/src/sql/mod.rs @@ -24,6 +24,7 @@ mod tests { // Run goldenscript tests in src/sql/testscripts. test_each_path! { in "src/sql/testscripts/schema" as schema => test_goldenscript } + test_each_path! { in "src/sql/testscripts/writes" as writes => test_goldenscript } test_each_path! { in "src/sql/testscripts/expressions" as expressions => test_goldenscript_expr } fn test_goldenscript(path: &std::path::Path) { @@ -124,8 +125,16 @@ mod tests { writeln!(output, "{plan}")?; } - // Output the result if requested. - if tags.remove("result") { + // Output the result if requested. SELECT results are always output, + // but the columns only if result is given. + if let StatementResult::Select { columns, rows } = result { + if tags.remove("columns") { + writeln!(output, "{}", columns.into_iter().map(|c| c.to_string()).join(","))?; + } + for row in rows { + writeln!(output, "{}", row.into_iter().map(|v| v.to_string()).join(","))?; + } + } else if tags.remove("result") { writeln!(output, "{result:?}")?; } diff --git a/src/sql/testscripts/writes/delete b/src/sql/testscripts/writes/delete new file mode 100644 index 000000000..8bb7a7980 --- /dev/null +++ b/src/sql/testscripts/writes/delete @@ -0,0 +1,87 @@ +# Tests basic DELETE. + +# Insert some data into a table. We'll use transactions to avoid +# +> CREATE TABLE name (id INT PRIMARY KEY, value STRING) +> INSERT INTO name VALUES (1, 'a'), (2, 'b'), (3, 'c') +--- +ok + +# Deleting from a table works. Use a transaction to keep the fixture. +> BEGIN +[plan,ops]> DELETE FROM name +--- +Delete: name +└─ Scan: name +storage set mvcc:TxnWrite(3, sql:Row("name", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(1)), 3) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x00"] +storage set mvcc:TxnWrite(3, sql:Row("name", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(2)), 3) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x00"] +storage set mvcc:TxnWrite(3, sql:Row("name", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(3)), 3) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x00"] + +> SELECT * FROM name +> ROLLBACK +--- +ok + +# Deleting without a table, or with a missing or multiple tables errors. +!> DELETE +!> DELETE FROM +!> DELETE FROM missing +!> DELETE FROM name, foo +--- +Error: invalid input: unexpected end of input +Error: invalid input: unexpected end of input +Error: invalid input: table missing does not exist +Error: invalid input: unexpected token , + +# Deleting in an implicit transaction works, and deletes. +[ops]> DELETE FROM name +--- +storage set mvcc:NextVersion → 6 ["\x00" → "\x06"] +storage set mvcc:TxnActive(5) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x05" → ""] +storage set mvcc:TxnWrite(5, sql:Row("name", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(1)), 5) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x00"] +storage set mvcc:TxnWrite(5, sql:Row("name", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(2)), 5) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x00"] +storage set mvcc:TxnWrite(5, sql:Row("name", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(3)), 5) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x00"] +storage delete mvcc:TxnWrite(5, sql:Row("name", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnWrite(5, sql:Row("name", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnWrite(5, sql:Row("name", Integer(3))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00"] +storage delete mvcc:TxnActive(5) ["\x01\x00\x00\x00\x00\x00\x00\x00\x05"] + +> SELECT * FROM name +--- +ok + +dump +--- +mvcc:NextVersion → 6 ["\x00" → "\x06"] +mvcc:Version(sql:Table("name"), 1) → CREATE TABLE name ( id INTEGER PRIMARY KEY, value STRING DEFAULT NULL ) ["\x04\x00\xffname\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01" → "\x01\x1d\x04name\x00\x02\x02id\x01\x00\x00\x01\x00\x00\x05value\x03\x01\x01\x00\x00\x00\x00"] +mvcc:Version(sql:Row("name", Integer(1)), 2) → Integer(1),String("a") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x02\x04\x01a"] +mvcc:Version(sql:Row("name", Integer(1)), 5) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x00"] +mvcc:Version(sql:Row("name", Integer(2)), 2) → Integer(2),String("b") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x04\x04\x01b"] +mvcc:Version(sql:Row("name", Integer(2)), 5) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x00"] +mvcc:Version(sql:Row("name", Integer(3)), 2) → Integer(3),String("c") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x06\x04\x01c"] +mvcc:Version(sql:Row("name", Integer(3)), 5) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x00"] + +# Bare DELETE errors. +!> DELETE +!> DELETE FROM +--- +Error: invalid input: unexpected end of input +Error: invalid input: unexpected end of input + +# Unknown table errors. +!> DELETE FROM foo +--- +Error: invalid input: table foo does not exist + +# LIMIT and ORDER BY clauses error. +!> DELETE FROM name LIMIT 2 +!> DELETE FROM name ORDER BY id +--- +Error: invalid input: unexpected token LIMIT +Error: invalid input: unexpected token ORDER diff --git a/src/sql/testscripts/writes/delete_index b/src/sql/testscripts/writes/delete_index new file mode 100644 index 000000000..703c684c5 --- /dev/null +++ b/src/sql/testscripts/writes/delete_index @@ -0,0 +1,129 @@ +# Tests index updates during DELETE. + +# Create a table with a few indexes. +> CREATE TABLE ref (id INT PRIMARY KEY, value STRING) +> INSERT INTO ref VALUES (1, 'a'), (2, 'b') +> CREATE TABLE name ( \ + id INT PRIMARY KEY, \ + "index" INT INDEX, \ + "unique" STRING UNIQUE, \ + ref_id INT REFERENCES ref \ +) +> INSERT INTO name VALUES (1, 2, 'foo', 1) +> INSERT INTO name VALUES (2, 4, 'bar', 1) +> INSERT INTO name VALUES (3, 6, NULL, 2) +> INSERT INTO name VALUES (4, 8, 'baz', 2) +> INSERT INTO name VALUES (5, 10, NULL, 1) +--- +ok + +# DELETE updates the secondary indexes. +[ops]> DELETE FROM name WHERE id = 4 +--- +storage set mvcc:NextVersion → 10 ["\x00" → "\n"] +storage set mvcc:TxnActive(9) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\t" → ""] +storage set mvcc:TxnWrite(9, sql:Index("name", "index", Integer(8))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "index", Integer(8)), 9) → None ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x00"] +storage set mvcc:TxnWrite(9, sql:Index("name", "unique", String("baz"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x04baz\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "unique", String("baz")), 9) → None ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x04baz\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x00"] +storage set mvcc:TxnWrite(9, sql:Index("name", "ref_id", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 9) → Integer(3) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x03\x01\x02\x06"] +storage set mvcc:TxnWrite(9, sql:Row("name", Integer(4))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(4)), 9) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("name", "index", Integer(8))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("name", "ref_id", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("name", "unique", String("baz"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x04baz\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Row("name", Integer(4))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00"] +storage delete mvcc:TxnActive(9) ["\x01\x00\x00\x00\x00\x00\x00\x00\t"] + +# DELETE can use index lookups to find rows to delete. +[plan]> DELETE FROM name WHERE "index" = 2 +--- +Delete: name +└─ IndexLookup: name column index (2) + +> SELECT * FROM name +--- +2,4,bar,1 +3,6,NULL,2 +5,10,NULL,1 + +# Including IS NULL predicates. +[plan,ops]> DELETE FROM name WHERE "unique" IS NULL +--- +Delete: name +└─ IndexLookup: name column unique (NULL) +storage set mvcc:NextVersion → 12 ["\x00" → "\x0c"] +storage set mvcc:TxnActive(11) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x0b" → ""] +storage set mvcc:TxnWrite(11, sql:Index("name", "index", Integer(6))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "index", Integer(6)), 11) → None ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +storage set mvcc:TxnWrite(11, sql:Index("name", "unique", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "unique", Null), 11) → Integer(5) ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x03\x01\x02\n"] +storage set mvcc:TxnWrite(11, sql:Index("name", "ref_id", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 11) → None ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +storage set mvcc:TxnWrite(11, sql:Row("name", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(3)), 11) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +storage set mvcc:TxnWrite(11, sql:Index("name", "index", Integer(10))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "index", Integer(10)), 11) → None ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +storage set mvcc:TxnWrite(11, sql:Index("name", "unique", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "unique", Null), 11) → None ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +storage set mvcc:TxnWrite(11, sql:Index("name", "ref_id", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "ref_id", Integer(1)), 11) → Integer(2) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x03\x01\x02\x04"] +storage set mvcc:TxnWrite(11, sql:Row("name", Integer(5))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(5)), 11) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("name", "index", Integer(6))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("name", "index", Integer(10))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("name", "ref_id", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("name", "ref_id", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("name", "unique", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Row("name", Integer(3))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Row("name", Integer(5))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00"] +storage delete mvcc:TxnActive(11) ["\x01\x00\x00\x00\x00\x00\x00\x00\x0b"] + +# Dump the final state. +> SELECT * FROM name +--- +2,4,bar,1 + +dump +--- +mvcc:NextVersion → 12 ["\x00" → "\x0c"] +mvcc:Version(sql:Table("name"), 3) → CREATE TABLE name ( id INTEGER PRIMARY KEY, "index" INTEGER DEFAULT NULL INDEX, "unique" STRING DEFAULT NULL UNIQUE INDEX, ref_id INTEGER DEFAULT NULL INDEX REFERENCES ref ) ["\x04\x00\xffname\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01=\x04name\x00\x04\x02id\x01\x00\x00\x01\x00\x00\x05index\x01\x01\x01\x00\x00\x01\x00\x06unique\x03\x01\x01\x00\x01\x01\x00\x06ref_id\x01\x01\x01\x00\x00\x01\x01\x03ref"] +mvcc:Version(sql:Table("ref"), 1) → CREATE TABLE ref ( id INTEGER PRIMARY KEY, value STRING DEFAULT NULL ) ["\x04\x00\xffref\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01" → "\x01\x1c\x03ref\x00\x02\x02id\x01\x00\x00\x01\x00\x00\x05value\x03\x01\x01\x00\x00\x00\x00"] +mvcc:Version(sql:Index("name", "index", Integer(2)), 4) → Integer(1) ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x03\x01\x02\x02"] +mvcc:Version(sql:Index("name", "index", Integer(2)), 10) → None ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x00"] +mvcc:Version(sql:Index("name", "index", Integer(4)), 5) → Integer(2) ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x03\x01\x02\x04"] +mvcc:Version(sql:Index("name", "index", Integer(6)), 6) → Integer(3) ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x03\x01\x02\x06"] +mvcc:Version(sql:Index("name", "index", Integer(6)), 11) → None ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +mvcc:Version(sql:Index("name", "index", Integer(8)), 7) → Integer(4) ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x08"] +mvcc:Version(sql:Index("name", "index", Integer(8)), 9) → None ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x00"] +mvcc:Version(sql:Index("name", "index", Integer(10)), 8) → Integer(5) ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x03\x01\x02\n"] +mvcc:Version(sql:Index("name", "index", Integer(10)), 11) → None ["\x04\x01name\x00\xff\x00\xffindex\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +mvcc:Version(sql:Index("name", "ref_id", Integer(1)), 4) → Integer(1) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x03\x01\x02\x02"] +mvcc:Version(sql:Index("name", "ref_id", Integer(1)), 5) → Integer(1),Integer(2) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x05\x02\x02\x02\x02\x04"] +mvcc:Version(sql:Index("name", "ref_id", Integer(1)), 8) → Integer(1),Integer(2),Integer(5) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x07\x03\x02\x02\x02\x04\x02\n"] +mvcc:Version(sql:Index("name", "ref_id", Integer(1)), 10) → Integer(2),Integer(5) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x05\x02\x02\x04\x02\n"] +mvcc:Version(sql:Index("name", "ref_id", Integer(1)), 11) → Integer(2) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x03\x01\x02\x04"] +mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 6) → Integer(3) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x03\x01\x02\x06"] +mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 7) → Integer(3),Integer(4) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x05\x02\x02\x06\x02\x08"] +mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 9) → Integer(3) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x03\x01\x02\x06"] +mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 11) → None ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +mvcc:Version(sql:Index("name", "unique", Null), 6) → Integer(3) ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x03\x01\x02\x06"] +mvcc:Version(sql:Index("name", "unique", Null), 8) → Integer(3),Integer(5) ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x05\x02\x02\x06\x02\n"] +mvcc:Version(sql:Index("name", "unique", Null), 11) → None ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +mvcc:Version(sql:Index("name", "unique", String("bar")), 5) → Integer(2) ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x04bar\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x03\x01\x02\x04"] +mvcc:Version(sql:Index("name", "unique", String("baz")), 7) → Integer(4) ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x04baz\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x08"] +mvcc:Version(sql:Index("name", "unique", String("baz")), 9) → None ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x04baz\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x00"] +mvcc:Version(sql:Index("name", "unique", String("foo")), 4) → Integer(1) ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x03\x01\x02\x02"] +mvcc:Version(sql:Index("name", "unique", String("foo")), 10) → None ["\x04\x01name\x00\xff\x00\xffunique\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x00"] +mvcc:Version(sql:Row("name", Integer(1)), 4) → Integer(1),Integer(2),String("foo"),Integer(1) ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x0c\x04\x02\x02\x02\x04\x04\x03foo\x02\x02"] +mvcc:Version(sql:Row("name", Integer(1)), 10) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x00"] +mvcc:Version(sql:Row("name", Integer(2)), 5) → Integer(2),Integer(4),String("bar"),Integer(1) ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x0c\x04\x02\x04\x02\x08\x04\x03bar\x02\x02"] +mvcc:Version(sql:Row("name", Integer(3)), 6) → Integer(3),Integer(6),Null,Integer(2) ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x08\x04\x02\x06\x02\x0c\x00\x02\x04"] +mvcc:Version(sql:Row("name", Integer(3)), 11) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +mvcc:Version(sql:Row("name", Integer(4)), 7) → Integer(4),Integer(8),String("baz"),Integer(2) ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x0c\x04\x02\x08\x02\x10\x04\x03baz\x02\x04"] +mvcc:Version(sql:Row("name", Integer(4)), 9) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x00"] +mvcc:Version(sql:Row("name", Integer(5)), 8) → Integer(5),Integer(10),Null,Integer(1) ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x08\x04\x02\n\x02\x14\x00\x02\x02"] +mvcc:Version(sql:Row("name", Integer(5)), 11) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x00"] +mvcc:Version(sql:Row("ref", Integer(1)), 2) → Integer(1),String("a") ["\x04\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x02\x04\x01a"] +mvcc:Version(sql:Row("ref", Integer(2)), 2) → Integer(2),String("b") ["\x04\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x04\x04\x01b"] diff --git a/src/sql/testscripts/writes/delete_reference b/src/sql/testscripts/writes/delete_reference new file mode 100644 index 000000000..506946336 --- /dev/null +++ b/src/sql/testscripts/writes/delete_reference @@ -0,0 +1,163 @@ +# Tests DELETE with foreign key constraints. + +# Create a few reference tables with data. +> CREATE TABLE ref (id INT PRIMARY KEY, value STRING) +> CREATE TABLE sref (id STRING PRIMARY KEY) +> INSERT INTO ref VALUES (1, 'a'), (2, 'b'), (3, 'c') +> INSERT INTO sref VALUES ('a'), ('b') + +> CREATE TABLE name ( \ + id INT PRIMARY KEY, \ + ref_id INT REFERENCES ref, \ + sref_id STRING NOT NULL REFERENCES sref \ +) +> INSERT INTO name VALUES (1, 1, 'a') +> INSERT INTO name VALUES (2, NULL, 'b') +> INSERT INTO name VALUES (3, 2, 'b') +> INSERT INTO name VALUES (4, 2, 'a') +> INSERT INTO name VALUES (5, 1, 'a') +--- +ok + +# DELETE with a reference errors. It does not remove rows that could be removed +# in isolation. +!> DELETE FROM ref +!> DELETE FROM ref WHERE id = 1 +--- +Error: invalid input: row referenced by name.ref_id for name.id=1 +Error: invalid input: row referenced by name.ref_id for name.id=1 + +> SELECT * FROM ref +--- +1,a +2,b +3,c + +# DELETE of an unreferenced row succeeds. +[ops]> DELETE FROM ref WHERE id = 3 +--- +storage set mvcc:NextVersion → 14 ["\x00" → "\x0e"] +storage set mvcc:TxnActive(13) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\r" → ""] +storage set mvcc:TxnWrite(13, sql:Row("ref", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("ref", Integer(3)), 13) → None ["\x04\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\r" → "\x00"] +storage delete mvcc:TxnWrite(13, sql:Row("ref", Integer(3))) ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00"] +storage delete mvcc:TxnActive(13) ["\x01\x00\x00\x00\x00\x00\x00\x00\r"] + +> SELECT * FROM ref +--- +1,a +2,b + +# DELETE in the source table succeeds. It also removes the index entries. +[ops]> DELETE FROM name WHERE id = 2 OR id = 3 +--- +storage set mvcc:NextVersion → 15 ["\x00" → "\x0f"] +storage set mvcc:TxnActive(14) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x0e" → ""] +storage set mvcc:TxnWrite(14, sql:Index("name", "ref_id", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "ref_id", Null), 14) → None ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x00"] +storage set mvcc:TxnWrite(14, sql:Index("name", "sref_id", String("b"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "sref_id", String("b")), 14) → Integer(3) ["\x04\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x01\x03\x01\x02\x06"] +storage set mvcc:TxnWrite(14, sql:Row("name", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(2)), 14) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x00"] +storage set mvcc:TxnWrite(14, sql:Index("name", "ref_id", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 14) → Integer(4) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x01\x03\x01\x02\x08"] +storage set mvcc:TxnWrite(14, sql:Index("name", "sref_id", String("b"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "sref_id", String("b")), 14) → None ["\x04\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x00"] +storage set mvcc:TxnWrite(14, sql:Row("name", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(3)), 14) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x00"] +storage delete mvcc:TxnWrite(14, sql:Index("name", "ref_id", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(14, sql:Index("name", "ref_id", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnWrite(14, sql:Index("name", "sref_id", String("b"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(14, sql:Row("name", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnWrite(14, sql:Row("name", Integer(3))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00"] +storage delete mvcc:TxnActive(14) ["\x01\x00\x00\x00\x00\x00\x00\x00\x0e"] + +# DELETE of a no-longer-referenced row succeeds. +> DELETE FROM sref WHERE id = 'b' +--- +ok + +# Test self-references. +> CREATE TABLE self (id INT PRIMARY KEY, self_id INT REFERENCES self) +> INSERT INTO self VALUES (1, 1) +> INSERT INTO self VALUES (2, 2) +> INSERT INTO self VALUES (3, 2) +> INSERT INTO self VALUES (4, 2) +--- +ok + +# Deleting all self-ref rows always works. +> BEGIN +> DELETE FROM self +> SELECT * FROM self +> ROLLBACK +--- +ok + +# Deleting a referenced row errors. +!> DELETE FROM self WHERE id = 2 +--- +Error: invalid input: row referenced by self.self_id for self.id=3 + +# Deleting an unreferenced row works. +> DELETE FROM self WHERE id = 4 +--- +ok + +# Deleting a row only referencing itself works. +> DELETE FROM self WHERE id = 1 +--- +ok + +> SELECT * FROM self +--- +2,2 +3,2 + +# Dump the raw dataset. +dump +--- +mvcc:NextVersion → 25 ["\x00" → "\x19"] +mvcc:Version(sql:Table("name"), 5) → CREATE TABLE name ( id INTEGER PRIMARY KEY, ref_id INTEGER DEFAULT NULL INDEX REFERENCES ref, sref_id STRING NOT NULL INDEX REFERENCES sref ) ["\x04\x00\xffname\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x015\x04name\x00\x03\x02id\x01\x00\x00\x01\x00\x00\x06ref_id\x01\x01\x01\x00\x00\x01\x01\x03ref\x07sref_id\x03\x00\x00\x00\x01\x01\x04sref"] +mvcc:Version(sql:Table("ref"), 1) → CREATE TABLE ref ( id INTEGER PRIMARY KEY, value STRING DEFAULT NULL ) ["\x04\x00\xffref\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01" → "\x01\x1c\x03ref\x00\x02\x02id\x01\x00\x00\x01\x00\x00\x05value\x03\x01\x01\x00\x00\x00\x00"] +mvcc:Version(sql:Table("self"), 16) → CREATE TABLE self ( id INTEGER PRIMARY KEY, self_id INTEGER DEFAULT NULL INDEX REFERENCES self ) ["\x04\x00\xffself\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01$\x04self\x00\x02\x02id\x01\x00\x00\x01\x00\x00\x07self_id\x01\x01\x01\x00\x00\x01\x01\x04self"] +mvcc:Version(sql:Table("sref"), 2) → CREATE TABLE sref ( id STRING PRIMARY KEY ) ["\x04\x00\xffsref\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x10\x04sref\x00\x01\x02id\x03\x00\x00\x01\x00\x00"] +mvcc:Version(sql:Index("name", "ref_id", Null), 7) → Integer(2) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x04"] +mvcc:Version(sql:Index("name", "ref_id", Null), 14) → None ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x00"] +mvcc:Version(sql:Index("name", "ref_id", Integer(1)), 6) → Integer(1) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x03\x01\x02\x02"] +mvcc:Version(sql:Index("name", "ref_id", Integer(1)), 10) → Integer(1),Integer(5) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x05\x02\x02\x02\x02\n"] +mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 8) → Integer(3) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x03\x01\x02\x06"] +mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 9) → Integer(3),Integer(4) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x05\x02\x02\x06\x02\x08"] +mvcc:Version(sql:Index("name", "ref_id", Integer(2)), 14) → Integer(4) ["\x04\x01name\x00\xff\x00\xffref_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x01\x03\x01\x02\x08"] +mvcc:Version(sql:Index("name", "sref_id", String("a")), 6) → Integer(1) ["\x04\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04a\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x03\x01\x02\x02"] +mvcc:Version(sql:Index("name", "sref_id", String("a")), 9) → Integer(1),Integer(4) ["\x04\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04a\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x05\x02\x02\x02\x02\x08"] +mvcc:Version(sql:Index("name", "sref_id", String("a")), 10) → Integer(1),Integer(4),Integer(5) ["\x04\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04a\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x07\x03\x02\x02\x02\x08\x02\n"] +mvcc:Version(sql:Index("name", "sref_id", String("b")), 7) → Integer(2) ["\x04\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x04"] +mvcc:Version(sql:Index("name", "sref_id", String("b")), 8) → Integer(2),Integer(3) ["\x04\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x05\x02\x02\x04\x02\x06"] +mvcc:Version(sql:Index("name", "sref_id", String("b")), 14) → None ["\x04\x01name\x00\xff\x00\xffsref_id\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x00"] +mvcc:Version(sql:Index("self", "self_id", Integer(1)), 17) → Integer(1) ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11" → "\x01\x03\x01\x02\x02"] +mvcc:Version(sql:Index("self", "self_id", Integer(1)), 24) → None ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18" → "\x00"] +mvcc:Version(sql:Index("self", "self_id", Integer(2)), 18) → Integer(2) ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12" → "\x01\x03\x01\x02\x04"] +mvcc:Version(sql:Index("self", "self_id", Integer(2)), 19) → Integer(2),Integer(3) ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13" → "\x01\x05\x02\x02\x04\x02\x06"] +mvcc:Version(sql:Index("self", "self_id", Integer(2)), 20) → Integer(2),Integer(3),Integer(4) ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14" → "\x01\x07\x03\x02\x04\x02\x06\x02\x08"] +mvcc:Version(sql:Index("self", "self_id", Integer(2)), 23) → Integer(2),Integer(3) ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17" → "\x01\x05\x02\x02\x04\x02\x06"] +mvcc:Version(sql:Row("name", Integer(1)), 6) → Integer(1),Integer(1),String("a") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x08\x03\x02\x02\x02\x02\x04\x01a"] +mvcc:Version(sql:Row("name", Integer(2)), 7) → Integer(2),Null,String("b") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x07\x03\x02\x04\x00\x04\x01b"] +mvcc:Version(sql:Row("name", Integer(2)), 14) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x00"] +mvcc:Version(sql:Row("name", Integer(3)), 8) → Integer(3),Integer(2),String("b") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x08\x03\x02\x06\x02\x04\x04\x01b"] +mvcc:Version(sql:Row("name", Integer(3)), 14) → None ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x00"] +mvcc:Version(sql:Row("name", Integer(4)), 9) → Integer(4),Integer(2),String("a") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x08\x03\x02\x08\x02\x04\x04\x01a"] +mvcc:Version(sql:Row("name", Integer(5)), 10) → Integer(5),Integer(1),String("a") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x08\x03\x02\n\x02\x02\x04\x01a"] +mvcc:Version(sql:Row("ref", Integer(1)), 3) → Integer(1),String("a") ["\x04\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x02\x04\x01a"] +mvcc:Version(sql:Row("ref", Integer(2)), 3) → Integer(2),String("b") ["\x04\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x04\x04\x01b"] +mvcc:Version(sql:Row("ref", Integer(3)), 3) → Integer(3),String("c") ["\x04\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x06\x04\x01c"] +mvcc:Version(sql:Row("ref", Integer(3)), 13) → None ["\x04\x02ref\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\r" → "\x00"] +mvcc:Version(sql:Row("self", Integer(1)), 17) → Integer(1),Integer(1) ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11" → "\x01\x05\x02\x02\x02\x02\x02"] +mvcc:Version(sql:Row("self", Integer(1)), 24) → None ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18" → "\x00"] +mvcc:Version(sql:Row("self", Integer(2)), 18) → Integer(2),Integer(2) ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12" → "\x01\x05\x02\x02\x04\x02\x04"] +mvcc:Version(sql:Row("self", Integer(3)), 19) → Integer(3),Integer(2) ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13" → "\x01\x05\x02\x02\x06\x02\x04"] +mvcc:Version(sql:Row("self", Integer(4)), 20) → Integer(4),Integer(2) ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x14" → "\x01\x05\x02\x02\x08\x02\x04"] +mvcc:Version(sql:Row("self", Integer(4)), 23) → None ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17" → "\x00"] +mvcc:Version(sql:Row("sref", String("a")), 4) → String("a") ["\x04\x02sref\x00\xff\x00\xff\x04a\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x04\x01\x04\x01a"] +mvcc:Version(sql:Row("sref", String("b")), 4) → String("b") ["\x04\x02sref\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x04\x01\x04\x01b"] +mvcc:Version(sql:Row("sref", String("b")), 15) → None ["\x04\x02sref\x00\xff\x00\xff\x04b\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f" → "\x00"] diff --git a/src/sql/testscripts/writes/delete_where b/src/sql/testscripts/writes/delete_where new file mode 100644 index 000000000..bcbf63127 --- /dev/null +++ b/src/sql/testscripts/writes/delete_where @@ -0,0 +1,90 @@ +# Tests filtered DELETE statements. + +# Create a table with some data. +> CREATE TABLE name (id INT PRIMARY KEY, value STRING) +> INSERT INTO name VALUES (1, 'a'), (2, 'b'), (3, 'c'), (0, NULL) +--- +ok + +# Boolean filters work, and are trivial. +> BEGIN +[plan]> DELETE FROM name WHERE true +--- +Delete: name +└─ Scan: name + +> SELECT * FROM name +> ROLLBACK +--- +ok + +[plan]> DELETE FROM name WHERE false +--- +Delete: name +└─ Nothing + +> SELECT * FROM name +--- +0,NULL +1,a +2,b +3,c + +# Deleting by primary key lookup works. +> BEGIN +[plan]> DELETE FROM name WHERE id = 1 OR id = 3 +--- +Delete: name +└─ KeyLookup: name (1, 3) + +> SELECT * FROM name +> ROLLBACK +--- +0,NULL +2,b + +# Deleting by arbitrary predicate works. +> BEGIN +[plan]> DELETE FROM name WHERE id >= 5 - 2 OR (value LIKE 'a') IS NULL +--- +Delete: name +└─ Scan: name (id > 3 OR id = 3 OR value LIKE a IS NULL) + +> SELECT * FROM name +> ROLLBACK +--- +1,a +2,b + +# Other types error, except NULL which is equivalent to false. +!> DELETE FROM name WHERE 0 +!> DELETE FROM name WHERE 1 +!> DELETE FROM name WHERE 3.14 +!> DELETE FROM name WHERE NaN +!> DELETE FROM name WHERE '' +!> DELETE FROM name WHERE 'true' +--- +Error: invalid input: filter returned 0, expected boolean +Error: invalid input: filter returned 1, expected boolean +Error: invalid input: filter returned 3.14, expected boolean +Error: invalid input: filter returned NaN, expected boolean +Error: invalid input: filter returned , expected boolean +Error: invalid input: filter returned true, expected boolean + +> DELETE FROM name WHERE NULL +> SELECT * FROM name +--- +0,NULL +1,a +2,b +3,c + +# Bare WHERE errors. +!> DELETE FROM name WHERE +--- +Error: invalid input: unexpected end of input + +# Missing columns error. +!> DELETE FROM name WHERE missing = 'foo' +--- +Error: invalid input: unknown field missing diff --git a/src/sql/testscripts/writes/insert b/src/sql/testscripts/writes/insert new file mode 100644 index 000000000..15a988090 --- /dev/null +++ b/src/sql/testscripts/writes/insert @@ -0,0 +1,79 @@ +# Tests basic INSERT functionality. + +> CREATE TABLE name (id INT PRIMARY KEY, value STRING) +--- +ok + +# Writes a row to the table, and returns the number of rows. +[plan,result,ops]> INSERT INTO name VALUES (1, 'a') +--- +Insert: name +└─ Values: 1 rows +Insert { count: 1 } +storage set mvcc:NextVersion → 3 ["\x00" → "\x03"] +storage set mvcc:TxnActive(2) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x02" → ""] +storage set mvcc:TxnWrite(2, sql:Row("name", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(1)), 2) → Integer(1),String("a") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x02\x04\x01a"] +storage delete mvcc:TxnWrite(2, sql:Row("name", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnActive(2) ["\x01\x00\x00\x00\x00\x00\x00\x00\x02"] + +# Can also write multiple rows. +[plan,result,ops]> INSERT INTO name VALUES (2, 'b'), (3, 'c'), (4, 'd') +--- +Insert: name +└─ Values: 3 rows +Insert { count: 3 } +storage set mvcc:NextVersion → 4 ["\x00" → "\x04"] +storage set mvcc:TxnActive(3) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x03" → ""] +storage set mvcc:TxnWrite(3, sql:Row("name", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(2)), 3) → Integer(2),String("b") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x04\x04\x01b"] +storage set mvcc:TxnWrite(3, sql:Row("name", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(3)), 3) → Integer(3),String("c") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x06\x04\x01c"] +storage set mvcc:TxnWrite(3, sql:Row("name", Integer(4))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(4)), 3) → Integer(4),String("d") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x08\x04\x01d"] +storage delete mvcc:TxnWrite(3, sql:Row("name", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnWrite(3, sql:Row("name", Integer(3))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00"] +storage delete mvcc:TxnWrite(3, sql:Row("name", Integer(4))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00"] +storage delete mvcc:TxnActive(3) ["\x01\x00\x00\x00\x00\x00\x00\x00\x03"] + +> SELECT * FROM name +--- +1,a +2,b +3,c +4,d + +dump +--- +mvcc:NextVersion → 4 ["\x00" → "\x04"] +mvcc:Version(sql:Table("name"), 1) → CREATE TABLE name ( id INTEGER PRIMARY KEY, value STRING DEFAULT NULL ) ["\x04\x00\xffname\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01" → "\x01\x1d\x04name\x00\x02\x02id\x01\x00\x00\x01\x00\x00\x05value\x03\x01\x01\x00\x00\x00\x00"] +mvcc:Version(sql:Row("name", Integer(1)), 2) → Integer(1),String("a") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x02\x04\x01a"] +mvcc:Version(sql:Row("name", Integer(2)), 3) → Integer(2),String("b") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x04\x04\x01b"] +mvcc:Version(sql:Row("name", Integer(3)), 3) → Integer(3),String("c") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x06\x04\x01c"] +mvcc:Version(sql:Row("name", Integer(4)), 3) → Integer(4),String("d") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x06\x02\x02\x08\x04\x01d"] + +# INSERTs with too many columns errors. +!> INSERT INTO name VALUES (5, 'e', NULL) +--- +Error: invalid input: too many values for table name + +# Bare insert errors, as does no values. +!> INSERT +!> INSERT INTO +!> INSERT INTO name +--- +Error: invalid input: unexpected end of input +Error: invalid input: unexpected end of input +Error: invalid input: unexpected end of input + +# Unknown table or column errors. +!> INSERT INTO foo VALUES (1) +!> INSERT INTO name (id, foo) VALUES (1, 'bar') +--- +Error: invalid input: table foo does not exist +Error: invalid input: unknown column foo in table name + +# Specifying the same column multiple times errors. +!> INSERT INTO name (id, value, value) VALUES (5, 'e', 'f') +--- +Error: invalid input: column value given multiple times diff --git a/src/sql/testscripts/writes/insert_datatypes b/src/sql/testscripts/writes/insert_datatypes new file mode 100644 index 000000000..45e186322 --- /dev/null +++ b/src/sql/testscripts/writes/insert_datatypes @@ -0,0 +1,128 @@ +# Tests INSERT of all datatypes. + +# Create columns with all datatypes. +> CREATE TABLE datatypes ( \ + id INTEGER PRIMARY KEY, \ + "bool" BOOL, \ + "int" INT, \ + "float" FLOAT, \ + "string" STRING \ +) +--- +ok + +# Booleans. +> BEGIN +> INSERT INTO datatypes (id, "bool") VALUES (1, true) +> INSERT INTO datatypes (id, "bool") VALUES (2, false) +> INSERT INTO datatypes (id, "bool") VALUES (3, NULL) +--- +ok + +> SELECT * FROM datatypes +> ROLLBACK +--- +1,TRUE,NULL,NULL,NULL +2,FALSE,NULL,NULL,NULL +3,NULL,NULL,NULL,NULL + +!> INSERT INTO datatypes (id, "bool") VALUES (0, 1) +!> INSERT INTO datatypes (id, "bool") VALUES (0, 3.14) +!> INSERT INTO datatypes (id, "bool") VALUES (0, 'false') +--- +Error: invalid input: invalid datatype INTEGER for BOOLEAN column bool +Error: invalid input: invalid datatype FLOAT for BOOLEAN column bool +Error: invalid input: invalid datatype STRING for BOOLEAN column bool + +# Integers. +> BEGIN +> INSERT INTO datatypes (id, "int") VALUES (1, 1) +> INSERT INTO datatypes (id, "int") VALUES (2, 0) +> INSERT INTO datatypes (id, "int") VALUES (3, -1) +> INSERT INTO datatypes (id, "int") VALUES (4, 9223372036854775807) +> INSERT INTO datatypes (id, "int") VALUES (5, -9223372036854775807) +> INSERT INTO datatypes (id, "int") VALUES (6, NULL) +--- +ok + +> SELECT * FROM datatypes +> ROLLBACK +--- +1,NULL,1,NULL,NULL +2,NULL,0,NULL,NULL +3,NULL,-1,NULL,NULL +4,NULL,9223372036854775807,NULL,NULL +5,NULL,-9223372036854775807,NULL,NULL +6,NULL,NULL,NULL,NULL + +!> INSERT INTO datatypes (id, "int") VALUES (0, false) +!> INSERT INTO datatypes (id, "int") VALUES (0, 3.0) +!> INSERT INTO datatypes (id, "int") VALUES (0, '0') +--- +Error: invalid input: invalid datatype BOOLEAN for INTEGER column int +Error: invalid input: invalid datatype FLOAT for INTEGER column int +Error: invalid input: invalid datatype STRING for INTEGER column int + +# Floats. +> BEGIN +> INSERT INTO datatypes (id, "float") VALUES (1, 3.14) +> INSERT INTO datatypes (id, "float") VALUES (2, -3.14) +> INSERT INTO datatypes (id, "float") VALUES (3, 0.0) +> INSERT INTO datatypes (id, "float") VALUES (4, -0.0) +> INSERT INTO datatypes (id, "float") VALUES (5, 1.23456789012345e308) +> INSERT INTO datatypes (id, "float") VALUES (6, -1.23456789012345e308) +> INSERT INTO datatypes (id, "float") VALUES (7, INFINITY) +> INSERT INTO datatypes (id, "float") VALUES (8, -INFINITY) +> INSERT INTO datatypes (id, "float") VALUES (9, NAN) +> INSERT INTO datatypes (id, "float") VALUES (10, NULL) +--- +ok + +> SELECT * FROM datatypes +> ROLLBACK +--- +1,NULL,NULL,3.14,NULL +2,NULL,NULL,-3.14,NULL +3,NULL,NULL,0,NULL +4,NULL,NULL,-0,NULL +5,NULL,NULL,123456789012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,NULL +6,NULL,NULL,-123456789012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,NULL +7,NULL,NULL,inf,NULL +8,NULL,NULL,-inf,NULL +9,NULL,NULL,NaN,NULL +10,NULL,NULL,NULL,NULL + +!> INSERT INTO datatypes (id, "float") VALUES (0, false) +!> INSERT INTO datatypes (id, "float") VALUES (0, 3) +!> INSERT INTO datatypes (id, "float") VALUES (0, '0') +--- +Error: invalid input: invalid datatype BOOLEAN for FLOAT column float +Error: invalid input: invalid datatype INTEGER for FLOAT column float +Error: invalid input: invalid datatype STRING for FLOAT column float + +# Strings. +> BEGIN +> INSERT INTO datatypes (id, "string") VALUES (1, '') +> INSERT INTO datatypes (id, "string") VALUES (2, ' ') +> INSERT INTO datatypes (id, "string") VALUES (3, 'abc') +> INSERT INTO datatypes (id, "string") VALUES (4, 'Hi! 👋') +> INSERT INTO datatypes (id, "string") VALUES (5, NULL) +--- +ok + +> SELECT * FROM datatypes +> ROLLBACK +--- +1,NULL,NULL,NULL, +2,NULL,NULL,NULL, +3,NULL,NULL,NULL,abc +4,NULL,NULL,NULL,Hi! 👋 +5,NULL,NULL,NULL,NULL + +!> INSERT INTO datatypes (id, "string") VALUES (0, false) +!> INSERT INTO datatypes (id, "string") VALUES (0, 3) +!> INSERT INTO datatypes (id, "string") VALUES (0, 3.14) +--- +Error: invalid input: invalid datatype BOOLEAN for STRING column string +Error: invalid input: invalid datatype INTEGER for STRING column string +Error: invalid input: invalid datatype FLOAT for STRING column string diff --git a/src/sql/testscripts/writes/insert_default b/src/sql/testscripts/writes/insert_default new file mode 100644 index 000000000..57a1d312b --- /dev/null +++ b/src/sql/testscripts/writes/insert_default @@ -0,0 +1,64 @@ +# Tests INSERT handling of DEFAULT values. + +> CREATE TABLE defaults ( \ + id INTEGER PRIMARY KEY, \ + required BOOLEAN NOT NULL, \ + "null" BOOLEAN, \ + "boolean" BOOLEAN DEFAULT TRUE, \ + "float" FLOAT DEFAULT 3.14, \ + "integer" INTEGER DEFAULT 7, \ + "string" STRING DEFAULT 'foo' \ +) +--- +ok + +# INSERT without specifying default columns fills in defaults. +> INSERT INTO defaults (id, required) VALUES (1, true) +> INSERT INTO defaults VALUES (2, false) +--- +ok + +> SELECT * FROM defaults +--- +1,TRUE,NULL,TRUE,3.14,7,foo +2,FALSE,NULL,TRUE,3.14,7,foo + +# INSERT only specifying some default columns fills in rest. +> INSERT INTO defaults ("integer", id, "null", required) VALUES (9, 3, NULL, false) +--- +ok + +> SELECT * FROM defaults +--- +1,TRUE,NULL,TRUE,3.14,7,foo +2,FALSE,NULL,TRUE,3.14,7,foo +3,FALSE,NULL,TRUE,3.14,9,foo + +# Using a variable number of values works. +> INSERT INTO defaults VALUES (4, false, NULL, false), (5, true), (6, true, false, true, 3.14, 9, 'bar') +--- +ok + +> SELECT * FROM defaults +--- +1,TRUE,NULL,TRUE,3.14,7,foo +2,FALSE,NULL,TRUE,3.14,7,foo +3,FALSE,NULL,TRUE,3.14,9,foo +4,FALSE,NULL,FALSE,3.14,7,foo +5,TRUE,NULL,TRUE,3.14,7,foo +6,TRUE,FALSE,TRUE,3.14,9,bar + +# INSERT with all NULLs does not yield default values. +> INSERT INTO defaults VALUES (7, false, NULL, NULL, NULL, NULL, NULL) +--- +ok + +> SELECT * FROM defaults +--- +1,TRUE,NULL,TRUE,3.14,7,foo +2,FALSE,NULL,TRUE,3.14,7,foo +3,FALSE,NULL,TRUE,3.14,9,foo +4,FALSE,NULL,FALSE,3.14,7,foo +5,TRUE,NULL,TRUE,3.14,7,foo +6,TRUE,FALSE,TRUE,3.14,9,bar +7,FALSE,NULL,NULL,NULL,NULL,NULL diff --git a/src/sql/testscripts/writes/insert_index b/src/sql/testscripts/writes/insert_index new file mode 100644 index 000000000..aaad3ec57 --- /dev/null +++ b/src/sql/testscripts/writes/insert_index @@ -0,0 +1,311 @@ +# Tests INSERT index writes. + +> CREATE TABLE "index" ( \ + id INT PRIMARY KEY, \ + "bool" BOOL INDEX, \ + "int" INT INDEX, \ + "float" FLOAT INDEX, \ + "string" STRING INDEX \ +) +--- +ok + +# An INSERT writes to all indexes. +[ops]> INSERT INTO "index" VALUES (1, TRUE, 7, 3.14, 'foo') +--- +storage set mvcc:NextVersion → 3 ["\x00" → "\x03"] +storage set mvcc:TxnActive(2) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x02" → ""] +storage set mvcc:TxnWrite(2, sql:Row("index", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(1)), 2) → Integer(1),Boolean(true),Integer(7),Float(3.14),String("foo") ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x15\x05\x02\x02\x01\x01\x02\x0e\x03\x1f\x85\xebQ\xb8\x1e\t@\x04\x03foo"] +storage set mvcc:TxnWrite(2, sql:Index("index", "bool", Boolean(true))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Boolean(true)), 2) → Integer(1) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(2, sql:Index("index", "int", Integer(7))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Integer(7)), 2) → Integer(1) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(2, sql:Index("index", "float", Float(3.14))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(3.14)), 2) → Integer(1) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(2, sql:Index("index", "string", String("foo"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", String("foo")), 2) → Integer(1) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x03\x01\x02\x02"] +storage delete mvcc:TxnWrite(2, sql:Index("index", "bool", Boolean(true))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00"] +storage delete mvcc:TxnWrite(2, sql:Index("index", "float", Float(3.14))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00"] +storage delete mvcc:TxnWrite(2, sql:Index("index", "int", Integer(7))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00"] +storage delete mvcc:TxnWrite(2, sql:Index("index", "string", String("foo"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(2, sql:Row("index", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnActive(2) ["\x01\x00\x00\x00\x00\x00\x00\x00\x02"] + +# Another insert with the same values adds to the index entries. +[ops]> INSERT INTO "index" VALUES (2, TRUE, 7, 3.14, 'foo') +--- +storage set mvcc:NextVersion → 4 ["\x00" → "\x04"] +storage set mvcc:TxnActive(3) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x03" → ""] +storage set mvcc:TxnWrite(3, sql:Row("index", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(2)), 3) → Integer(2),Boolean(true),Integer(7),Float(3.14),String("foo") ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x15\x05\x02\x04\x01\x01\x02\x0e\x03\x1f\x85\xebQ\xb8\x1e\t@\x04\x03foo"] +storage set mvcc:TxnWrite(3, sql:Index("index", "bool", Boolean(true))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Boolean(true)), 3) → Integer(1),Integer(2) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x05\x02\x02\x02\x02\x04"] +storage set mvcc:TxnWrite(3, sql:Index("index", "int", Integer(7))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Integer(7)), 3) → Integer(1),Integer(2) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x05\x02\x02\x02\x02\x04"] +storage set mvcc:TxnWrite(3, sql:Index("index", "float", Float(3.14))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(3.14)), 3) → Integer(1),Integer(2) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x05\x02\x02\x02\x02\x04"] +storage set mvcc:TxnWrite(3, sql:Index("index", "string", String("foo"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", String("foo")), 3) → Integer(1),Integer(2) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x05\x02\x02\x02\x02\x04"] +storage delete mvcc:TxnWrite(3, sql:Index("index", "bool", Boolean(true))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00"] +storage delete mvcc:TxnWrite(3, sql:Index("index", "float", Float(3.14))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00"] +storage delete mvcc:TxnWrite(3, sql:Index("index", "int", Integer(7))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00"] +storage delete mvcc:TxnWrite(3, sql:Index("index", "string", String("foo"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(3, sql:Row("index", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnActive(3) ["\x01\x00\x00\x00\x00\x00\x00\x00\x03"] + +# An insert with different values writes new index entries. +[ops]> INSERT INTO "index" VALUES (3, FALSE, 0, 2.718, '') +--- +storage set mvcc:NextVersion → 5 ["\x00" → "\x05"] +storage set mvcc:TxnActive(4) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x04" → ""] +storage set mvcc:TxnWrite(4, sql:Row("index", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(3)), 4) → Integer(3),Boolean(false),Integer(0),Float(2.718),String("") ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x12\x05\x02\x06\x01\x00\x02\x00\x03X9\xb4\xc8v\xbe\x05@\x04\x00"] +storage set mvcc:TxnWrite(4, sql:Index("index", "bool", Boolean(false))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Boolean(false)), 4) → Integer(3) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x03\x01\x02\x06"] +storage set mvcc:TxnWrite(4, sql:Index("index", "int", Integer(0))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Integer(0)), 4) → Integer(3) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x03\x01\x02\x06"] +storage set mvcc:TxnWrite(4, sql:Index("index", "float", Float(2.718))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\x05\xbev\xc8\xb49X\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(2.718)), 4) → Integer(3) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\x05\xbev\xc8\xb49X\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x03\x01\x02\x06"] +storage set mvcc:TxnWrite(4, sql:Index("index", "string", String(""))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", String("")), 4) → Integer(3) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04" → "\x01\x03\x01\x02\x06"] +storage delete mvcc:TxnWrite(4, sql:Index("index", "bool", Boolean(false))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(4, sql:Index("index", "float", Float(2.718))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\x05\xbev\xc8\xb49X\x00\x00"] +storage delete mvcc:TxnWrite(4, sql:Index("index", "int", Integer(0))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(4, sql:Index("index", "string", String(""))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(4, sql:Row("index", Integer(3))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00"] +storage delete mvcc:TxnActive(4) ["\x01\x00\x00\x00\x00\x00\x00\x00\x04"] + +# Inserts with NULLS adds NULL entries. These are used for IS NULL queries. +[ops]> INSERT INTO "index" VALUES (4), (5) +--- +storage set mvcc:NextVersion → 6 ["\x00" → "\x06"] +storage set mvcc:TxnActive(5) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x05" → ""] +storage set mvcc:TxnWrite(5, sql:Row("index", Integer(4))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(4)), 5) → Integer(4),Null,Null,Null,Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x07\x05\x02\x08\x00\x00\x00\x00"] +storage set mvcc:TxnWrite(5, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 5) → Integer(4) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x03\x01\x02\x08"] +storage set mvcc:TxnWrite(5, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 5) → Integer(4) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x03\x01\x02\x08"] +storage set mvcc:TxnWrite(5, sql:Index("index", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Null), 5) → Integer(4) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x03\x01\x02\x08"] +storage set mvcc:TxnWrite(5, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 5) → Integer(4) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x03\x01\x02\x08"] +storage set mvcc:TxnWrite(5, sql:Row("index", Integer(5))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(5)), 5) → Integer(5),Null,Null,Null,Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x07\x05\x02\n\x00\x00\x00\x00"] +storage set mvcc:TxnWrite(5, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 5) → Integer(4),Integer(5) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x05\x02\x02\x08\x02\n"] +storage set mvcc:TxnWrite(5, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 5) → Integer(4),Integer(5) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x05\x02\x02\x08\x02\n"] +storage set mvcc:TxnWrite(5, sql:Index("index", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Null), 5) → Integer(4),Integer(5) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x05\x02\x02\x08\x02\n"] +storage set mvcc:TxnWrite(5, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 5) → Integer(4),Integer(5) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05" → "\x01\x05\x02\x02\x08\x02\n"] +storage delete mvcc:TxnWrite(5, sql:Index("index", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(5, sql:Index("index", "float", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(5, sql:Index("index", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(5, sql:Index("index", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(5, sql:Row("index", Integer(4))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00"] +storage delete mvcc:TxnWrite(5, sql:Row("index", Integer(5))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x05\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00"] +storage delete mvcc:TxnActive(5) ["\x01\x00\x00\x00\x00\x00\x00\x00\x05"] + +# Float NaNs are considered equal and indexed. +[ops]> INSERT INTO "index" (id, "float") VALUES (6, NAN), (7, NAN) +--- +storage set mvcc:NextVersion → 7 ["\x00" → "\x07"] +storage set mvcc:TxnActive(6) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x06" → ""] +storage set mvcc:TxnWrite(6, sql:Row("index", Integer(6))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(6)), 6) → Integer(6),Null,Null,Float(NaN),Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x0f\x05\x02\x0c\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf8\x7f\x00"] +storage set mvcc:TxnWrite(6, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 6) → Integer(4),Integer(5),Integer(6) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x07\x03\x02\x08\x02\n\x02\x0c"] +storage set mvcc:TxnWrite(6, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 6) → Integer(4),Integer(5),Integer(6) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x07\x03\x02\x08\x02\n\x02\x0c"] +storage set mvcc:TxnWrite(6, sql:Index("index", "float", Float(NaN))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(NaN)), 6) → Integer(6) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x03\x01\x02\x0c"] +storage set mvcc:TxnWrite(6, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 6) → Integer(4),Integer(5),Integer(6) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x07\x03\x02\x08\x02\n\x02\x0c"] +storage set mvcc:TxnWrite(6, sql:Row("index", Integer(7))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(7)), 6) → Integer(7),Null,Null,Float(NaN),Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x0f\x05\x02\x0e\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf8\x7f\x00"] +storage set mvcc:TxnWrite(6, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 6) → Integer(4),Integer(5),Integer(6),Integer(7) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\t\x04\x02\x08\x02\n\x02\x0c\x02\x0e"] +storage set mvcc:TxnWrite(6, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 6) → Integer(4),Integer(5),Integer(6),Integer(7) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\t\x04\x02\x08\x02\n\x02\x0c\x02\x0e"] +storage set mvcc:TxnWrite(6, sql:Index("index", "float", Float(NaN))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(NaN)), 6) → Integer(6),Integer(7) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\x05\x02\x02\x0c\x02\x0e"] +storage set mvcc:TxnWrite(6, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 6) → Integer(4),Integer(5),Integer(6),Integer(7) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06" → "\x01\t\x04\x02\x08\x02\n\x02\x0c\x02\x0e"] +storage delete mvcc:TxnWrite(6, sql:Index("index", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(6, sql:Index("index", "float", Float(NaN))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(6, sql:Index("index", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(6, sql:Index("index", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(6, sql:Row("index", Integer(6))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00"] +storage delete mvcc:TxnWrite(6, sql:Row("index", Integer(7))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x06\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00"] +storage delete mvcc:TxnActive(6) ["\x01\x00\x00\x00\x00\x00\x00\x00\x06"] + +# Float 0.0 and -0.0 are considered different. +[ops]> INSERT INTO "index" (id, "float") VALUES (8, -0.0), (9, 0.0) +--- +storage set mvcc:NextVersion → 8 ["\x00" → "\x08"] +storage set mvcc:TxnActive(7) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x07" → ""] +storage set mvcc:TxnWrite(7, sql:Row("index", Integer(8))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(8)), 7) → Integer(8),Null,Null,Float(-0.0),Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x0f\x05\x02\x10\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x80\x00"] +storage set mvcc:TxnWrite(7, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 7) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x0b\x05\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10"] +storage set mvcc:TxnWrite(7, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 7) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x0b\x05\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10"] +storage set mvcc:TxnWrite(7, sql:Index("index", "float", Float(-0.0))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x7f\xff\xff\xff\xff\xff\xff\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(-0.0)), 7) → Integer(8) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x7f\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x10"] +storage set mvcc:TxnWrite(7, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 7) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x0b\x05\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10"] +storage set mvcc:TxnWrite(7, sql:Row("index", Integer(9))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\t\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(9)), 7) → Integer(9),Null,Null,Float(0.0),Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x0f\x05\x02\x12\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00"] +storage set mvcc:TxnWrite(7, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 7) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\r\x06\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12"] +storage set mvcc:TxnWrite(7, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 7) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\r\x06\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12"] +storage set mvcc:TxnWrite(7, sql:Index("index", "float", Float(0.0))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(0.0)), 7) → Integer(9) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x12"] +storage set mvcc:TxnWrite(7, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 7) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\r\x06\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12"] +storage delete mvcc:TxnWrite(7, sql:Index("index", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Index("index", "float", Float(-0.0))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x7f\xff\xff\xff\xff\xff\xff\xff\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Index("index", "float", Float(0.0))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Index("index", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Index("index", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Row("index", Integer(8))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Row("index", Integer(9))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\t\x00\x00"] +storage delete mvcc:TxnActive(7) ["\x01\x00\x00\x00\x00\x00\x00\x00\x07"] + +# Float INFINITY is also indexed. +[ops]> INSERT INTO "index" (id, "float") VALUES (10, -INFINITY), (11, INFINITY) +--- +storage set mvcc:NextVersion → 9 ["\x00" → "\t"] +storage set mvcc:TxnActive(8) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x08" → ""] +storage set mvcc:TxnWrite(8, sql:Row("index", Integer(10))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(10)), 8) → Integer(10),Null,Null,Float(-inf),Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x0f\x05\x02\x14\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf0\xff\x00"] +storage set mvcc:TxnWrite(8, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 8) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x0f\x07\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14"] +storage set mvcc:TxnWrite(8, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 8) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x0f\x07\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14"] +storage set mvcc:TxnWrite(8, sql:Index("index", "float", Float(-inf))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x00\xff\x0f\xff\xff\xff\xff\xff\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(-inf)), 8) → Integer(10) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x00\xff\x0f\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x03\x01\x02\x14"] +storage set mvcc:TxnWrite(8, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 8) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x0f\x07\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14"] +storage set mvcc:TxnWrite(8, sql:Row("index", Integer(11))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0b\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(11)), 8) → Integer(11),Null,Null,Float(inf),Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x0f\x05\x02\x16\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf0\x7f\x00"] +storage set mvcc:TxnWrite(8, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 8) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x11\x08\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16"] +storage set mvcc:TxnWrite(8, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 8) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x11\x08\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16"] +storage set mvcc:TxnWrite(8, sql:Index("index", "float", Float(inf))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(inf)), 8) → Integer(11) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x03\x01\x02\x16"] +storage set mvcc:TxnWrite(8, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 8) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x11\x08\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16"] +storage delete mvcc:TxnWrite(8, sql:Index("index", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Index("index", "float", Float(-inf))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x00\xff\x0f\xff\xff\xff\xff\xff\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Index("index", "float", Float(inf))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Index("index", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Index("index", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Row("index", Integer(10))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Row("index", Integer(11))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0b\x00\x00"] +storage delete mvcc:TxnActive(8) ["\x01\x00\x00\x00\x00\x00\x00\x00\x08"] + +[ops]> INSERT INTO "index" (id, "float") VALUES (12, -INFINITY), (13, INFINITY) +--- +storage set mvcc:NextVersion → 10 ["\x00" → "\n"] +storage set mvcc:TxnActive(9) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\t" → ""] +storage set mvcc:TxnWrite(9, sql:Row("index", Integer(12))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0c\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(12)), 9) → Integer(12),Null,Null,Float(-inf),Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x0f\x05\x02\x18\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf0\xff\x00"] +storage set mvcc:TxnWrite(9, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 9) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x13\t\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18"] +storage set mvcc:TxnWrite(9, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 9) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x13\t\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18"] +storage set mvcc:TxnWrite(9, sql:Index("index", "float", Float(-inf))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x00\xff\x0f\xff\xff\xff\xff\xff\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(-inf)), 9) → Integer(10),Integer(12) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x00\xff\x0f\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x05\x02\x02\x14\x02\x18"] +storage set mvcc:TxnWrite(9, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 9) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x13\t\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18"] +storage set mvcc:TxnWrite(9, sql:Row("index", Integer(13))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\r\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(13)), 9) → Integer(13),Null,Null,Float(inf),Null ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x0f\x05\x02\x1a\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf0\x7f\x00"] +storage set mvcc:TxnWrite(9, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 9) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x15\n\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a"] +storage set mvcc:TxnWrite(9, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 9) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x15\n\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a"] +storage set mvcc:TxnWrite(9, sql:Index("index", "float", Float(inf))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Float(inf)), 9) → Integer(11),Integer(13) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x05\x02\x02\x16\x02\x1a"] +storage set mvcc:TxnWrite(9, sql:Index("index", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", Null), 9) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x15\n\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a"] +storage delete mvcc:TxnWrite(9, sql:Index("index", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("index", "float", Float(-inf))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x00\xff\x0f\xff\xff\xff\xff\xff\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("index", "float", Float(inf))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("index", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("index", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Row("index", Integer(12))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0c\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Row("index", Integer(13))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\r\x00\x00"] +storage delete mvcc:TxnActive(9) ["\x01\x00\x00\x00\x00\x00\x00\x00\t"] + +# Empty strings are considered equal. +[ops]> INSERT INTO "index" (id, "string") VALUES (14, ''), (15, '') +--- +storage set mvcc:NextVersion → 11 ["\x00" → "\x0b"] +storage set mvcc:TxnActive(10) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\n" → ""] +storage set mvcc:TxnWrite(10, sql:Row("index", Integer(14))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0e\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(14)), 10) → Integer(14),Null,Null,Null,String("") ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0e\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x08\x05\x02\x1c\x00\x00\x00\x04\x00"] +storage set mvcc:TxnWrite(10, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 10) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13),Integer(14) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x17\x0b\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a\x02\x1c"] +storage set mvcc:TxnWrite(10, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 10) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13),Integer(14) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x17\x0b\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a\x02\x1c"] +storage set mvcc:TxnWrite(10, sql:Index("index", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Null), 10) → Integer(4),Integer(5),Integer(14) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x07\x03\x02\x08\x02\n\x02\x1c"] +storage set mvcc:TxnWrite(10, sql:Index("index", "string", String(""))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", String("")), 10) → Integer(3),Integer(14) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x05\x02\x02\x06\x02\x1c"] +storage set mvcc:TxnWrite(10, sql:Row("index", Integer(15))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0f\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(15)), 10) → Integer(15),Null,Null,Null,String("") ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0f\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x08\x05\x02\x1e\x00\x00\x00\x04\x00"] +storage set mvcc:TxnWrite(10, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 10) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13),Integer(14),Integer(15) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x19\x0c\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a\x02\x1c\x02\x1e"] +storage set mvcc:TxnWrite(10, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 10) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13),Integer(14),Integer(15) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x19\x0c\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a\x02\x1c\x02\x1e"] +storage set mvcc:TxnWrite(10, sql:Index("index", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Null), 10) → Integer(4),Integer(5),Integer(14),Integer(15) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\t\x04\x02\x08\x02\n\x02\x1c\x02\x1e"] +storage set mvcc:TxnWrite(10, sql:Index("index", "string", String(""))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", String("")), 10) → Integer(3),Integer(14),Integer(15) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x07\x03\x02\x06\x02\x1c\x02\x1e"] +storage delete mvcc:TxnWrite(10, sql:Index("index", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("index", "float", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("index", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("index", "string", String(""))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Row("index", Integer(14))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0e\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Row("index", Integer(15))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0f\x00\x00"] +storage delete mvcc:TxnActive(10) ["\x01\x00\x00\x00\x00\x00\x00\x00\n"] + +# Case differences are not considered equal +[ops]> INSERT INTO "index" (id, "string") VALUES (16, 'case'), (17, 'CaSe') +--- +storage set mvcc:NextVersion → 12 ["\x00" → "\x0c"] +storage set mvcc:TxnActive(11) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x0b" → ""] +storage set mvcc:TxnWrite(11, sql:Row("index", Integer(16))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x10\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(16)), 11) → Integer(16),Null,Null,Null,String("case") ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x10\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x0c\x05\x02 \x00\x00\x00\x04\x04case"] +storage set mvcc:TxnWrite(11, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 11) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13),Integer(14),Integer(15),Integer(16) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x1b\r\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a\x02\x1c\x02\x1e\x02 "] +storage set mvcc:TxnWrite(11, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 11) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13),Integer(14),Integer(15),Integer(16) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x1b\r\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a\x02\x1c\x02\x1e\x02 "] +storage set mvcc:TxnWrite(11, sql:Index("index", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Null), 11) → Integer(4),Integer(5),Integer(14),Integer(15),Integer(16) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x0b\x05\x02\x08\x02\n\x02\x1c\x02\x1e\x02 "] +storage set mvcc:TxnWrite(11, sql:Index("index", "string", String("case"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04case\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", String("case")), 11) → Integer(16) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04case\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x03\x01\x02 "] +storage set mvcc:TxnWrite(11, sql:Row("index", Integer(17))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x11\x00\x00" → ""] +storage set mvcc:Version(sql:Row("index", Integer(17)), 11) → Integer(17),Null,Null,Null,String("CaSe") ["\x04\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x11\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x0c\x05\x02\"\x00\x00\x00\x04\x04CaSe"] +storage set mvcc:TxnWrite(11, sql:Index("index", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "bool", Null), 11) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13),Integer(14),Integer(15),Integer(16),Integer(17) ["\x04\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x1d\x0e\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a\x02\x1c\x02\x1e\x02 \x02\""] +storage set mvcc:TxnWrite(11, sql:Index("index", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "int", Null), 11) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13),Integer(14),Integer(15),Integer(16),Integer(17) ["\x04\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x1d\x0e\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a\x02\x1c\x02\x1e\x02 \x02\""] +storage set mvcc:TxnWrite(11, sql:Index("index", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "float", Null), 11) → Integer(4),Integer(5),Integer(14),Integer(15),Integer(16),Integer(17) ["\x04\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\r\x06\x02\x08\x02\n\x02\x1c\x02\x1e\x02 \x02\""] +storage set mvcc:TxnWrite(11, sql:Index("index", "string", String("CaSe"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04CaSe\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("index", "string", String("CaSe")), 11) → Integer(17) ["\x04\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04CaSe\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x03\x01\x02\""] +storage delete mvcc:TxnWrite(11, sql:Index("index", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("index", "float", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("index", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("index", "string", String("CaSe"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04CaSe\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("index", "string", String("case"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01index\x00\xff\x00\xffstring\x00\xff\x00\xff\x04case\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Row("index", Integer(16))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x10\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Row("index", Integer(17))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02index\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x11\x00\x00"] +storage delete mvcc:TxnActive(11) ["\x01\x00\x00\x00\x00\x00\x00\x00\x0b"] diff --git a/src/sql/testscripts/writes/insert_null b/src/sql/testscripts/writes/insert_null new file mode 100644 index 000000000..f61634eb6 --- /dev/null +++ b/src/sql/testscripts/writes/insert_null @@ -0,0 +1,36 @@ +# Tests nullability handling of INSERT. + +# Create a table with NULL constraints. +> CREATE TABLE name ( \ + id INT PRIMARY KEY, \ + "null" STRING NULL, \ + not_null STRING NOT NULL \ +) +--- +ok + +# INSERT with NULL works. +> INSERT INTO name VALUES (1, NULL, 'foo') +--- +ok + +> SELECT * FROM name +--- +1,NULL,foo + +# INSERT with NULL into non-NULL columns errors. +!> INSERT INTO name VALUES (NULL, 'foo', 'bar') +!> INSERT INTO name VALUES (2, 'foo', NULL) +--- +Error: invalid input: NULL value not allowed for column id +Error: invalid input: NULL value not allowed for column not_null + +# Omitting a NULLable column works. +> INSERT INTO name (id, not_null) VALUES (2, 'foo') +--- +ok + +> SELECT * FROM name +--- +1,NULL,foo +2,NULL,foo diff --git a/src/sql/testscripts/writes/insert_primary_key b/src/sql/testscripts/writes/insert_primary_key new file mode 100644 index 000000000..0e73dac0b --- /dev/null +++ b/src/sql/testscripts/writes/insert_primary_key @@ -0,0 +1,100 @@ +# Tests INSERT primary key handling. + +# Boolean. +> CREATE TABLE "bool" (id BOOLEAN PRIMARY KEY) +> INSERT INTO "bool" VALUES (true) +> INSERT INTO "bool" VALUES (false) +--- +ok + +!> INSERT INTO "bool" VALUES (true) +!> INSERT INTO "bool" VALUES (false) +!> INSERT INTO "bool" VALUES (NULL) +--- +Error: invalid input: primary key TRUE already exists +Error: invalid input: primary key FALSE already exists +Error: invalid input: NULL value not allowed for column id + +# Integer. +> CREATE TABLE "int" (id INT PRIMARY KEY) +> INSERT INTO "int" VALUES (1) +> INSERT INTO "int" VALUES (0) +> INSERT INTO "int" VALUES (-1) +> INSERT INTO "int" VALUES (9223372036854775807) +> INSERT INTO "int" VALUES (-9223372036854775807) +--- +ok + +!> INSERT INTO "int" VALUES (1) +!> INSERT INTO "int" VALUES (0) +!> INSERT INTO "int" VALUES (-1) +!> INSERT INTO "int" VALUES (9223372036854775807) +!> INSERT INTO "int" VALUES (-9223372036854775807) +!> INSERT INTO "int" VALUES (NULL) +--- +Error: invalid input: primary key 1 already exists +Error: invalid input: primary key 0 already exists +Error: invalid input: primary key -1 already exists +Error: invalid input: primary key 9223372036854775807 already exists +Error: invalid input: primary key -9223372036854775807 already exists +Error: invalid input: NULL value not allowed for column id + +# Float. +> CREATE TABLE "float" (id FLOAT PRIMARY KEY) +> INSERT INTO "float" VALUES (3.14) +> INSERT INTO "float" VALUES (-3.14) +> INSERT INTO "float" VALUES (0.0) +> INSERT INTO "float" VALUES (-0.0) +> INSERT INTO "float" VALUES (1.23456789012345e308) +> INSERT INTO "float" VALUES (-1.23456789012345e308) +> INSERT INTO "float" VALUES (INFINITY) +> INSERT INTO "float" VALUES (-INFINITY) +> INSERT INTO "float" VALUES (NAN) +--- +ok + +!> INSERT INTO "float" VALUES (3.14) +!> INSERT INTO "float" VALUES (-3.14) +!> INSERT INTO "float" VALUES (0.0) +!> INSERT INTO "float" VALUES (-0.0) +!> INSERT INTO "float" VALUES (1.23456789012345e308) +!> INSERT INTO "float" VALUES (-1.23456789012345e308) +!> INSERT INTO "float" VALUES (INFINITY) +!> INSERT INTO "float" VALUES (-INFINITY) +!> INSERT INTO "float" VALUES (NAN) +!> INSERT INTO "float" VALUES (NULL) +--- +Error: invalid input: primary key 3.14 already exists +Error: invalid input: primary key -3.14 already exists +Error: invalid input: primary key 0 already exists +Error: invalid input: primary key -0 already exists +Error: invalid input: primary key 123456789012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 already exists +Error: invalid input: primary key -123456789012345000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 already exists +Error: invalid input: primary key inf already exists +Error: invalid input: primary key -inf already exists +Error: invalid input: primary key NaN already exists +Error: invalid input: NULL value not allowed for column id + +# String. +> CREATE TABLE "string" (id STRING PRIMARY KEY) +> INSERT INTO "string" VALUES ('') +> INSERT INTO "string" VALUES (' ') +> INSERT INTO "string" VALUES ('abc') +> INSERT INTO "string" VALUES ('ABC') +> INSERT INTO "string" VALUES ('Hi! 👋') +--- +ok + +!> INSERT INTO "string" VALUES ('') +!> INSERT INTO "string" VALUES (' ') +!> INSERT INTO "string" VALUES ('abc') +!> INSERT INTO "string" VALUES ('ABC') +!> INSERT INTO "string" VALUES ('Hi! 👋') +!> INSERT INTO "string" VALUES (NULL) +--- +Error: invalid input: primary key already exists +Error: invalid input: primary key already exists +Error: invalid input: primary key abc already exists +Error: invalid input: primary key ABC already exists +Error: invalid input: primary key Hi! 👋 already exists +Error: invalid input: NULL value not allowed for column id diff --git a/src/sql/testscripts/writes/insert_reference b/src/sql/testscripts/writes/insert_reference new file mode 100644 index 000000000..1f3004e26 --- /dev/null +++ b/src/sql/testscripts/writes/insert_reference @@ -0,0 +1,158 @@ +# Tests INSERT foreign key references. + +# Create reference tables for all datatypes. +> CREATE TABLE "bool" (id BOOL PRIMARY KEY) +> INSERT INTO "bool" VALUES (true) + +> CREATE TABLE "int" (id INT PRIMARY KEY) +> INSERT INTO "int" VALUES (-1), (0), (1) + +> CREATE TABLE "float" (id FLOAT PRIMARY KEY) +> INSERT INTO "float" VALUES (3.14), (0.0), (NAN), (INFINITY) + +> CREATE TABLE "string" (id STRING PRIMARY KEY) +> INSERT INTO "string" VALUES (''), ('foo') + +> CREATE TABLE name ( \ + id INT PRIMARY KEY, \ + "bool" BOOL REFERENCES "bool", \ + "int" INT REFERENCES "int", \ + "float" FLOAT REFERENCES "float", \ + "string" STRING REFERENCES "string" \ +) +--- +ok + +# INSERTs with existing references work, and update the index entries. +[ops]> INSERT INTO name VALUES (1, true, 1, 3.14, 'foo') +--- +storage set mvcc:NextVersion → 11 ["\x00" → "\x0b"] +storage set mvcc:TxnActive(10) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\n" → ""] +storage set mvcc:TxnWrite(10, sql:Row("name", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(1)), 10) → Integer(1),Boolean(true),Integer(1),Float(3.14),String("foo") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x15\x05\x02\x02\x01\x01\x02\x02\x03\x1f\x85\xebQ\xb8\x1e\t@\x04\x03foo"] +storage set mvcc:TxnWrite(10, sql:Index("name", "bool", Boolean(true))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01name\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "bool", Boolean(true)), 10) → Integer(1) ["\x04\x01name\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(10, sql:Index("name", "int", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01name\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "int", Integer(1)), 10) → Integer(1) ["\x04\x01name\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(10, sql:Index("name", "float", Float(3.14))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01name\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "float", Float(3.14)), 10) → Integer(1) ["\x04\x01name\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(10, sql:Index("name", "string", String("foo"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01name\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "string", String("foo")), 10) → Integer(1) ["\x04\x01name\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x03\x01\x02\x02"] +storage delete mvcc:TxnWrite(10, sql:Index("name", "bool", Boolean(true))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01name\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("name", "float", Float(3.14))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01name\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("name", "int", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01name\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("name", "string", String("foo"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01name\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Row("name", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnActive(10) ["\x01\x00\x00\x00\x00\x00\x00\x00\n"] + +# INSERTs error on missing references. +!> INSERT INTO name (id, "bool") VALUES (2, FALSE) +!> INSERT INTO name (id, "int") VALUES (2, 7) +!> INSERT INTO name (id, "float") VALUES (2, 2.718) +!> INSERT INTO name (id, "string") VALUES (2, 'bar') +--- +Error: invalid input: reference FALSE not in table bool +Error: invalid input: reference 7 not in table int +Error: invalid input: reference 2.718 not in table float +Error: invalid input: reference bar not in table string + +# -0.0 is not 0.0. +!> INSERT INTO name (id, "float") VALUES (2, -0.0) +--- +Error: invalid input: reference -0 not in table float + +# NAN is considered equal. +# TODO: possibly shouldn't. +[ops]> INSERT INTO name (id, "float") VALUES (2, NAN) +--- +storage set mvcc:NextVersion → 17 ["\x00" → "\x11"] +storage set mvcc:TxnActive(16) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x10" → ""] +storage set mvcc:TxnWrite(16, sql:Row("name", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(2)), 16) → Integer(2),Null,Null,Float(NaN),Null ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x0f\x05\x02\x04\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf8\x7f\x00"] +storage set mvcc:TxnWrite(16, sql:Index("name", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01name\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "bool", Null), 16) → Integer(2) ["\x04\x01name\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x03\x01\x02\x04"] +storage set mvcc:TxnWrite(16, sql:Index("name", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01name\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "int", Null), 16) → Integer(2) ["\x04\x01name\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x03\x01\x02\x04"] +storage set mvcc:TxnWrite(16, sql:Index("name", "float", Float(NaN))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01name\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "float", Float(NaN)), 16) → Integer(2) ["\x04\x01name\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x03\x01\x02\x04"] +storage set mvcc:TxnWrite(16, sql:Index("name", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01name\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("name", "string", Null), 16) → Integer(2) ["\x04\x01name\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x03\x01\x02\x04"] +storage delete mvcc:TxnWrite(16, sql:Index("name", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01name\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(16, sql:Index("name", "float", Float(NaN))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01name\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(16, sql:Index("name", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01name\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(16, sql:Index("name", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01name\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(16, sql:Row("name", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnActive(16) ["\x01\x00\x00\x00\x00\x00\x00\x00\x10"] + +# INFINITY is also valid. +> INSERT INTO name (id, "float") VALUES (3, INFINITY) +--- +ok + +# References are case sensitive. +!> INSERT INTO name (id, "string") VALUES (4, 'FOO') +--- +Error: invalid input: reference FOO not in table string + +# Empty strings are valid references. +> INSERT INTO name (id, "string") VALUES (5, '') +--- +ok + +# NULLs are valid. +> INSERT INTO name (id) VALUES (6) +--- +ok + +> SELECT * FROM name +--- +1,TRUE,1,3.14,foo +2,NULL,NULL,NaN,NULL +3,NULL,NULL,inf,NULL +5,NULL,NULL,NULL, +6,NULL,NULL,NULL,NULL + +# Self references are fine. +> CREATE TABLE self (id INT PRIMARY KEY, self_id INT REFERENCES self) +--- +ok + +[ops]> INSERT INTO self VALUES (1, 1) +--- +storage set mvcc:NextVersion → 23 ["\x00" → "\x17"] +storage set mvcc:TxnActive(22) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x16" → ""] +storage set mvcc:TxnWrite(22, sql:Row("self", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x16\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Row("self", Integer(1)), 22) → Integer(1),Integer(1) ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16" → "\x01\x05\x02\x02\x02\x02\x02"] +storage set mvcc:TxnWrite(22, sql:Index("self", "self_id", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x16\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Index("self", "self_id", Integer(1)), 22) → Integer(1) ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16" → "\x01\x03\x01\x02\x02"] +storage delete mvcc:TxnWrite(22, sql:Index("self", "self_id", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x16\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnWrite(22, sql:Row("self", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x16\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnActive(22) ["\x01\x00\x00\x00\x00\x00\x00\x00\x16"] + +[ops]> INSERT INTO self VALUES (2, 1) +--- +storage set mvcc:NextVersion → 24 ["\x00" → "\x18"] +storage set mvcc:TxnActive(23) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x17" → ""] +storage set mvcc:TxnWrite(23, sql:Row("self", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x17\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Row("self", Integer(2)), 23) → Integer(2),Integer(1) ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17" → "\x01\x05\x02\x02\x04\x02\x02"] +storage set mvcc:TxnWrite(23, sql:Index("self", "self_id", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x17\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Index("self", "self_id", Integer(1)), 23) → Integer(1),Integer(2) ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x17" → "\x01\x05\x02\x02\x02\x02\x04"] +storage delete mvcc:TxnWrite(23, sql:Index("self", "self_id", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x17\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnWrite(23, sql:Row("self", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x17\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnActive(23) ["\x01\x00\x00\x00\x00\x00\x00\x00\x17"] + +[ops]> INSERT INTO self VALUES (3, NULL) +--- +storage set mvcc:NextVersion → 25 ["\x00" → "\x19"] +storage set mvcc:TxnActive(24) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x18" → ""] +storage set mvcc:TxnWrite(24, sql:Row("self", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x18\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("self", Integer(3)), 24) → Integer(3),Null ["\x04\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18" → "\x01\x04\x02\x02\x06\x00"] +storage set mvcc:TxnWrite(24, sql:Index("self", "self_id", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x18\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("self", "self_id", Null), 24) → Integer(3) ["\x04\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18" → "\x01\x03\x01\x02\x06"] +storage delete mvcc:TxnWrite(24, sql:Index("self", "self_id", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x18\x01self\x00\xff\x00\xffself_id\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(24, sql:Row("self", Integer(3))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x18\x02self\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00"] +storage delete mvcc:TxnActive(24) ["\x01\x00\x00\x00\x00\x00\x00\x00\x18"] + +!> INSERT INTO self VALUES (4, 9) +--- +Error: invalid input: reference 9 not in table self diff --git a/src/sql/testscripts/writes/insert_unique b/src/sql/testscripts/writes/insert_unique new file mode 100644 index 000000000..512994a38 --- /dev/null +++ b/src/sql/testscripts/writes/insert_unique @@ -0,0 +1,291 @@ +# Tests INSERT index writes. + +> CREATE TABLE "unique" ( \ + id INT PRIMARY KEY, \ + "bool" BOOL UNIQUE, \ + "int" INT UNIQUE, \ + "float" FLOAT UNIQUE, \ + "string" STRING UNIQUE \ +) +--- +ok + +# An INSERT writes to all indexes. +[ops]> INSERT INTO "unique" VALUES (1, TRUE, 7, 3.14, 'foo') +--- +storage set mvcc:NextVersion → 3 ["\x00" → "\x03"] +storage set mvcc:TxnActive(2) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x02" → ""] +storage set mvcc:TxnWrite(2, sql:Row("unique", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(1)), 2) → Integer(1),Boolean(true),Integer(7),Float(3.14),String("foo") ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x15\x05\x02\x02\x01\x01\x02\x0e\x03\x1f\x85\xebQ\xb8\x1e\t@\x04\x03foo"] +storage set mvcc:TxnWrite(2, sql:Index("unique", "bool", Boolean(true))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Boolean(true)), 2) → Integer(1) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(2, sql:Index("unique", "int", Integer(7))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Integer(7)), 2) → Integer(1) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(2, sql:Index("unique", "float", Float(3.14))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Float(3.14)), 2) → Integer(1) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x03\x01\x02\x02"] +storage set mvcc:TxnWrite(2, sql:Index("unique", "string", String("foo"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", String("foo")), 2) → Integer(1) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x03\x01\x02\x02"] +storage delete mvcc:TxnWrite(2, sql:Index("unique", "bool", Boolean(true))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x01\x00\x00"] +storage delete mvcc:TxnWrite(2, sql:Index("unique", "float", Float(3.14))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\t\x1e\xb8Q\xeb\x85\x1f\x00\x00"] +storage delete mvcc:TxnWrite(2, sql:Index("unique", "int", Integer(7))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00"] +storage delete mvcc:TxnWrite(2, sql:Index("unique", "string", String("foo"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04foo\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(2, sql:Row("unique", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x02\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnActive(2) ["\x01\x00\x00\x00\x00\x00\x00\x00\x02"] + +# Another insert with the same values errors for all indexes. +!> INSERT INTO "unique" (id, "bool") VALUES (2, TRUE) +!> INSERT INTO "unique" (id, "int") VALUES (2, 7) +!> INSERT INTO "unique" (id, "float") VALUES (2, 3.14) +!> INSERT INTO "unique" (id, "string") VALUES (2, 'foo') +--- +Error: invalid input: value TRUE already in unique column bool +Error: invalid input: value 7 already in unique column int +Error: invalid input: value 3.14 already in unique column float +Error: invalid input: value foo already in unique column string + +# An insert with different values writes new index entries. +[ops]> INSERT INTO "unique" VALUES (3, FALSE, 0, 2.718, 'bar') +--- +storage set mvcc:NextVersion → 8 ["\x00" → "\x08"] +storage set mvcc:TxnActive(7) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x07" → ""] +storage set mvcc:TxnWrite(7, sql:Row("unique", Integer(3))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(3)), 7) → Integer(3),Boolean(false),Integer(0),Float(2.718),String("bar") ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x15\x05\x02\x06\x01\x00\x02\x00\x03X9\xb4\xc8v\xbe\x05@\x04\x03bar"] +storage set mvcc:TxnWrite(7, sql:Index("unique", "bool", Boolean(false))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Boolean(false)), 7) → Integer(3) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x06"] +storage set mvcc:TxnWrite(7, sql:Index("unique", "int", Integer(0))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Integer(0)), 7) → Integer(3) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x06"] +storage set mvcc:TxnWrite(7, sql:Index("unique", "float", Float(2.718))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\x05\xbev\xc8\xb49X\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Float(2.718)), 7) → Integer(3) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\x05\xbev\xc8\xb49X\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x06"] +storage set mvcc:TxnWrite(7, sql:Index("unique", "string", String("bar"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04bar\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", String("bar")), 7) → Integer(3) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04bar\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07" → "\x01\x03\x01\x02\x06"] +storage delete mvcc:TxnWrite(7, sql:Index("unique", "bool", Boolean(false))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x01\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Index("unique", "float", Float(2.718))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xc0\x05\xbev\xc8\xb49X\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Index("unique", "int", Integer(0))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Index("unique", "string", String("bar"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04bar\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(7, sql:Row("unique", Integer(3))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x07\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x03\x00\x00"] +storage delete mvcc:TxnActive(7) ["\x01\x00\x00\x00\x00\x00\x00\x00\x07"] + +# Inserts with NULLS adds NULL entries. Duplicates are allowed +[ops]> INSERT INTO "unique" VALUES (4) +--- +storage set mvcc:NextVersion → 9 ["\x00" → "\t"] +storage set mvcc:TxnActive(8) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x08" → ""] +storage set mvcc:TxnWrite(8, sql:Row("unique", Integer(4))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(4)), 8) → Integer(4),Null,Null,Null,Null ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x07\x05\x02\x08\x00\x00\x00\x00"] +storage set mvcc:TxnWrite(8, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 8) → Integer(4) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x03\x01\x02\x08"] +storage set mvcc:TxnWrite(8, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 8) → Integer(4) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x03\x01\x02\x08"] +storage set mvcc:TxnWrite(8, sql:Index("unique", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Null), 8) → Integer(4) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x03\x01\x02\x08"] +storage set mvcc:TxnWrite(8, sql:Index("unique", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", Null), 8) → Integer(4) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08" → "\x01\x03\x01\x02\x08"] +storage delete mvcc:TxnWrite(8, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Index("unique", "float", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Index("unique", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(8, sql:Row("unique", Integer(4))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x08\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x04\x00\x00"] +storage delete mvcc:TxnActive(8) ["\x01\x00\x00\x00\x00\x00\x00\x00\x08"] + +[ops]> INSERT INTO "unique" VALUES (5) +--- +storage set mvcc:NextVersion → 10 ["\x00" → "\n"] +storage set mvcc:TxnActive(9) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\t" → ""] +storage set mvcc:TxnWrite(9, sql:Row("unique", Integer(5))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(5)), 9) → Integer(5),Null,Null,Null,Null ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x07\x05\x02\n\x00\x00\x00\x00"] +storage set mvcc:TxnWrite(9, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 9) → Integer(4),Integer(5) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x05\x02\x02\x08\x02\n"] +storage set mvcc:TxnWrite(9, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 9) → Integer(4),Integer(5) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x05\x02\x02\x08\x02\n"] +storage set mvcc:TxnWrite(9, sql:Index("unique", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Null), 9) → Integer(4),Integer(5) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x05\x02\x02\x08\x02\n"] +storage set mvcc:TxnWrite(9, sql:Index("unique", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", Null), 9) → Integer(4),Integer(5) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\t" → "\x01\x05\x02\x02\x08\x02\n"] +storage delete mvcc:TxnWrite(9, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("unique", "float", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Index("unique", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(9, sql:Row("unique", Integer(5))) ["\x03\x00\x00\x00\x00\x00\x00\x00\t\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x05\x00\x00"] +storage delete mvcc:TxnActive(9) ["\x01\x00\x00\x00\x00\x00\x00\x00\t"] + +# Float NaNs are considered different and allowed. +# TODO: should these be considered equal? +[ops]> INSERT INTO "unique" (id, "float") VALUES (6, NAN) +--- +storage set mvcc:NextVersion → 11 ["\x00" → "\x0b"] +storage set mvcc:TxnActive(10) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\n" → ""] +storage set mvcc:TxnWrite(10, sql:Row("unique", Integer(6))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(6)), 10) → Integer(6),Null,Null,Float(NaN),Null ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x0f\x05\x02\x0c\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf8\x7f\x00"] +storage set mvcc:TxnWrite(10, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 10) → Integer(4),Integer(5),Integer(6) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x07\x03\x02\x08\x02\n\x02\x0c"] +storage set mvcc:TxnWrite(10, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 10) → Integer(4),Integer(5),Integer(6) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x07\x03\x02\x08\x02\n\x02\x0c"] +storage set mvcc:TxnWrite(10, sql:Index("unique", "float", Float(NaN))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Float(NaN)), 10) → Integer(6) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x03\x01\x02\x0c"] +storage set mvcc:TxnWrite(10, sql:Index("unique", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", Null), 10) → Integer(4),Integer(5),Integer(6) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\n" → "\x01\x07\x03\x02\x08\x02\n\x02\x0c"] +storage delete mvcc:TxnWrite(10, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("unique", "float", Float(NaN))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Index("unique", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(10, sql:Row("unique", Integer(6))) ["\x03\x00\x00\x00\x00\x00\x00\x00\n\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x06\x00\x00"] +storage delete mvcc:TxnActive(10) ["\x01\x00\x00\x00\x00\x00\x00\x00\n"] + +[ops]> INSERT INTO "unique" (id, "float") VALUES (7, NAN) +--- +storage set mvcc:NextVersion → 12 ["\x00" → "\x0c"] +storage set mvcc:TxnActive(11) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x0b" → ""] +storage set mvcc:TxnWrite(11, sql:Row("unique", Integer(7))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(7)), 11) → Integer(7),Null,Null,Float(NaN),Null ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x0f\x05\x02\x0e\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf8\x7f\x00"] +storage set mvcc:TxnWrite(11, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 11) → Integer(4),Integer(5),Integer(6),Integer(7) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\t\x04\x02\x08\x02\n\x02\x0c\x02\x0e"] +storage set mvcc:TxnWrite(11, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 11) → Integer(4),Integer(5),Integer(6),Integer(7) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\t\x04\x02\x08\x02\n\x02\x0c\x02\x0e"] +storage set mvcc:TxnWrite(11, sql:Index("unique", "float", Float(NaN))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Float(NaN)), 11) → Integer(6),Integer(7) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\x05\x02\x02\x0c\x02\x0e"] +storage set mvcc:TxnWrite(11, sql:Index("unique", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", Null), 11) → Integer(4),Integer(5),Integer(6),Integer(7) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b" → "\x01\t\x04\x02\x08\x02\n\x02\x0c\x02\x0e"] +storage delete mvcc:TxnWrite(11, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("unique", "float", Float(NaN))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf8\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Index("unique", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(11, sql:Row("unique", Integer(7))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0b\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x07\x00\x00"] +storage delete mvcc:TxnActive(11) ["\x01\x00\x00\x00\x00\x00\x00\x00\x0b"] + +# Float 0.0 and -0.0 are considered different. +[ops]> INSERT INTO "unique" (id, "float") VALUES (8, -0.0) +--- +storage set mvcc:NextVersion → 13 ["\x00" → "\r"] +storage set mvcc:TxnActive(12) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x0c" → ""] +storage set mvcc:TxnWrite(12, sql:Row("unique", Integer(8))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(8)), 12) → Integer(8),Null,Null,Float(-0.0),Null ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c" → "\x01\x0f\x05\x02\x10\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x80\x00"] +storage set mvcc:TxnWrite(12, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 12) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c" → "\x01\x0b\x05\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10"] +storage set mvcc:TxnWrite(12, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 12) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c" → "\x01\x0b\x05\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10"] +storage set mvcc:TxnWrite(12, sql:Index("unique", "float", Float(-0.0))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x7f\xff\xff\xff\xff\xff\xff\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Float(-0.0)), 12) → Integer(8) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x7f\xff\xff\xff\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c" → "\x01\x03\x01\x02\x10"] +storage set mvcc:TxnWrite(12, sql:Index("unique", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", Null), 12) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0c" → "\x01\x0b\x05\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10"] +storage delete mvcc:TxnWrite(12, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(12, sql:Index("unique", "float", Float(-0.0))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x7f\xff\xff\xff\xff\xff\xff\xff\x00\x00"] +storage delete mvcc:TxnWrite(12, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(12, sql:Index("unique", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(12, sql:Row("unique", Integer(8))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0c\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x08\x00\x00"] +storage delete mvcc:TxnActive(12) ["\x01\x00\x00\x00\x00\x00\x00\x00\x0c"] + +[ops]> INSERT INTO "unique" (id, "float") VALUES (9, 0.0) +--- +storage set mvcc:NextVersion → 14 ["\x00" → "\x0e"] +storage set mvcc:TxnActive(13) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\r" → ""] +storage set mvcc:TxnWrite(13, sql:Row("unique", Integer(9))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\t\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(9)), 13) → Integer(9),Null,Null,Float(0.0),Null ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\t\x00\x00\x00\x00\x00\x00\x00\x00\x00\r" → "\x01\x0f\x05\x02\x12\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00"] +storage set mvcc:TxnWrite(13, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 13) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\r" → "\x01\r\x06\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12"] +storage set mvcc:TxnWrite(13, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 13) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\r" → "\x01\r\x06\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12"] +storage set mvcc:TxnWrite(13, sql:Index("unique", "float", Float(0.0))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Float(0.0)), 13) → Integer(9) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\r" → "\x01\x03\x01\x02\x12"] +storage set mvcc:TxnWrite(13, sql:Index("unique", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", Null), 13) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\r" → "\x01\r\x06\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12"] +storage delete mvcc:TxnWrite(13, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(13, sql:Index("unique", "float", Float(0.0))) ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(13, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(13, sql:Index("unique", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(13, sql:Row("unique", Integer(9))) ["\x03\x00\x00\x00\x00\x00\x00\x00\r\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\t\x00\x00"] +storage delete mvcc:TxnActive(13) ["\x01\x00\x00\x00\x00\x00\x00\x00\r"] + +# Float INFINITY is also unique. +[ops]> INSERT INTO "unique" (id, "float") VALUES (10, INFINITY) +--- +storage set mvcc:NextVersion → 15 ["\x00" → "\x0f"] +storage set mvcc:TxnActive(14) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x0e" → ""] +storage set mvcc:TxnWrite(14, sql:Row("unique", Integer(10))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(10)), 14) → Integer(10),Null,Null,Float(inf),Null ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x01\x0f\x05\x02\x14\x00\x00\x03\x00\x00\x00\x00\x00\x00\xf0\x7f\x00"] +storage set mvcc:TxnWrite(14, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 14) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x01\x0f\x07\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14"] +storage set mvcc:TxnWrite(14, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 14) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x01\x0f\x07\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14"] +storage set mvcc:TxnWrite(14, sql:Index("unique", "float", Float(inf))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Float(inf)), 14) → Integer(10) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x01\x03\x01\x02\x14"] +storage set mvcc:TxnWrite(14, sql:Index("unique", "string", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", Null), 14) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0e" → "\x01\x0f\x07\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14"] +storage delete mvcc:TxnWrite(14, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(14, sql:Index("unique", "float", Float(inf))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x03\xff\xf0\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(14, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(14, sql:Index("unique", "string", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(14, sql:Row("unique", Integer(10))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x0e\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\n\x00\x00"] +storage delete mvcc:TxnActive(14) ["\x01\x00\x00\x00\x00\x00\x00\x00\x0e"] + +!> INSERT INTO "unique" (id, "float") VALUES (11, INFINITY) +--- +Error: invalid input: value inf already in unique column float + +# Empty strings are considered equal. +[ops]> INSERT INTO "unique" (id, "string") VALUES (11, '') +--- +storage set mvcc:NextVersion → 17 ["\x00" → "\x11"] +storage set mvcc:TxnActive(16) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x10" → ""] +storage set mvcc:TxnWrite(16, sql:Row("unique", Integer(11))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0b\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(11)), 16) → Integer(11),Null,Null,Null,String("") ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x08\x05\x02\x16\x00\x00\x00\x04\x00"] +storage set mvcc:TxnWrite(16, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 16) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x11\x08\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16"] +storage set mvcc:TxnWrite(16, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 16) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x11\x08\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16"] +storage set mvcc:TxnWrite(16, sql:Index("unique", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Null), 16) → Integer(4),Integer(5),Integer(11) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x07\x03\x02\x08\x02\n\x02\x16"] +storage set mvcc:TxnWrite(16, sql:Index("unique", "string", String(""))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", String("")), 16) → Integer(11) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10" → "\x01\x03\x01\x02\x16"] +storage delete mvcc:TxnWrite(16, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(16, sql:Index("unique", "float", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(16, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(16, sql:Index("unique", "string", String(""))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(16, sql:Row("unique", Integer(11))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x10\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0b\x00\x00"] +storage delete mvcc:TxnActive(16) ["\x01\x00\x00\x00\x00\x00\x00\x00\x10"] + +!> INSERT INTO "unique" (id, "string") VALUES (12, '') +--- +Error: invalid input: value already in unique column string + +# Case differences are not considered equal. +[ops]> INSERT INTO "unique" (id, "string") VALUES (12, 'case') +--- +storage set mvcc:NextVersion → 19 ["\x00" → "\x13"] +storage set mvcc:TxnActive(18) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x12" → ""] +storage set mvcc:TxnWrite(18, sql:Row("unique", Integer(12))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0c\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(12)), 18) → Integer(12),Null,Null,Null,String("case") ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12" → "\x01\x0c\x05\x02\x18\x00\x00\x00\x04\x04case"] +storage set mvcc:TxnWrite(18, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 18) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12" → "\x01\x13\t\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18"] +storage set mvcc:TxnWrite(18, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 18) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12" → "\x01\x13\t\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18"] +storage set mvcc:TxnWrite(18, sql:Index("unique", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Null), 18) → Integer(4),Integer(5),Integer(11),Integer(12) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12" → "\x01\t\x04\x02\x08\x02\n\x02\x16\x02\x18"] +storage set mvcc:TxnWrite(18, sql:Index("unique", "string", String("case"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04case\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", String("case")), 18) → Integer(12) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04case\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12" → "\x01\x03\x01\x02\x18"] +storage delete mvcc:TxnWrite(18, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(18, sql:Index("unique", "float", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(18, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(18, sql:Index("unique", "string", String("case"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04case\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(18, sql:Row("unique", Integer(12))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x12\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x0c\x00\x00"] +storage delete mvcc:TxnActive(18) ["\x01\x00\x00\x00\x00\x00\x00\x00\x12"] + +[ops]> INSERT INTO "unique" (id, "string") VALUES (13, 'CaSe') +--- +storage set mvcc:NextVersion → 20 ["\x00" → "\x14"] +storage set mvcc:TxnActive(19) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x13" → ""] +storage set mvcc:TxnWrite(19, sql:Row("unique", Integer(13))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\r\x00\x00" → ""] +storage set mvcc:Version(sql:Row("unique", Integer(13)), 19) → Integer(13),Null,Null,Null,String("CaSe") ["\x04\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\r\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13" → "\x01\x0c\x05\x02\x1a\x00\x00\x00\x04\x04CaSe"] +storage set mvcc:TxnWrite(19, sql:Index("unique", "bool", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "bool", Null), 19) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13) ["\x04\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13" → "\x01\x15\n\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a"] +storage set mvcc:TxnWrite(19, sql:Index("unique", "int", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "int", Null), 19) → Integer(4),Integer(5),Integer(6),Integer(7),Integer(8),Integer(9),Integer(10),Integer(11),Integer(12),Integer(13) ["\x04\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13" → "\x01\x15\n\x02\x08\x02\n\x02\x0c\x02\x0e\x02\x10\x02\x12\x02\x14\x02\x16\x02\x18\x02\x1a"] +storage set mvcc:TxnWrite(19, sql:Index("unique", "float", Null)) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "float", Null), 19) → Integer(4),Integer(5),Integer(11),Integer(12),Integer(13) ["\x04\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13" → "\x01\x0b\x05\x02\x08\x02\n\x02\x16\x02\x18\x02\x1a"] +storage set mvcc:TxnWrite(19, sql:Index("unique", "string", String("CaSe"))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04CaSe\x00\xff\x00\xff\x00\x00" → ""] +storage set mvcc:Version(sql:Index("unique", "string", String("CaSe")), 19) → Integer(13) ["\x04\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04CaSe\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x13" → "\x01\x03\x01\x02\x1a"] +storage delete mvcc:TxnWrite(19, sql:Index("unique", "bool", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x01unique\x00\xff\x00\xffbool\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(19, sql:Index("unique", "float", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x01unique\x00\xff\x00\xfffloat\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(19, sql:Index("unique", "int", Null)) ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x01unique\x00\xff\x00\xffint\x00\xff\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(19, sql:Index("unique", "string", String("CaSe"))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x01unique\x00\xff\x00\xffstring\x00\xff\x00\xff\x04CaSe\x00\xff\x00\xff\x00\x00"] +storage delete mvcc:TxnWrite(19, sql:Row("unique", Integer(13))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x13\x02unique\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\r\x00\x00"] +storage delete mvcc:TxnActive(19) ["\x01\x00\x00\x00\x00\x00\x00\x00\x13"] diff --git a/src/sql/testscripts/writes/update b/src/sql/testscripts/writes/update new file mode 100644 index 000000000..60dac98b0 --- /dev/null +++ b/src/sql/testscripts/writes/update @@ -0,0 +1,59 @@ +# Tests basic UPDATE functionality. + +> CREATE TABLE name (id INT PRIMARY KEY, value STRING) +> INSERT INTO name VALUES (1, 'a'), (2, 'b') +--- +ok + +# UPDATE updates rows, and returns the number of rows. +[plan,result,ops]> UPDATE name SET value = 'foo' +--- +Update: name (value=foo) +└─ Scan: name +Update { count: 2 } +storage set mvcc:NextVersion → 4 ["\x00" → "\x04"] +storage set mvcc:TxnActive(3) → "" ["\x01\x00\x00\x00\x00\x00\x00\x00\x03" → ""] +storage set mvcc:TxnWrite(3, sql:Row("name", Integer(1))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(1)), 3) → Integer(1),String("foo") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x08\x02\x02\x02\x04\x03foo"] +storage set mvcc:TxnWrite(3, sql:Row("name", Integer(2))) → "" ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00" → ""] +storage set mvcc:Version(sql:Row("name", Integer(2)), 3) → Integer(2),String("foo") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x08\x02\x02\x04\x04\x03foo"] +storage delete mvcc:TxnWrite(3, sql:Row("name", Integer(1))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00"] +storage delete mvcc:TxnWrite(3, sql:Row("name", Integer(2))) ["\x03\x00\x00\x00\x00\x00\x00\x00\x03\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00"] +storage delete mvcc:TxnActive(3) ["\x01\x00\x00\x00\x00\x00\x00\x00\x03"] + +> SELECT * FROM name +--- +1,foo +2,foo + +dump +--- +mvcc:NextVersion → 4 ["\x00" → "\x04"] +mvcc:Version(sql:Table("name"), 1) → CREATE TABLE name ( id INTEGER PRIMARY KEY, value STRING DEFAULT NULL ) ["\x04\x00\xffname\x00\xff\x00\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01" → "\x01\x1d\x04name\x00\x02\x02id\x01\x00\x00\x01\x00\x00\x05value\x03\x01\x01\x00\x00\x00\x00"] +mvcc:Version(sql:Row("name", Integer(1)), 2) → Integer(1),String("a") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x02\x04\x01a"] +mvcc:Version(sql:Row("name", Integer(1)), 3) → Integer(1),String("foo") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x08\x02\x02\x02\x04\x03foo"] +mvcc:Version(sql:Row("name", Integer(2)), 2) → Integer(2),String("b") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02" → "\x01\x06\x02\x02\x04\x04\x01b"] +mvcc:Version(sql:Row("name", Integer(2)), 3) → Integer(2),String("foo") ["\x04\x02name\x00\xff\x00\xff\x02\x80\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03" → "\x01\x08\x02\x02\x04\x04\x03foo"] + +# Bare UPDATE errors. +!> UPDATE +!> UPDATE name +!> UPDATE name SET +!> UPDATE name SET value +--- +Error: invalid input: unexpected end of input +Error: invalid input: unexpected end of input +Error: invalid input: unexpected end of input +Error: invalid input: unexpected end of input + +# Unknown table or column errors. +!> UPDATE foo SET value = 'bar' +!> UPDATE name SET foo = 'bar' +--- +Error: invalid input: table foo does not exist +Error: invalid input: unknown field foo + +# Specifying the same column multiple times errors. +!> UPDATE name SET value = 'e', value = 'f' +--- +Error: invalid input: column value set multiple times diff --git a/tests/sql/mutation.rs b/tests/sql/mutation.rs index 68fe8d694..3ec190ef3 100644 --- a/tests/sql/mutation.rs +++ b/tests/sql/mutation.rs @@ -54,36 +54,6 @@ macro_rules! test_mutation { } } -test_mutation! { with [ - "CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING INDEX, - value INTEGER - )", - "INSERT INTO test VALUES (1, 'a', 101), (2, 'b', 102), (3, 'c', 103)", - "CREATE TABLE other (id INTEGER PRIMARY KEY)", - "INSERT INTO other VALUES (1), (2), (3)", - ]; - - delete_all: "DELETE FROM test", - delete_where: "DELETE FROM test WHERE id = 1", - delete_where_and: "DELETE FROM test WHERE id = 1 AND name = 'a'", - delete_where_expr: "DELETE FROM test WHERE id = 3 - 2 AND name LIKE 'a%'", - delete_where_true: "DELETE FROM test WHERE TRUE", - delete_where_false: "DELETE FROM test WHERE FALSE", - delete_where_null: "DELETE FROM test WHERE NULL", - delete_where_float: "DELETE FROM test WHERE 3.14", - delete_where_integer: "DELETE FROM test WHERE 1", - delete_where_string: "DELETE FROM test WHERE 'a'", - delete_case: "DELETE FROM TeSt WHERE ID = 1", - delete_missing_column_where: "DELETE FROM test WHERE missing = TRUE", - delete_missing_table: "DELETE FROM missing", - delete_multiple_tables: "DELETE FROM test, other WHERE id = 1", - delete_bare: "DELETE", - delete_bare_from: "DELETE FROM", - delete_bare_where: "DELETE FROM test WHERE", -} - test_mutation! { with [ "CREATE TABLE test ( id INTEGER PRIMARY KEY DEFAULT 0, diff --git a/tests/sql/mutation/delete_all b/tests/sql/mutation/delete_all deleted file mode 100644 index 51ff7eb14..000000000 --- a/tests/sql/mutation/delete_all +++ /dev/null @@ -1,18 +0,0 @@ -Query: DELETE FROM test -Result: Delete { count: 3 } - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) - -Index test.name diff --git a/tests/sql/mutation/delete_bare b/tests/sql/mutation/delete_bare deleted file mode 100644 index 8768fd206..000000000 --- a/tests/sql/mutation/delete_bare +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE -Error: InvalidInput("unexpected end of input") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_bare_from b/tests/sql/mutation/delete_bare_from deleted file mode 100644 index f3657c4fa..000000000 --- a/tests/sql/mutation/delete_bare_from +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM -Error: InvalidInput("unexpected end of input") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_bare_where b/tests/sql/mutation/delete_bare_where deleted file mode 100644 index fced014ac..000000000 --- a/tests/sql/mutation/delete_bare_where +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM test WHERE -Error: InvalidInput("unexpected end of input") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_case b/tests/sql/mutation/delete_case deleted file mode 100644 index cc2beece3..000000000 --- a/tests/sql/mutation/delete_case +++ /dev/null @@ -1,22 +0,0 @@ -Query: DELETE FROM TeSt WHERE ID = 1 -Result: Delete { count: 1 } - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_missing_column_where b/tests/sql/mutation/delete_missing_column_where deleted file mode 100644 index 33417fda0..000000000 --- a/tests/sql/mutation/delete_missing_column_where +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM test WHERE missing = TRUE -Error: InvalidInput("unknown field missing") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_missing_table b/tests/sql/mutation/delete_missing_table deleted file mode 100644 index fc6fdb963..000000000 --- a/tests/sql/mutation/delete_missing_table +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM missing -Error: InvalidInput("table missing does not exist") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_multiple_tables b/tests/sql/mutation/delete_multiple_tables deleted file mode 100644 index a82b66f46..000000000 --- a/tests/sql/mutation/delete_multiple_tables +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM test, other WHERE id = 1 -Error: InvalidInput("unexpected token ,") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where b/tests/sql/mutation/delete_where deleted file mode 100644 index adc6c9362..000000000 --- a/tests/sql/mutation/delete_where +++ /dev/null @@ -1,22 +0,0 @@ -Query: DELETE FROM test WHERE id = 1 -Result: Delete { count: 1 } - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where_and b/tests/sql/mutation/delete_where_and deleted file mode 100644 index 55551bb20..000000000 --- a/tests/sql/mutation/delete_where_and +++ /dev/null @@ -1,22 +0,0 @@ -Query: DELETE FROM test WHERE id = 1 AND name = 'a' -Result: Delete { count: 1 } - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where_expr b/tests/sql/mutation/delete_where_expr deleted file mode 100644 index 703e56ec1..000000000 --- a/tests/sql/mutation/delete_where_expr +++ /dev/null @@ -1,22 +0,0 @@ -Query: DELETE FROM test WHERE id = 3 - 2 AND name LIKE 'a%' -Result: Delete { count: 1 } - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where_false b/tests/sql/mutation/delete_where_false deleted file mode 100644 index 22594d8c0..000000000 --- a/tests/sql/mutation/delete_where_false +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM test WHERE FALSE -Result: Delete { count: 0 } - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where_float b/tests/sql/mutation/delete_where_float deleted file mode 100644 index 005cc84e2..000000000 --- a/tests/sql/mutation/delete_where_float +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM test WHERE 3.14 -Error: InvalidInput("filter returned 3.14, expected boolean") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where_integer b/tests/sql/mutation/delete_where_integer deleted file mode 100644 index e4621b94e..000000000 --- a/tests/sql/mutation/delete_where_integer +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM test WHERE 1 -Error: InvalidInput("filter returned 1, expected boolean") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where_null b/tests/sql/mutation/delete_where_null deleted file mode 100644 index 8fcc46934..000000000 --- a/tests/sql/mutation/delete_where_null +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM test WHERE NULL -Result: Delete { count: 0 } - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where_string b/tests/sql/mutation/delete_where_string deleted file mode 100644 index 4407bf380..000000000 --- a/tests/sql/mutation/delete_where_string +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM test WHERE 'a' -Error: InvalidInput("filter returned a, expected boolean") - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("c"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2)] -String("c") => [Integer(3)] diff --git a/tests/sql/mutation/delete_where_true b/tests/sql/mutation/delete_where_true deleted file mode 100644 index 86b9d071a..000000000 --- a/tests/sql/mutation/delete_where_true +++ /dev/null @@ -1,18 +0,0 @@ -Query: DELETE FROM test WHERE TRUE -Result: Delete { count: 3 } - -Storage: -CREATE TABLE other ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] - -CREATE TABLE test ( - id INTEGER PRIMARY KEY DEFAULT 0, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) - -Index test.name diff --git a/tests/sql/schema.rs b/tests/sql/schema.rs index a5d357e5e..5333970bf 100644 --- a/tests/sql/schema.rs +++ b/tests/sql/schema.rs @@ -52,57 +52,6 @@ macro_rules! test_schema { } } -test_schema! { with [ - r#"CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN, - "float" FLOAT, - "integer" INTEGER, - "string" STRING - )"# - ]; - insert_boolean_false: r#"INSERT INTO types (id, "boolean") VALUES (0, FALSE)"#, - insert_boolean_true: r#"INSERT INTO types (id, "boolean") VALUES (0, TRUE)"#, - insert_boolean_null: r#"INSERT INTO types (id, "boolean") VALUES (0, NULL)"#, - insert_boolean_float: r#"INSERT INTO types (id, "boolean") VALUES (0, 3.14)"#, - insert_boolean_integer: r#"INSERT INTO types (id, "boolean") VALUES (0, 1)"#, - insert_boolean_string: r#"INSERT INTO types (id, "boolean") VALUES (0, 'abc')"#, - insert_boolean_string_empty: r#"INSERT INTO types (id, "boolean") VALUES (0, '')"#, - - insert_float: r#"INSERT INTO types (id, "float") VALUES (0, 3.14)"#, - insert_float_min: r#"INSERT INTO types (id, "float") VALUES (0, 1.23456789012345e-307)"#, - insert_float_min_negative: r#"INSERT INTO types (id, "float") VALUES (0, -1.23456789012345e-307)"#, - insert_float_min_round: r#"INSERT INTO types (id, "float") VALUES (0, 1.23456789012345e-323)"#, - insert_float_max: r#"INSERT INTO types (id, "float") VALUES (0, 1.23456789012345e308)"#, - insert_float_max_negative: r#"INSERT INTO types (id, "float") VALUES (0, -1.23456789012345e308)"#, - insert_float_infinity: r#"INSERT INTO types (id, "float") VALUES (0, INFINITY)"#, - insert_float_infinity_negative: r#"INSERT INTO types (id, "float") VALUES (0, -INFINITY)"#, - insert_float_nan: r#"INSERT INTO types (id, "float") VALUES (0, NAN)"#, - insert_float_null: r#"INSERT INTO types (id, "float") VALUES (0, NULL)"#, - insert_float_boolean: r#"INSERT INTO types (id, "float") VALUES (0, FALSE)"#, - insert_float_integer: r#"INSERT INTO types (id, "float") VALUES (0, 1)"#, - insert_float_string: r#"INSERT INTO types (id, "float") VALUES (0, 'a')"#, - insert_float_string_empty: r#"INSERT INTO types (id, "float") VALUES (0, '')"#, - - insert_integer: r#"INSERT INTO types (id, "integer") VALUES (0, 1)"#, - insert_integer_max: r#"INSERT INTO types (id, "integer") VALUES (0, 9223372036854775807)"#, - insert_integer_min: r#"INSERT INTO types (id, "integer") VALUES (0, -9223372036854775807)"#, - insert_integer_null: r#"INSERT INTO types (id, "integer") VALUES (0, NULL)"#, - insert_integer_boolean: r#"INSERT INTO types (id, "integer") VALUES (0, FALSE)"#, - insert_integer_float: r#"INSERT INTO types (id, "integer") VALUES (0, 1.0)"#, - insert_integer_float_infinity: r#"INSERT INTO types (id, "integer") VALUES (0, INFINITY)"#, - insert_integer_float_nan: r#"INSERT INTO types (id, "integer") VALUES (0, NAN)"#, - insert_integer_string: r#"INSERT INTO types (id, "integer") VALUES (0, 'a')"#, - insert_integer_string_empty: r#"INSERT INTO types (id, "integer") VALUES (0, '')"#, - - insert_string: r#"INSERT INTO types (id, "string") VALUES (0, 'abc')"#, - insert_string_empty: r#"INSERT INTO types (id, "string") VALUES (0, '')"#, - insert_string_unicode: r#"INSERT INTO types (id, "string") VALUES (0, ' Hi! 👋')"#, - insert_string_null: r#"INSERT INTO types (id, "string") VALUES (0, NULL)"#, - insert_string_boolean: r#"INSERT INTO types (id, "string") VALUES (0, FALSE)"#, - insert_string_float: r#"INSERT INTO types (id, "string") VALUES (0, 3.14)"#, - insert_string_integer: r#"INSERT INTO types (id, "string") VALUES (0, 1)"#, -} test_schema! { with [ "CREATE TABLE test (id INTEGER PRIMARY KEY, value INTEGER)", "INSERT INTO test VALUES (1, 7)", @@ -117,10 +66,6 @@ test_schema! { with [ r#"CREATE TABLE "boolean" (pk BOOLEAN PRIMARY KEY)"#, r#"INSERT INTO "boolean" VALUES (FALSE)"#, ]; - insert_pk_boolean: r#"INSERT INTO "boolean" VALUES (TRUE)"#, - insert_pk_boolean_conflict: r#"INSERT INTO "boolean" VALUES (FALSE)"#, - insert_pk_boolean_null: r#"INSERT INTO "boolean" VALUES (NULL)"#, - update_pk_boolean: r#"UPDATE "boolean" SET pk = TRUE WHERE pk = FALSE"#, update_pk_boolean_null: r#"UPDATE "boolean" SET pk = NULL WHERE pk = FALSE"#, } @@ -129,14 +74,6 @@ test_schema! { with [ r#"CREATE TABLE "float" (pk FLOAT PRIMARY KEY)"#, r#"INSERT INTO "float" VALUES (3.14), (2.718), (NAN), (INFINITY)"#, ]; - insert_pk_float: r#"INSERT INTO "float" VALUES (1.618)"#, - insert_pk_float_conflict: r#"INSERT INTO "float" VALUES (3.14)"#, - insert_pk_float_zero: r#"INSERT INTO "float" VALUES (0.0)"#, - insert_pk_float_negative: r#"INSERT INTO "float" VALUES (-3.14)"#, - insert_pk_float_nan: r#"INSERT INTO "float" VALUES (NAN)"#, - insert_pk_float_infinity: r#"INSERT INTO "float" VALUES (INFINITY)"#, - insert_pk_float_null: r#"INSERT INTO "float" VALUES (NULL)"#, - update_pk_float: r#"UPDATE "float" SET pk = 1.618 WHERE pk = 3.14"#, update_pk_float_conflict: r#"UPDATE "float" SET pk = 2.718 WHERE pk = 3.14"#, update_pk_float_conflict_all: r#"UPDATE "float" SET pk = 3.14"#, @@ -147,12 +84,6 @@ test_schema! { with [ r#"CREATE TABLE "integer" (pk INTEGER PRIMARY KEY)"#, r#"INSERT INTO "integer" VALUES (1), (2)"#, ]; - insert_pk_integer: r#"INSERT INTO "integer" VALUES (3)"#, - insert_pk_integer_conflict: r#"INSERT INTO "integer" VALUES (1)"#, - insert_pk_integer_zero: r#"INSERT INTO "integer" VALUES (0)"#, - insert_pk_integer_negative: r#"INSERT INTO "integer" VALUES (-1)"#, - insert_pk_integer_null: r#"INSERT INTO "integer" VALUES (NULL)"#, - update_pk_integer: r#"UPDATE "integer" SET pk = 3 WHERE pk = 2"#, update_pk_integer_conflict: r#"UPDATE "integer" SET pk = 1 WHERE pk = 2"#, update_pk_integer_conflict_all: r#"UPDATE "integer" SET pk = 1"#, @@ -163,12 +94,6 @@ test_schema! { with [ r#"CREATE TABLE "string" (pk STRING PRIMARY KEY)"#, r#"INSERT INTO "string" VALUES ('foo'), ('bar')"#, ]; - insert_pk_string: r#"INSERT INTO "string" VALUES ('baz')"#, - insert_pk_string_case: r#"INSERT INTO "string" VALUES ('Foo')"#, - insert_pk_string_conflict: r#"INSERT INTO "string" VALUES ('foo')"#, - insert_pk_string_empty: r#"INSERT INTO "string" VALUES ('')"#, - insert_pk_string_null: r#"INSERT INTO "string" VALUES (NULL)"#, - update_pk_string: r#"UPDATE "string" SET pk = 'baz' WHERE pk = 'foo'"#, update_pk_string_case: r#"UPDATE "string" SET pk = 'Bar' WHERE pk = 'foo'"#, update_pk_string_conflict: r#"UPDATE "string" SET pk = 'bar' WHERE pk = 'foo'"#, @@ -176,35 +101,6 @@ test_schema! { with [ update_pk_string_null: r#"UPDATE "string" SET pk = NULL WHERE pk = 'foo'"#, } -test_schema! { with [ - r#"CREATE TABLE nulls ( - id INTEGER PRIMARY KEY, - "null" BOOLEAN NULL, - not_null BOOLEAN NOT NULL, - "default" BOOLEAN - )"#]; - insert_nulls: r#"INSERT INTO nulls (id, "null", not_null, "default") VALUES (1, NULL, TRUE, NULL)"#, - insert_nulls_default: r#"INSERT INTO nulls (id, "null", not_null) VALUES (1, NULL, TRUE)"#, - insert_nulls_required: r#"INSERT INTO nulls (id, "null", not_null, "default") VALUES (1, NULL, NULL, NULL)"#, -} - -test_schema! { with [ - r#"CREATE TABLE defaults ( - id INTEGER PRIMARY KEY, - required BOOLEAN NOT NULL, - "null" BOOLEAN, - "boolean" BOOLEAN DEFAULT TRUE, - "float" FLOAT DEFAULT 3.14, - "integer" INTEGER DEFAULT 7, - "string" STRING DEFAULT 'foo' - )"#]; - insert_default: "INSERT INTO defaults (id, required) VALUES (1, TRUE)", - insert_default_unnamed: "INSERT INTO defaults VALUES (1, TRUE)", - insert_default_missing: "INSERT INTO defaults (id) VALUES (1)", - insert_default_override: "INSERT INTO defaults VALUES (1, TRUE, TRUE, FALSE, 2.718, 3, 'bar')", - insert_default_override_null: "INSERT INTO defaults VALUES (1, TRUE, NULL, NULL, NULL, NULL, NULL)", -} - test_schema! { with [ r#"CREATE TABLE "unique" ( id INTEGER PRIMARY KEY, @@ -216,74 +112,18 @@ test_schema! { with [ r#"INSERT INTO "unique" VALUES (0, NULL, NULL, NULL, NULL)"#, r#"INSERT INTO "unique" VALUES (1, TRUE, 3.14, 7, 'foo')"#, ]; - insert_unique_boolean: r#"INSERT INTO "unique" (id, "boolean") VALUES (2, FALSE)"#, - insert_unique_boolean_duplicate: r#"INSERT INTO "unique" (id, "boolean") VALUES (2, TRUE)"#, - insert_unique_float: r#"INSERT INTO "unique" (id, "float") VALUES (2, 2.718)"#, - insert_unique_float_duplicate: r#"INSERT INTO "unique" (id, "float") VALUES (2, 3.14)"#, - insert_unique_integer: r#"INSERT INTO "unique" (id, "integer") VALUES (2, 3)"#, - insert_unique_integer_duplicate: r#"INSERT INTO "unique" (id, "integer") VALUES (2, 7)"#, - insert_unique_string: r#"INSERT INTO "unique" (id, "string") VALUES (2, 'bar')"#, - insert_unique_string_duplicate: r#"INSERT INTO "unique" (id, "string") VALUES (2, 'foo')"#, - insert_unique_string_case: r#"INSERT INTO "unique" (id, "string") VALUES (2, 'Foo')"#, - insert_unique_nulls: r#"INSERT INTO "unique" VALUES (2, NULL, NULL, NULL, NULL)"#, - update_unique_boolean: r#"UPDATE "unique" SET "boolean" = FALSE WHERE id = 0"#, update_unique_boolean_duplicate: r#"UPDATE "unique" SET "boolean" = TRUE WHERE id = 0"#, update_unique_boolean_same: r#"UPDATE "unique" SET "boolean" = TRUE WHERE id = 1"#, update_unique_nulls: r#"UPDATE "unique" SET "boolean" = NULL, "float" = NULL, "integer" = NULL, "string" = NULL WHERE id = 1"#, } -test_schema! { with [ - "CREATE TABLE target (id BOOLEAN PRIMARY KEY)", - "INSERT INTO target VALUES (TRUE)", - "CREATE TABLE source (id INTEGER PRIMARY KEY, target_id BOOLEAN REFERENCES target)", - ]; - insert_ref_boolean: "INSERT INTO source VALUES (1, TRUE)", - insert_ref_boolean_null: "INSERT INTO source VALUES (1, NULL)", - insert_ref_boolean_missing: "INSERT INTO source VALUES (1, FALSE)", -} - -test_schema! { with [ - "CREATE TABLE target (id FLOAT PRIMARY KEY)", - "INSERT INTO target VALUES (3.14), (2.718)", - "CREATE TABLE source (id INTEGER PRIMARY KEY, target_id FLOAT REFERENCES target)", - ]; - insert_ref_float: "INSERT INTO source VALUES (1, 3.14)", - insert_ref_float_null: "INSERT INTO source VALUES (1, NULL)", - insert_ref_float_missing: "INSERT INTO source VALUES (1, 1.618)", -} - -test_schema! { with [ - "CREATE TABLE target (id INTEGER PRIMARY KEY)", - "INSERT INTO target VALUES (1), (2), (3)", - "CREATE TABLE source (id INTEGER PRIMARY KEY, target_id INTEGER REFERENCES target)", - ]; - insert_ref_integer: "INSERT INTO source VALUES (1, 1)", - insert_ref_integer_null: "INSERT INTO source VALUES (1, NULL)", - insert_ref_integer_missing: "INSERT INTO source VALUES (1, 7)", -} - -test_schema! { with [ - "CREATE TABLE target (id STRING PRIMARY KEY)", - "INSERT INTO target VALUES ('foo'), ('bar')", - "CREATE TABLE source (id INTEGER PRIMARY KEY, target_id STRING REFERENCES target)", - ]; - insert_ref_string: "INSERT INTO source VALUES (1, 'foo')", - insert_ref_string_case: "INSERT INTO source VALUES (1, 'Foo')", - insert_ref_string_null: "INSERT INTO source VALUES (1, NULL)", - insert_ref_string_missing: "INSERT INTO source VALUES (1, 'baz')", -} - test_schema! { with [ "CREATE TABLE target (id INTEGER PRIMARY KEY, value STRING)", "INSERT INTO target VALUES (1, 'a'), (2, 'b'), (3, 'c')", "CREATE TABLE source (id INTEGER PRIMARY KEY, target_id INTEGER REFERENCES target)", "INSERT INTO source VALUES (1, 1), (2, 2), (4, NULL)", ]; - delete_ref_conflict: "DELETE FROM target WHERE id = 1", - delete_ref_noref: "DELETE FROM target WHERE id = 3", - delete_ref_source: "DELETE FROM source WHERE id = 1", - update_ref_value: "UPDATE target SET value = 'x' WHERE id = 1", update_ref_pk: "UPDATE target SET id = 9 WHERE id = 1", update_ref_pk_noref: "UPDATE target SET id = 9 WHERE id = 3", @@ -296,15 +136,6 @@ test_schema! { with [ "CREATE TABLE self (id INTEGER PRIMARY KEY, self_id INTEGER REFERENCES self, value STRING)", "INSERT INTO self VALUES (1, 1, 'a'), (2, 1, 'b'), (3, 3, 'c'), (4, NULL, 'd')", ]; - delete_ref_self: "DELETE FROM self WHERE id = 3", - delete_ref_self_all: "DELETE FROM self", - delete_ref_self_conflict: "DELETE FROM self WHERE id = 1", - - insert_ref_self: "INSERT INTO self VALUES (5, 1, 'e')", - insert_ref_self_null: "INSERT INTO self VALUES (5, NULL, 'e')", - insert_ref_self_missing: "INSERT INTO self VALUES (5, 9, 'e')", - insert_ref_self_self: "INSERT INTO self VALUES (5, 5, 'e')", - update_ref_self_value: "UPDATE self SET value = 'x' WHERE id = 1", update_ref_self_pk: "UPDATE self SET id = 9 WHERE id = 1", update_ref_self_pk_noref: "UPDATE self SET id = 9 WHERE id = 2", @@ -316,14 +147,6 @@ test_schema! { with [ "INSERT INTO test VALUES (1, 'a', 101), (2, 'b', 102), (3, 'b', 103)", ]; - delete_index_only: "DELETE FROM test WHERE id = 1", - delete_index_single: "DELETE FROM test WHERE id = 2", - delete_index_all: "DELETE FROM test", - - insert_index_exists: "INSERT INTO test VALUES (4, 'b', 104)", - insert_index_new: "INSERT INTO test VALUES (4, 'c', 104)", - insert_index_null: "INSERT INTO test VALUES (4, NULL, 104)", - update_index_same: "UPDATE test SET value = 102 WHERE id = 3", update_index_new: "UPDATE test SET name = 'c' WHERE id = 3", update_index_existing: "UPDATE test SET name = 'a' WHERE id = 2", diff --git a/tests/sql/schema/delete_index_all b/tests/sql/schema/delete_index_all deleted file mode 100644 index d243996fd..000000000 --- a/tests/sql/schema/delete_index_all +++ /dev/null @@ -1,11 +0,0 @@ -Query: DELETE FROM test -Result: Delete { count: 3 } - -Storage: -CREATE TABLE test ( - id INTEGER PRIMARY KEY, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) - -Index test.name diff --git a/tests/sql/schema/delete_index_only b/tests/sql/schema/delete_index_only deleted file mode 100644 index 08a795f41..000000000 --- a/tests/sql/schema/delete_index_only +++ /dev/null @@ -1,14 +0,0 @@ -Query: DELETE FROM test WHERE id = 1 -Result: Delete { count: 1 } - -Storage: -CREATE TABLE test ( - id INTEGER PRIMARY KEY, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("b"), Integer(103)] - -Index test.name -String("b") => [Integer(2), Integer(3)] diff --git a/tests/sql/schema/delete_index_single b/tests/sql/schema/delete_index_single deleted file mode 100644 index a762a3814..000000000 --- a/tests/sql/schema/delete_index_single +++ /dev/null @@ -1,15 +0,0 @@ -Query: DELETE FROM test WHERE id = 2 -Result: Delete { count: 1 } - -Storage: -CREATE TABLE test ( - id INTEGER PRIMARY KEY, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(3), String("b"), Integer(103)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(3)] diff --git a/tests/sql/schema/delete_ref_conflict b/tests/sql/schema/delete_ref_conflict deleted file mode 100644 index e1bd2b1c7..000000000 --- a/tests/sql/schema/delete_ref_conflict +++ /dev/null @@ -1,24 +0,0 @@ -Query: DELETE FROM target WHERE id = 1 -Error: InvalidInput("row referenced by source.target_id for source.id=1") - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id INTEGER DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Integer(1)] -[Integer(2), Integer(2)] -[Integer(4), Null] - -Index source.target_id -Null => [Integer(4)] -Integer(1) => [Integer(1)] -Integer(2) => [Integer(2)] - -CREATE TABLE target ( - id INTEGER PRIMARY KEY, - value STRING DEFAULT NULL -) -[Integer(1), String("a")] -[Integer(2), String("b")] -[Integer(3), String("c")] diff --git a/tests/sql/schema/delete_ref_noref b/tests/sql/schema/delete_ref_noref deleted file mode 100644 index c2effd836..000000000 --- a/tests/sql/schema/delete_ref_noref +++ /dev/null @@ -1,23 +0,0 @@ -Query: DELETE FROM target WHERE id = 3 -Result: Delete { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id INTEGER DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Integer(1)] -[Integer(2), Integer(2)] -[Integer(4), Null] - -Index source.target_id -Null => [Integer(4)] -Integer(1) => [Integer(1)] -Integer(2) => [Integer(2)] - -CREATE TABLE target ( - id INTEGER PRIMARY KEY, - value STRING DEFAULT NULL -) -[Integer(1), String("a")] -[Integer(2), String("b")] diff --git a/tests/sql/schema/delete_ref_self b/tests/sql/schema/delete_ref_self deleted file mode 100644 index 11c0e2282..000000000 --- a/tests/sql/schema/delete_ref_self +++ /dev/null @@ -1,16 +0,0 @@ -Query: DELETE FROM self WHERE id = 3 -Result: Delete { count: 1 } - -Storage: -CREATE TABLE self ( - id INTEGER PRIMARY KEY, - self_id INTEGER DEFAULT NULL INDEX REFERENCES self, - value STRING DEFAULT NULL -) -[Integer(1), Integer(1), String("a")] -[Integer(2), Integer(1), String("b")] -[Integer(4), Null, String("d")] - -Index self.self_id -Null => [Integer(4)] -Integer(1) => [Integer(1), Integer(2)] diff --git a/tests/sql/schema/delete_ref_self_all b/tests/sql/schema/delete_ref_self_all deleted file mode 100644 index e0a0f3be9..000000000 --- a/tests/sql/schema/delete_ref_self_all +++ /dev/null @@ -1,11 +0,0 @@ -Query: DELETE FROM self -Result: Delete { count: 4 } - -Storage: -CREATE TABLE self ( - id INTEGER PRIMARY KEY, - self_id INTEGER DEFAULT NULL INDEX REFERENCES self, - value STRING DEFAULT NULL -) - -Index self.self_id diff --git a/tests/sql/schema/delete_ref_self_conflict b/tests/sql/schema/delete_ref_self_conflict deleted file mode 100644 index 65e95fd29..000000000 --- a/tests/sql/schema/delete_ref_self_conflict +++ /dev/null @@ -1,18 +0,0 @@ -Query: DELETE FROM self WHERE id = 1 -Error: InvalidInput("row referenced by self.self_id for self.id=2") - -Storage: -CREATE TABLE self ( - id INTEGER PRIMARY KEY, - self_id INTEGER DEFAULT NULL INDEX REFERENCES self, - value STRING DEFAULT NULL -) -[Integer(1), Integer(1), String("a")] -[Integer(2), Integer(1), String("b")] -[Integer(3), Integer(3), String("c")] -[Integer(4), Null, String("d")] - -Index self.self_id -Null => [Integer(4)] -Integer(1) => [Integer(1), Integer(2)] -Integer(3) => [Integer(3)] diff --git a/tests/sql/schema/delete_ref_source b/tests/sql/schema/delete_ref_source deleted file mode 100644 index e2f266c4c..000000000 --- a/tests/sql/schema/delete_ref_source +++ /dev/null @@ -1,22 +0,0 @@ -Query: DELETE FROM source WHERE id = 1 -Result: Delete { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id INTEGER DEFAULT NULL INDEX REFERENCES target -) -[Integer(2), Integer(2)] -[Integer(4), Null] - -Index source.target_id -Null => [Integer(4)] -Integer(2) => [Integer(2)] - -CREATE TABLE target ( - id INTEGER PRIMARY KEY, - value STRING DEFAULT NULL -) -[Integer(1), String("a")] -[Integer(2), String("b")] -[Integer(3), String("c")] diff --git a/tests/sql/schema/insert_boolean_false b/tests/sql/schema/insert_boolean_false deleted file mode 100644 index 8e2e6f9cd..000000000 --- a/tests/sql/schema/insert_boolean_false +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, FALSE) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Boolean(false), Null, Null, Null] diff --git a/tests/sql/schema/insert_boolean_float b/tests/sql/schema/insert_boolean_float deleted file mode 100644 index ec183463a..000000000 --- a/tests/sql/schema/insert_boolean_float +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, 3.14) -Error: InvalidInput("invalid datatype FLOAT for BOOLEAN column boolean") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_boolean_float_zero b/tests/sql/schema/insert_boolean_float_zero deleted file mode 100644 index cc43bf422..000000000 --- a/tests/sql/schema/insert_boolean_float_zero +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, 0.0) -Error: Value("Invalid datatype FLOAT for BOOLEAN column boolean") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY NOT NULL, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_boolean_integer b/tests/sql/schema/insert_boolean_integer deleted file mode 100644 index 52b025edc..000000000 --- a/tests/sql/schema/insert_boolean_integer +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, 1) -Error: InvalidInput("invalid datatype INTEGER for BOOLEAN column boolean") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_boolean_integer_zero b/tests/sql/schema/insert_boolean_integer_zero deleted file mode 100644 index 73a82d720..000000000 --- a/tests/sql/schema/insert_boolean_integer_zero +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, 0) -Error: Value("Invalid datatype INTEGER for BOOLEAN column boolean") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY NOT NULL, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_boolean_null b/tests/sql/schema/insert_boolean_null deleted file mode 100644 index 690e9a52c..000000000 --- a/tests/sql/schema/insert_boolean_null +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Null, Null] diff --git a/tests/sql/schema/insert_boolean_string b/tests/sql/schema/insert_boolean_string deleted file mode 100644 index 0a9d58f81..000000000 --- a/tests/sql/schema/insert_boolean_string +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, 'abc') -Error: InvalidInput("invalid datatype STRING for BOOLEAN column boolean") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_boolean_string_empty b/tests/sql/schema/insert_boolean_string_empty deleted file mode 100644 index 8d44afef2..000000000 --- a/tests/sql/schema/insert_boolean_string_empty +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, '') -Error: InvalidInput("invalid datatype STRING for BOOLEAN column boolean") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_boolean_true b/tests/sql/schema/insert_boolean_true deleted file mode 100644 index 65073fd7b..000000000 --- a/tests/sql/schema/insert_boolean_true +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "boolean") VALUES (0, TRUE) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Boolean(true), Null, Null, Null] diff --git a/tests/sql/schema/insert_default b/tests/sql/schema/insert_default deleted file mode 100644 index 81b7e49d4..000000000 --- a/tests/sql/schema/insert_default +++ /dev/null @@ -1,14 +0,0 @@ -Query: INSERT INTO defaults (id, required) VALUES (1, TRUE) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE defaults ( - id INTEGER PRIMARY KEY, - required BOOLEAN NOT NULL, - "null" BOOLEAN DEFAULT NULL, - "boolean" BOOLEAN DEFAULT TRUE, - "float" FLOAT DEFAULT 3.14, - "integer" INTEGER DEFAULT 7, - "string" STRING DEFAULT foo -) -[Integer(1), Boolean(true), Null, Boolean(true), Float(3.14), Integer(7), String("foo")] diff --git a/tests/sql/schema/insert_default_missing b/tests/sql/schema/insert_default_missing deleted file mode 100644 index 9b849b7be..000000000 --- a/tests/sql/schema/insert_default_missing +++ /dev/null @@ -1,13 +0,0 @@ -Query: INSERT INTO defaults (id) VALUES (1) -Error: InvalidInput("no value given for column required with no default") - -Storage: -CREATE TABLE defaults ( - id INTEGER PRIMARY KEY, - required BOOLEAN NOT NULL, - "null" BOOLEAN DEFAULT NULL, - "boolean" BOOLEAN DEFAULT TRUE, - "float" FLOAT DEFAULT 3.14, - "integer" INTEGER DEFAULT 7, - "string" STRING DEFAULT foo -) diff --git a/tests/sql/schema/insert_default_override b/tests/sql/schema/insert_default_override deleted file mode 100644 index 0630ebce2..000000000 --- a/tests/sql/schema/insert_default_override +++ /dev/null @@ -1,14 +0,0 @@ -Query: INSERT INTO defaults VALUES (1, TRUE, TRUE, FALSE, 2.718, 3, 'bar') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE defaults ( - id INTEGER PRIMARY KEY, - required BOOLEAN NOT NULL, - "null" BOOLEAN DEFAULT NULL, - "boolean" BOOLEAN DEFAULT TRUE, - "float" FLOAT DEFAULT 3.14, - "integer" INTEGER DEFAULT 7, - "string" STRING DEFAULT foo -) -[Integer(1), Boolean(true), Boolean(true), Boolean(false), Float(2.718), Integer(3), String("bar")] diff --git a/tests/sql/schema/insert_default_override_null b/tests/sql/schema/insert_default_override_null deleted file mode 100644 index 7e4c44ab7..000000000 --- a/tests/sql/schema/insert_default_override_null +++ /dev/null @@ -1,14 +0,0 @@ -Query: INSERT INTO defaults VALUES (1, TRUE, NULL, NULL, NULL, NULL, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE defaults ( - id INTEGER PRIMARY KEY, - required BOOLEAN NOT NULL, - "null" BOOLEAN DEFAULT NULL, - "boolean" BOOLEAN DEFAULT TRUE, - "float" FLOAT DEFAULT 3.14, - "integer" INTEGER DEFAULT 7, - "string" STRING DEFAULT foo -) -[Integer(1), Boolean(true), Null, Null, Null, Null, Null] diff --git a/tests/sql/schema/insert_default_unnamed b/tests/sql/schema/insert_default_unnamed deleted file mode 100644 index 2916a4bcc..000000000 --- a/tests/sql/schema/insert_default_unnamed +++ /dev/null @@ -1,14 +0,0 @@ -Query: INSERT INTO defaults VALUES (1, TRUE) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE defaults ( - id INTEGER PRIMARY KEY, - required BOOLEAN NOT NULL, - "null" BOOLEAN DEFAULT NULL, - "boolean" BOOLEAN DEFAULT TRUE, - "float" FLOAT DEFAULT 3.14, - "integer" INTEGER DEFAULT 7, - "string" STRING DEFAULT foo -) -[Integer(1), Boolean(true), Null, Boolean(true), Float(3.14), Integer(7), String("foo")] diff --git a/tests/sql/schema/insert_float b/tests/sql/schema/insert_float deleted file mode 100644 index 66765ed54..000000000 --- a/tests/sql/schema/insert_float +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, 3.14) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(3.14), Null, Null] diff --git a/tests/sql/schema/insert_float_boolean b/tests/sql/schema/insert_float_boolean deleted file mode 100644 index 67940184a..000000000 --- a/tests/sql/schema/insert_float_boolean +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, FALSE) -Error: InvalidInput("invalid datatype BOOLEAN for FLOAT column float") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_float_infinity b/tests/sql/schema/insert_float_infinity deleted file mode 100644 index 5904b35b8..000000000 --- a/tests/sql/schema/insert_float_infinity +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, INFINITY) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(inf), Null, Null] diff --git a/tests/sql/schema/insert_float_infinity_negative b/tests/sql/schema/insert_float_infinity_negative deleted file mode 100644 index 50de7c7c0..000000000 --- a/tests/sql/schema/insert_float_infinity_negative +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, -INFINITY) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(-inf), Null, Null] diff --git a/tests/sql/schema/insert_float_integer b/tests/sql/schema/insert_float_integer deleted file mode 100644 index 9cbc81198..000000000 --- a/tests/sql/schema/insert_float_integer +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, 1) -Error: InvalidInput("invalid datatype INTEGER for FLOAT column float") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_float_max b/tests/sql/schema/insert_float_max deleted file mode 100644 index eb468cf90..000000000 --- a/tests/sql/schema/insert_float_max +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, 1.23456789012345e308) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(1.23456789012345e308), Null, Null] diff --git a/tests/sql/schema/insert_float_max_negative b/tests/sql/schema/insert_float_max_negative deleted file mode 100644 index 8eb87a8a7..000000000 --- a/tests/sql/schema/insert_float_max_negative +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, -1.23456789012345e308) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(-1.23456789012345e308), Null, Null] diff --git a/tests/sql/schema/insert_float_min b/tests/sql/schema/insert_float_min deleted file mode 100644 index 217e1f678..000000000 --- a/tests/sql/schema/insert_float_min +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, 1.23456789012345e-307) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(1.23456789012345e-307), Null, Null] diff --git a/tests/sql/schema/insert_float_min_negative b/tests/sql/schema/insert_float_min_negative deleted file mode 100644 index a561ea75b..000000000 --- a/tests/sql/schema/insert_float_min_negative +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, -1.23456789012345e-307) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(-1.23456789012345e-307), Null, Null] diff --git a/tests/sql/schema/insert_float_min_round b/tests/sql/schema/insert_float_min_round deleted file mode 100644 index f5537b918..000000000 --- a/tests/sql/schema/insert_float_min_round +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, 1.23456789012345e-323) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(1e-323), Null, Null] diff --git a/tests/sql/schema/insert_float_nan b/tests/sql/schema/insert_float_nan deleted file mode 100644 index fc1d42f58..000000000 --- a/tests/sql/schema/insert_float_nan +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, NAN) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Float(NaN), Null, Null] diff --git a/tests/sql/schema/insert_float_null b/tests/sql/schema/insert_float_null deleted file mode 100644 index 442d159f0..000000000 --- a/tests/sql/schema/insert_float_null +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Null, Null] diff --git a/tests/sql/schema/insert_float_string b/tests/sql/schema/insert_float_string deleted file mode 100644 index 505423636..000000000 --- a/tests/sql/schema/insert_float_string +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, 'a') -Error: InvalidInput("invalid datatype STRING for FLOAT column float") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_float_string_empty b/tests/sql/schema/insert_float_string_empty deleted file mode 100644 index c0ebaf91a..000000000 --- a/tests/sql/schema/insert_float_string_empty +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "float") VALUES (0, '') -Error: InvalidInput("invalid datatype STRING for FLOAT column float") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_index_exists b/tests/sql/schema/insert_index_exists deleted file mode 100644 index abb858018..000000000 --- a/tests/sql/schema/insert_index_exists +++ /dev/null @@ -1,17 +0,0 @@ -Query: INSERT INTO test VALUES (4, 'b', 104) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE test ( - id INTEGER PRIMARY KEY, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("b"), Integer(103)] -[Integer(4), String("b"), Integer(104)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2), Integer(3), Integer(4)] diff --git a/tests/sql/schema/insert_index_new b/tests/sql/schema/insert_index_new deleted file mode 100644 index 8f38904fa..000000000 --- a/tests/sql/schema/insert_index_new +++ /dev/null @@ -1,18 +0,0 @@ -Query: INSERT INTO test VALUES (4, 'c', 104) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE test ( - id INTEGER PRIMARY KEY, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("b"), Integer(103)] -[Integer(4), String("c"), Integer(104)] - -Index test.name -String("a") => [Integer(1)] -String("b") => [Integer(2), Integer(3)] -String("c") => [Integer(4)] diff --git a/tests/sql/schema/insert_index_null b/tests/sql/schema/insert_index_null deleted file mode 100644 index 06f15db34..000000000 --- a/tests/sql/schema/insert_index_null +++ /dev/null @@ -1,18 +0,0 @@ -Query: INSERT INTO test VALUES (4, NULL, 104) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE test ( - id INTEGER PRIMARY KEY, - name STRING DEFAULT NULL INDEX, - value INTEGER DEFAULT NULL -) -[Integer(1), String("a"), Integer(101)] -[Integer(2), String("b"), Integer(102)] -[Integer(3), String("b"), Integer(103)] -[Integer(4), Null, Integer(104)] - -Index test.name -Null => [Integer(4)] -String("a") => [Integer(1)] -String("b") => [Integer(2), Integer(3)] diff --git a/tests/sql/schema/insert_integer b/tests/sql/schema/insert_integer deleted file mode 100644 index 81e49077c..000000000 --- a/tests/sql/schema/insert_integer +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, 1) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Integer(1), Null] diff --git a/tests/sql/schema/insert_integer_boolean b/tests/sql/schema/insert_integer_boolean deleted file mode 100644 index 1056b0540..000000000 --- a/tests/sql/schema/insert_integer_boolean +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, FALSE) -Error: InvalidInput("invalid datatype BOOLEAN for INTEGER column integer") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_integer_float b/tests/sql/schema/insert_integer_float deleted file mode 100644 index dc14f9ba1..000000000 --- a/tests/sql/schema/insert_integer_float +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, 1.0) -Error: InvalidInput("invalid datatype FLOAT for INTEGER column integer") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_integer_float_infinity b/tests/sql/schema/insert_integer_float_infinity deleted file mode 100644 index 51db76ee8..000000000 --- a/tests/sql/schema/insert_integer_float_infinity +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, INFINITY) -Error: InvalidInput("invalid datatype FLOAT for INTEGER column integer") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_integer_float_nan b/tests/sql/schema/insert_integer_float_nan deleted file mode 100644 index 7337b4cad..000000000 --- a/tests/sql/schema/insert_integer_float_nan +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, NAN) -Error: InvalidInput("invalid datatype FLOAT for INTEGER column integer") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_integer_max b/tests/sql/schema/insert_integer_max deleted file mode 100644 index c3635e58a..000000000 --- a/tests/sql/schema/insert_integer_max +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, 9223372036854775807) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Integer(9223372036854775807), Null] diff --git a/tests/sql/schema/insert_integer_min b/tests/sql/schema/insert_integer_min deleted file mode 100644 index 14aa1b334..000000000 --- a/tests/sql/schema/insert_integer_min +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, -9223372036854775807) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Integer(-9223372036854775807), Null] diff --git a/tests/sql/schema/insert_integer_null b/tests/sql/schema/insert_integer_null deleted file mode 100644 index 5388b921b..000000000 --- a/tests/sql/schema/insert_integer_null +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Null, Null] diff --git a/tests/sql/schema/insert_integer_string b/tests/sql/schema/insert_integer_string deleted file mode 100644 index d8451a1cf..000000000 --- a/tests/sql/schema/insert_integer_string +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, 'a') -Error: InvalidInput("invalid datatype STRING for INTEGER column integer") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_integer_string_empty b/tests/sql/schema/insert_integer_string_empty deleted file mode 100644 index 08dc5963c..000000000 --- a/tests/sql/schema/insert_integer_string_empty +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "integer") VALUES (0, '') -Error: InvalidInput("invalid datatype STRING for INTEGER column integer") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_nulls b/tests/sql/schema/insert_nulls deleted file mode 100644 index fccc5c922..000000000 --- a/tests/sql/schema/insert_nulls +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO nulls (id, "null", not_null, "default") VALUES (1, NULL, TRUE, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE nulls ( - id INTEGER PRIMARY KEY, - "null" BOOLEAN DEFAULT NULL, - not_null BOOLEAN NOT NULL, - "default" BOOLEAN DEFAULT NULL -) -[Integer(1), Null, Boolean(true), Null] diff --git a/tests/sql/schema/insert_nulls_default b/tests/sql/schema/insert_nulls_default deleted file mode 100644 index 4305a243c..000000000 --- a/tests/sql/schema/insert_nulls_default +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO nulls (id, "null", not_null) VALUES (1, NULL, TRUE) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE nulls ( - id INTEGER PRIMARY KEY, - "null" BOOLEAN DEFAULT NULL, - not_null BOOLEAN NOT NULL, - "default" BOOLEAN DEFAULT NULL -) -[Integer(1), Null, Boolean(true), Null] diff --git a/tests/sql/schema/insert_nulls_required b/tests/sql/schema/insert_nulls_required deleted file mode 100644 index 00802cb58..000000000 --- a/tests/sql/schema/insert_nulls_required +++ /dev/null @@ -1,10 +0,0 @@ -Query: INSERT INTO nulls (id, "null", not_null, "default") VALUES (1, NULL, NULL, NULL) -Error: InvalidInput("NULL value not allowed for column not_null") - -Storage: -CREATE TABLE nulls ( - id INTEGER PRIMARY KEY, - "null" BOOLEAN DEFAULT NULL, - not_null BOOLEAN NOT NULL, - "default" BOOLEAN DEFAULT NULL -) diff --git a/tests/sql/schema/insert_pk_boolean b/tests/sql/schema/insert_pk_boolean deleted file mode 100644 index 3ba0f0a90..000000000 --- a/tests/sql/schema/insert_pk_boolean +++ /dev/null @@ -1,9 +0,0 @@ -Query: INSERT INTO "boolean" VALUES (TRUE) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "boolean" ( - pk BOOLEAN PRIMARY KEY -) -[Boolean(false)] -[Boolean(true)] diff --git a/tests/sql/schema/insert_pk_boolean_conflict b/tests/sql/schema/insert_pk_boolean_conflict deleted file mode 100644 index c3584446b..000000000 --- a/tests/sql/schema/insert_pk_boolean_conflict +++ /dev/null @@ -1,8 +0,0 @@ -Query: INSERT INTO "boolean" VALUES (FALSE) -Error: InvalidInput("primary key FALSE already exists") - -Storage: -CREATE TABLE "boolean" ( - pk BOOLEAN PRIMARY KEY -) -[Boolean(false)] diff --git a/tests/sql/schema/insert_pk_boolean_null b/tests/sql/schema/insert_pk_boolean_null deleted file mode 100644 index 79cc6bc9c..000000000 --- a/tests/sql/schema/insert_pk_boolean_null +++ /dev/null @@ -1,8 +0,0 @@ -Query: INSERT INTO "boolean" VALUES (NULL) -Error: InvalidInput("NULL value not allowed for column pk") - -Storage: -CREATE TABLE "boolean" ( - pk BOOLEAN PRIMARY KEY -) -[Boolean(false)] diff --git a/tests/sql/schema/insert_pk_float b/tests/sql/schema/insert_pk_float deleted file mode 100644 index 9b0e528e2..000000000 --- a/tests/sql/schema/insert_pk_float +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO "float" VALUES (1.618) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "float" ( - pk FLOAT PRIMARY KEY -) -[Float(1.618)] -[Float(2.718)] -[Float(3.14)] -[Float(inf)] -[Float(NaN)] diff --git a/tests/sql/schema/insert_pk_float_conflict b/tests/sql/schema/insert_pk_float_conflict deleted file mode 100644 index 774a20d68..000000000 --- a/tests/sql/schema/insert_pk_float_conflict +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO "float" VALUES (3.14) -Error: InvalidInput("primary key 3.14 already exists") - -Storage: -CREATE TABLE "float" ( - pk FLOAT PRIMARY KEY -) -[Float(2.718)] -[Float(3.14)] -[Float(inf)] -[Float(NaN)] diff --git a/tests/sql/schema/insert_pk_float_infinity b/tests/sql/schema/insert_pk_float_infinity deleted file mode 100644 index 43379a791..000000000 --- a/tests/sql/schema/insert_pk_float_infinity +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO "float" VALUES (INFINITY) -Error: InvalidInput("primary key inf already exists") - -Storage: -CREATE TABLE "float" ( - pk FLOAT PRIMARY KEY -) -[Float(2.718)] -[Float(3.14)] -[Float(inf)] -[Float(NaN)] diff --git a/tests/sql/schema/insert_pk_float_nan b/tests/sql/schema/insert_pk_float_nan deleted file mode 100644 index 3d40d527d..000000000 --- a/tests/sql/schema/insert_pk_float_nan +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO "float" VALUES (NAN) -Error: InvalidInput("primary key NaN already exists") - -Storage: -CREATE TABLE "float" ( - pk FLOAT PRIMARY KEY -) -[Float(2.718)] -[Float(3.14)] -[Float(inf)] -[Float(NaN)] diff --git a/tests/sql/schema/insert_pk_float_negative b/tests/sql/schema/insert_pk_float_negative deleted file mode 100644 index 527297a7e..000000000 --- a/tests/sql/schema/insert_pk_float_negative +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO "float" VALUES (-3.14) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "float" ( - pk FLOAT PRIMARY KEY -) -[Float(-3.14)] -[Float(2.718)] -[Float(3.14)] -[Float(inf)] -[Float(NaN)] diff --git a/tests/sql/schema/insert_pk_float_null b/tests/sql/schema/insert_pk_float_null deleted file mode 100644 index 30666d667..000000000 --- a/tests/sql/schema/insert_pk_float_null +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO "float" VALUES (NULL) -Error: InvalidInput("NULL value not allowed for column pk") - -Storage: -CREATE TABLE "float" ( - pk FLOAT PRIMARY KEY -) -[Float(2.718)] -[Float(3.14)] -[Float(inf)] -[Float(NaN)] diff --git a/tests/sql/schema/insert_pk_float_zero b/tests/sql/schema/insert_pk_float_zero deleted file mode 100644 index 289a1fafa..000000000 --- a/tests/sql/schema/insert_pk_float_zero +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO "float" VALUES (0.0) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "float" ( - pk FLOAT PRIMARY KEY -) -[Float(0.0)] -[Float(2.718)] -[Float(3.14)] -[Float(inf)] -[Float(NaN)] diff --git a/tests/sql/schema/insert_pk_integer b/tests/sql/schema/insert_pk_integer deleted file mode 100644 index 4743ace81..000000000 --- a/tests/sql/schema/insert_pk_integer +++ /dev/null @@ -1,10 +0,0 @@ -Query: INSERT INTO "integer" VALUES (3) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "integer" ( - pk INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] diff --git a/tests/sql/schema/insert_pk_integer_conflict b/tests/sql/schema/insert_pk_integer_conflict deleted file mode 100644 index 31100ac1b..000000000 --- a/tests/sql/schema/insert_pk_integer_conflict +++ /dev/null @@ -1,9 +0,0 @@ -Query: INSERT INTO "integer" VALUES (1) -Error: InvalidInput("primary key 1 already exists") - -Storage: -CREATE TABLE "integer" ( - pk INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] diff --git a/tests/sql/schema/insert_pk_integer_negative b/tests/sql/schema/insert_pk_integer_negative deleted file mode 100644 index a5e3419fb..000000000 --- a/tests/sql/schema/insert_pk_integer_negative +++ /dev/null @@ -1,10 +0,0 @@ -Query: INSERT INTO "integer" VALUES (-1) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "integer" ( - pk INTEGER PRIMARY KEY -) -[Integer(-1)] -[Integer(1)] -[Integer(2)] diff --git a/tests/sql/schema/insert_pk_integer_null b/tests/sql/schema/insert_pk_integer_null deleted file mode 100644 index 120945c12..000000000 --- a/tests/sql/schema/insert_pk_integer_null +++ /dev/null @@ -1,9 +0,0 @@ -Query: INSERT INTO "integer" VALUES (NULL) -Error: InvalidInput("NULL value not allowed for column pk") - -Storage: -CREATE TABLE "integer" ( - pk INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] diff --git a/tests/sql/schema/insert_pk_integer_zero b/tests/sql/schema/insert_pk_integer_zero deleted file mode 100644 index f6e609586..000000000 --- a/tests/sql/schema/insert_pk_integer_zero +++ /dev/null @@ -1,10 +0,0 @@ -Query: INSERT INTO "integer" VALUES (0) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "integer" ( - pk INTEGER PRIMARY KEY -) -[Integer(0)] -[Integer(1)] -[Integer(2)] diff --git a/tests/sql/schema/insert_pk_string b/tests/sql/schema/insert_pk_string deleted file mode 100644 index eda90c820..000000000 --- a/tests/sql/schema/insert_pk_string +++ /dev/null @@ -1,10 +0,0 @@ -Query: INSERT INTO "string" VALUES ('baz') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "string" ( - pk STRING PRIMARY KEY -) -[String("bar")] -[String("baz")] -[String("foo")] diff --git a/tests/sql/schema/insert_pk_string_case b/tests/sql/schema/insert_pk_string_case deleted file mode 100644 index 90ce91788..000000000 --- a/tests/sql/schema/insert_pk_string_case +++ /dev/null @@ -1,10 +0,0 @@ -Query: INSERT INTO "string" VALUES ('Foo') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "string" ( - pk STRING PRIMARY KEY -) -[String("Foo")] -[String("bar")] -[String("foo")] diff --git a/tests/sql/schema/insert_pk_string_conflict b/tests/sql/schema/insert_pk_string_conflict deleted file mode 100644 index c840a3a08..000000000 --- a/tests/sql/schema/insert_pk_string_conflict +++ /dev/null @@ -1,9 +0,0 @@ -Query: INSERT INTO "string" VALUES ('foo') -Error: InvalidInput("primary key foo already exists") - -Storage: -CREATE TABLE "string" ( - pk STRING PRIMARY KEY -) -[String("bar")] -[String("foo")] diff --git a/tests/sql/schema/insert_pk_string_empty b/tests/sql/schema/insert_pk_string_empty deleted file mode 100644 index b8c028b20..000000000 --- a/tests/sql/schema/insert_pk_string_empty +++ /dev/null @@ -1,10 +0,0 @@ -Query: INSERT INTO "string" VALUES ('') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "string" ( - pk STRING PRIMARY KEY -) -[String("")] -[String("bar")] -[String("foo")] diff --git a/tests/sql/schema/insert_pk_string_null b/tests/sql/schema/insert_pk_string_null deleted file mode 100644 index 6102eccd3..000000000 --- a/tests/sql/schema/insert_pk_string_null +++ /dev/null @@ -1,9 +0,0 @@ -Query: INSERT INTO "string" VALUES (NULL) -Error: InvalidInput("NULL value not allowed for column pk") - -Storage: -CREATE TABLE "string" ( - pk STRING PRIMARY KEY -) -[String("bar")] -[String("foo")] diff --git a/tests/sql/schema/insert_ref_boolean b/tests/sql/schema/insert_ref_boolean deleted file mode 100644 index 5a6092691..000000000 --- a/tests/sql/schema/insert_ref_boolean +++ /dev/null @@ -1,17 +0,0 @@ -Query: INSERT INTO source VALUES (1, TRUE) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id BOOLEAN DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Boolean(true)] - -Index source.target_id -Boolean(true) => [Integer(1)] - -CREATE TABLE target ( - id BOOLEAN PRIMARY KEY -) -[Boolean(true)] diff --git a/tests/sql/schema/insert_ref_boolean_missing b/tests/sql/schema/insert_ref_boolean_missing deleted file mode 100644 index 5f28b391c..000000000 --- a/tests/sql/schema/insert_ref_boolean_missing +++ /dev/null @@ -1,15 +0,0 @@ -Query: INSERT INTO source VALUES (1, FALSE) -Error: InvalidInput("reference FALSE not in table target") - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id BOOLEAN DEFAULT NULL INDEX REFERENCES target -) - -Index source.target_id - -CREATE TABLE target ( - id BOOLEAN PRIMARY KEY -) -[Boolean(true)] diff --git a/tests/sql/schema/insert_ref_boolean_null b/tests/sql/schema/insert_ref_boolean_null deleted file mode 100644 index 28096f5dd..000000000 --- a/tests/sql/schema/insert_ref_boolean_null +++ /dev/null @@ -1,17 +0,0 @@ -Query: INSERT INTO source VALUES (1, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id BOOLEAN DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Null] - -Index source.target_id -Null => [Integer(1)] - -CREATE TABLE target ( - id BOOLEAN PRIMARY KEY -) -[Boolean(true)] diff --git a/tests/sql/schema/insert_ref_float b/tests/sql/schema/insert_ref_float deleted file mode 100644 index 8a9704c51..000000000 --- a/tests/sql/schema/insert_ref_float +++ /dev/null @@ -1,18 +0,0 @@ -Query: INSERT INTO source VALUES (1, 3.14) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id FLOAT DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Float(3.14)] - -Index source.target_id -Float(3.14) => [Integer(1)] - -CREATE TABLE target ( - id FLOAT PRIMARY KEY -) -[Float(2.718)] -[Float(3.14)] diff --git a/tests/sql/schema/insert_ref_float_missing b/tests/sql/schema/insert_ref_float_missing deleted file mode 100644 index 11c19c3d9..000000000 --- a/tests/sql/schema/insert_ref_float_missing +++ /dev/null @@ -1,16 +0,0 @@ -Query: INSERT INTO source VALUES (1, 1.618) -Error: InvalidInput("reference 1.618 not in table target") - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id FLOAT DEFAULT NULL INDEX REFERENCES target -) - -Index source.target_id - -CREATE TABLE target ( - id FLOAT PRIMARY KEY -) -[Float(2.718)] -[Float(3.14)] diff --git a/tests/sql/schema/insert_ref_float_null b/tests/sql/schema/insert_ref_float_null deleted file mode 100644 index c51222e49..000000000 --- a/tests/sql/schema/insert_ref_float_null +++ /dev/null @@ -1,18 +0,0 @@ -Query: INSERT INTO source VALUES (1, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id FLOAT DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Null] - -Index source.target_id -Null => [Integer(1)] - -CREATE TABLE target ( - id FLOAT PRIMARY KEY -) -[Float(2.718)] -[Float(3.14)] diff --git a/tests/sql/schema/insert_ref_integer b/tests/sql/schema/insert_ref_integer deleted file mode 100644 index 7c2d4ad24..000000000 --- a/tests/sql/schema/insert_ref_integer +++ /dev/null @@ -1,19 +0,0 @@ -Query: INSERT INTO source VALUES (1, 1) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id INTEGER DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Integer(1)] - -Index source.target_id -Integer(1) => [Integer(1)] - -CREATE TABLE target ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] diff --git a/tests/sql/schema/insert_ref_integer_missing b/tests/sql/schema/insert_ref_integer_missing deleted file mode 100644 index 0fe4fe5fd..000000000 --- a/tests/sql/schema/insert_ref_integer_missing +++ /dev/null @@ -1,17 +0,0 @@ -Query: INSERT INTO source VALUES (1, 7) -Error: InvalidInput("reference 7 not in table target") - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id INTEGER DEFAULT NULL INDEX REFERENCES target -) - -Index source.target_id - -CREATE TABLE target ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] diff --git a/tests/sql/schema/insert_ref_integer_null b/tests/sql/schema/insert_ref_integer_null deleted file mode 100644 index 42dd80c70..000000000 --- a/tests/sql/schema/insert_ref_integer_null +++ /dev/null @@ -1,19 +0,0 @@ -Query: INSERT INTO source VALUES (1, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id INTEGER DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Null] - -Index source.target_id -Null => [Integer(1)] - -CREATE TABLE target ( - id INTEGER PRIMARY KEY -) -[Integer(1)] -[Integer(2)] -[Integer(3)] diff --git a/tests/sql/schema/insert_ref_self b/tests/sql/schema/insert_ref_self deleted file mode 100644 index 4788836be..000000000 --- a/tests/sql/schema/insert_ref_self +++ /dev/null @@ -1,19 +0,0 @@ -Query: INSERT INTO self VALUES (5, 1, 'e') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE self ( - id INTEGER PRIMARY KEY, - self_id INTEGER DEFAULT NULL INDEX REFERENCES self, - value STRING DEFAULT NULL -) -[Integer(1), Integer(1), String("a")] -[Integer(2), Integer(1), String("b")] -[Integer(3), Integer(3), String("c")] -[Integer(4), Null, String("d")] -[Integer(5), Integer(1), String("e")] - -Index self.self_id -Null => [Integer(4)] -Integer(1) => [Integer(1), Integer(2), Integer(5)] -Integer(3) => [Integer(3)] diff --git a/tests/sql/schema/insert_ref_self_missing b/tests/sql/schema/insert_ref_self_missing deleted file mode 100644 index 674b59f47..000000000 --- a/tests/sql/schema/insert_ref_self_missing +++ /dev/null @@ -1,18 +0,0 @@ -Query: INSERT INTO self VALUES (5, 9, 'e') -Error: InvalidInput("reference 9 not in table self") - -Storage: -CREATE TABLE self ( - id INTEGER PRIMARY KEY, - self_id INTEGER DEFAULT NULL INDEX REFERENCES self, - value STRING DEFAULT NULL -) -[Integer(1), Integer(1), String("a")] -[Integer(2), Integer(1), String("b")] -[Integer(3), Integer(3), String("c")] -[Integer(4), Null, String("d")] - -Index self.self_id -Null => [Integer(4)] -Integer(1) => [Integer(1), Integer(2)] -Integer(3) => [Integer(3)] diff --git a/tests/sql/schema/insert_ref_self_null b/tests/sql/schema/insert_ref_self_null deleted file mode 100644 index 49183ff24..000000000 --- a/tests/sql/schema/insert_ref_self_null +++ /dev/null @@ -1,19 +0,0 @@ -Query: INSERT INTO self VALUES (5, NULL, 'e') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE self ( - id INTEGER PRIMARY KEY, - self_id INTEGER DEFAULT NULL INDEX REFERENCES self, - value STRING DEFAULT NULL -) -[Integer(1), Integer(1), String("a")] -[Integer(2), Integer(1), String("b")] -[Integer(3), Integer(3), String("c")] -[Integer(4), Null, String("d")] -[Integer(5), Null, String("e")] - -Index self.self_id -Null => [Integer(4), Integer(5)] -Integer(1) => [Integer(1), Integer(2)] -Integer(3) => [Integer(3)] diff --git a/tests/sql/schema/insert_ref_self_self b/tests/sql/schema/insert_ref_self_self deleted file mode 100644 index 39735529e..000000000 --- a/tests/sql/schema/insert_ref_self_self +++ /dev/null @@ -1,20 +0,0 @@ -Query: INSERT INTO self VALUES (5, 5, 'e') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE self ( - id INTEGER PRIMARY KEY, - self_id INTEGER DEFAULT NULL INDEX REFERENCES self, - value STRING DEFAULT NULL -) -[Integer(1), Integer(1), String("a")] -[Integer(2), Integer(1), String("b")] -[Integer(3), Integer(3), String("c")] -[Integer(4), Null, String("d")] -[Integer(5), Integer(5), String("e")] - -Index self.self_id -Null => [Integer(4)] -Integer(1) => [Integer(1), Integer(2)] -Integer(3) => [Integer(3)] -Integer(5) => [Integer(5)] diff --git a/tests/sql/schema/insert_ref_string b/tests/sql/schema/insert_ref_string deleted file mode 100644 index b255e2ed2..000000000 --- a/tests/sql/schema/insert_ref_string +++ /dev/null @@ -1,18 +0,0 @@ -Query: INSERT INTO source VALUES (1, 'foo') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id STRING DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), String("foo")] - -Index source.target_id -String("foo") => [Integer(1)] - -CREATE TABLE target ( - id STRING PRIMARY KEY -) -[String("bar")] -[String("foo")] diff --git a/tests/sql/schema/insert_ref_string_case b/tests/sql/schema/insert_ref_string_case deleted file mode 100644 index c1ad7a1c0..000000000 --- a/tests/sql/schema/insert_ref_string_case +++ /dev/null @@ -1,16 +0,0 @@ -Query: INSERT INTO source VALUES (1, 'Foo') -Error: InvalidInput("reference Foo not in table target") - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id STRING DEFAULT NULL INDEX REFERENCES target -) - -Index source.target_id - -CREATE TABLE target ( - id STRING PRIMARY KEY -) -[String("bar")] -[String("foo")] diff --git a/tests/sql/schema/insert_ref_string_missing b/tests/sql/schema/insert_ref_string_missing deleted file mode 100644 index e4bb50ab7..000000000 --- a/tests/sql/schema/insert_ref_string_missing +++ /dev/null @@ -1,16 +0,0 @@ -Query: INSERT INTO source VALUES (1, 'baz') -Error: InvalidInput("reference baz not in table target") - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id STRING DEFAULT NULL INDEX REFERENCES target -) - -Index source.target_id - -CREATE TABLE target ( - id STRING PRIMARY KEY -) -[String("bar")] -[String("foo")] diff --git a/tests/sql/schema/insert_ref_string_null b/tests/sql/schema/insert_ref_string_null deleted file mode 100644 index 84cf0860e..000000000 --- a/tests/sql/schema/insert_ref_string_null +++ /dev/null @@ -1,18 +0,0 @@ -Query: INSERT INTO source VALUES (1, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE source ( - id INTEGER PRIMARY KEY, - target_id STRING DEFAULT NULL INDEX REFERENCES target -) -[Integer(1), Null] - -Index source.target_id -Null => [Integer(1)] - -CREATE TABLE target ( - id STRING PRIMARY KEY -) -[String("bar")] -[String("foo")] diff --git a/tests/sql/schema/insert_string b/tests/sql/schema/insert_string deleted file mode 100644 index 2f6e9f794..000000000 --- a/tests/sql/schema/insert_string +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "string") VALUES (0, 'abc') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Null, String("abc")] diff --git a/tests/sql/schema/insert_string_boolean b/tests/sql/schema/insert_string_boolean deleted file mode 100644 index c946367fc..000000000 --- a/tests/sql/schema/insert_string_boolean +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "string") VALUES (0, FALSE) -Error: InvalidInput("invalid datatype BOOLEAN for STRING column string") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_string_empty b/tests/sql/schema/insert_string_empty deleted file mode 100644 index 0d9e04c42..000000000 --- a/tests/sql/schema/insert_string_empty +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "string") VALUES (0, '') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Null, String("")] diff --git a/tests/sql/schema/insert_string_float b/tests/sql/schema/insert_string_float deleted file mode 100644 index 1d3077be8..000000000 --- a/tests/sql/schema/insert_string_float +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "string") VALUES (0, 3.14) -Error: InvalidInput("invalid datatype FLOAT for STRING column string") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_string_integer b/tests/sql/schema/insert_string_integer deleted file mode 100644 index 5f425adc7..000000000 --- a/tests/sql/schema/insert_string_integer +++ /dev/null @@ -1,11 +0,0 @@ -Query: INSERT INTO types (id, "string") VALUES (0, 1) -Error: InvalidInput("invalid datatype INTEGER for STRING column string") - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) diff --git a/tests/sql/schema/insert_string_null b/tests/sql/schema/insert_string_null deleted file mode 100644 index 7adeaf472..000000000 --- a/tests/sql/schema/insert_string_null +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "string") VALUES (0, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Null, Null] diff --git a/tests/sql/schema/insert_string_unicode b/tests/sql/schema/insert_string_unicode deleted file mode 100644 index 8db0f1254..000000000 --- a/tests/sql/schema/insert_string_unicode +++ /dev/null @@ -1,12 +0,0 @@ -Query: INSERT INTO types (id, "string") VALUES (0, ' Hi! 👋') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE types ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL, - "float" FLOAT DEFAULT NULL, - "integer" INTEGER DEFAULT NULL, - "string" STRING DEFAULT NULL -) -[Integer(0), Null, Null, Null, String(" Hi! 👋")] diff --git a/tests/sql/schema/insert_unique_boolean b/tests/sql/schema/insert_unique_boolean deleted file mode 100644 index eb7db1157..000000000 --- a/tests/sql/schema/insert_unique_boolean +++ /dev/null @@ -1,31 +0,0 @@ -Query: INSERT INTO "unique" (id, "boolean") VALUES (2, FALSE) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] -[Integer(2), Boolean(false), Null, Null, Null] - -Index unique.boolean -Null => [Integer(0)] -Boolean(false) => [Integer(2)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0), Integer(2)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0), Integer(2)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0), Integer(2)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_boolean_duplicate b/tests/sql/schema/insert_unique_boolean_duplicate deleted file mode 100644 index 0c5d25f1d..000000000 --- a/tests/sql/schema/insert_unique_boolean_duplicate +++ /dev/null @@ -1,29 +0,0 @@ -Query: INSERT INTO "unique" (id, "boolean") VALUES (2, TRUE) -Error: InvalidInput("value TRUE already in unique column boolean") - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] - -Index unique.boolean -Null => [Integer(0)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_float b/tests/sql/schema/insert_unique_float deleted file mode 100644 index c370eef1d..000000000 --- a/tests/sql/schema/insert_unique_float +++ /dev/null @@ -1,31 +0,0 @@ -Query: INSERT INTO "unique" (id, "float") VALUES (2, 2.718) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] -[Integer(2), Null, Float(2.718), Null, Null] - -Index unique.boolean -Null => [Integer(0), Integer(2)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0)] -Float(2.718) => [Integer(2)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0), Integer(2)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0), Integer(2)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_float_duplicate b/tests/sql/schema/insert_unique_float_duplicate deleted file mode 100644 index e651dac6f..000000000 --- a/tests/sql/schema/insert_unique_float_duplicate +++ /dev/null @@ -1,29 +0,0 @@ -Query: INSERT INTO "unique" (id, "float") VALUES (2, 3.14) -Error: InvalidInput("value 3.14 already in unique column float") - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] - -Index unique.boolean -Null => [Integer(0)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_integer b/tests/sql/schema/insert_unique_integer deleted file mode 100644 index f33d308d1..000000000 --- a/tests/sql/schema/insert_unique_integer +++ /dev/null @@ -1,31 +0,0 @@ -Query: INSERT INTO "unique" (id, "integer") VALUES (2, 3) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] -[Integer(2), Null, Null, Integer(3), Null] - -Index unique.boolean -Null => [Integer(0), Integer(2)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0), Integer(2)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0)] -Integer(3) => [Integer(2)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0), Integer(2)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_integer_duplicate b/tests/sql/schema/insert_unique_integer_duplicate deleted file mode 100644 index 1f73d0d20..000000000 --- a/tests/sql/schema/insert_unique_integer_duplicate +++ /dev/null @@ -1,29 +0,0 @@ -Query: INSERT INTO "unique" (id, "integer") VALUES (2, 7) -Error: InvalidInput("value 7 already in unique column integer") - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] - -Index unique.boolean -Null => [Integer(0)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_nulls b/tests/sql/schema/insert_unique_nulls deleted file mode 100644 index d90bd03b6..000000000 --- a/tests/sql/schema/insert_unique_nulls +++ /dev/null @@ -1,30 +0,0 @@ -Query: INSERT INTO "unique" VALUES (2, NULL, NULL, NULL, NULL) -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] -[Integer(2), Null, Null, Null, Null] - -Index unique.boolean -Null => [Integer(0), Integer(2)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0), Integer(2)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0), Integer(2)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0), Integer(2)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_string b/tests/sql/schema/insert_unique_string deleted file mode 100644 index cd5a4c305..000000000 --- a/tests/sql/schema/insert_unique_string +++ /dev/null @@ -1,31 +0,0 @@ -Query: INSERT INTO "unique" (id, "string") VALUES (2, 'bar') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] -[Integer(2), Null, Null, Null, String("bar")] - -Index unique.boolean -Null => [Integer(0), Integer(2)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0), Integer(2)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0), Integer(2)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0)] -String("bar") => [Integer(2)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_string_case b/tests/sql/schema/insert_unique_string_case deleted file mode 100644 index 3ca9f9ace..000000000 --- a/tests/sql/schema/insert_unique_string_case +++ /dev/null @@ -1,31 +0,0 @@ -Query: INSERT INTO "unique" (id, "string") VALUES (2, 'Foo') -Result: Insert { count: 1 } - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] -[Integer(2), Null, Null, Null, String("Foo")] - -Index unique.boolean -Null => [Integer(0), Integer(2)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0), Integer(2)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0), Integer(2)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0)] -String("Foo") => [Integer(2)] -String("foo") => [Integer(1)] diff --git a/tests/sql/schema/insert_unique_string_duplicate b/tests/sql/schema/insert_unique_string_duplicate deleted file mode 100644 index c0e15c8b4..000000000 --- a/tests/sql/schema/insert_unique_string_duplicate +++ /dev/null @@ -1,29 +0,0 @@ -Query: INSERT INTO "unique" (id, "string") VALUES (2, 'foo') -Error: InvalidInput("value foo already in unique column string") - -Storage: -CREATE TABLE "unique" ( - id INTEGER PRIMARY KEY, - "boolean" BOOLEAN DEFAULT NULL UNIQUE INDEX, - "float" FLOAT DEFAULT NULL UNIQUE INDEX, - "integer" INTEGER DEFAULT NULL UNIQUE INDEX, - "string" STRING DEFAULT NULL UNIQUE INDEX -) -[Integer(0), Null, Null, Null, Null] -[Integer(1), Boolean(true), Float(3.14), Integer(7), String("foo")] - -Index unique.boolean -Null => [Integer(0)] -Boolean(true) => [Integer(1)] - -Index unique.float -Null => [Integer(0)] -Float(3.14) => [Integer(1)] - -Index unique.integer -Null => [Integer(0)] -Integer(7) => [Integer(1)] - -Index unique.string -Null => [Integer(0)] -String("foo") => [Integer(1)]