Skip to content

Where the stores differ

  • A temporal value comes back as its ISO 8601 text, where a graph engine’s driver gives a value of its own.
  • Postgres works float arithmetic, sum() and avg() out in exact decimal, so it is more accurate: 0.1 + 0.2 is 0.3 there, where doubles give 0.30000000000000004. A result differs from Neo4j’s only around its 16th significant digit, and still comes back as a float.
  • SQLite adds floats in sum() and avg() as doubles, as Neo4j does, but corrects for rounding as it adds, so a long sum of floats can be more accurate than Neo4j’s in its last digit.
  • Oracle reads an empty text as null in =~. A text function that gives an empty text ('' + '', toUpper(''), trim(' ') …) gives it there too, and STARTS WITH, ENDS WITH and CONTAINS of an empty text, and size() and isEmpty() of one, give what the other stores give. size() of a text past 4,000 bytes counts a character past U+FFFF, an emoji say, as 2 (#729).
  • A sum() of integers past a long’s range is a float on Oracle and Postgres, as on Neo4j. Neo4j goes on as a double from the row where a long would overflow, so a sum that passes the range on the way and comes back into it, [9223372036854775807, 1, -1], is a float there and a long on Oracle and Postgres, which keep no order and tell the total alone. SQLite fails with integer overflow wherever a running total passes the range.
  • Where Neo4j gives NaN or an infinity from a function (log(0), sqrt(-1)), the statement fails on each SQL store. A number divided by a float zero is the NaN or infinity Neo4j gives on each (0.0 / 0.0 is NaN, $x / 0.0 an infinity), and taken % by one is NaN. Neo4j fails a division or % by an integer zero, but where both numbers are written in the statement, which it works out before it runs, as Java does: 1.0 / 0 and 1.0 / (1 - 1) are an infinity there and on each SQL store, and 1 / 0 fails. $x / 0, WITH 0 AS z RETURN 1.0 / z and 5.0 % $z given 0 fail on Neo4j and on each SQL store. On Postgres, a statement that writes and divides a float by zero fails, as its jsonb holds neither. toFloat reads a text that names NaN or an infinity as Java does ('NaN', '-Infinity') on each SQL store, but is null in a statement that writes on Postgres. Other spellings ('nan', 'inf', 'INFINITY') are null, as on Neo4j.
  • NaN and the infinities given as parameters are the floats they are on each SQL store, as on Neo4j: NaN is equal to nothing and ordered with nothing, and +, -, * and / keep it. Where Neo4j gives NaN or an infinity from ^ or a function of numbers (abs, sqrt …) given one, Oracle gives null. So does SQLite for NaN from ^ and a function of numbers, and for an infinity it gives the infinity from ^, abs, round and floor, and fails from sqrt, log and exp. % given one gives what Neo4j gives on each SQL store. Oracle stores them too. SQLite stores an infinity, and refuses a statement that writes and is given NaN; Postgres refuses one given either, as its jsonb holds neither. A save writes them as a statement does, and is refused where it is, with the same message. DISTINCT, a grouping key and a statement’s UNION without ALL keep each NaN apart on each SQL store, which can’t tell one NaN from another: UNWIND [$p, $p] AS x RETURN count(DISTINCT x) given NaN is 2, where Neo4j, keeping a NaN given once and read twice once, gives 1. A UNION without ALL in CALL { … } keeps rows that are NaN once on each SQL store, where Neo4j gives each. DISTINCT keeps once two lists or maps holding NaN that two items of one list make (UNWIND [[0.0/0.0], [0.0/0.0]] AS r) on each SQL store, and two stored NaNs on Oracle where the statement works out none, where Neo4j keeps each apart.
  • A float’s negative zero is kept by Neo4j and lost by each SQL store. -0.0 comes back as 0.0, and toString() of it is '0.0', on Oracle and Postgres, whose stores hold no negative zero. On SQLite it does so where the statement writes it or works it out; one given as a parameter keeps its sign. It is still equal to 0.0 and 0, and grouped with them, on every store, but isn’t ordered before them as Neo4j orders it (drivine-cypher-spec#314).
  • <, <=, > and >= order two lists item by item where the statement makes one of them a list (n.tags < ['b']). Two values whose kind it leaves open, such as two parameters or two properties, compare as null where they hold lists. Two maps compare as null, and two that differ do in a list too, where Neo4j orders them.
  • Text is ordered by the database’s collation on Postgres, and by BINARY on SQLite.
  • CALL { … } IN TRANSACTIONS is one statement, applied whole, where a graph engine commits each batch as it goes.
  • On Oracle, a quantified path pattern’s WHERE reads no variable from outside it.

The store sections (Oracle, Postgres, SQLite) give the rest.