diff --git a/content/en/docs/API/non-deterministic/_index.md b/content/en/docs/API/non-deterministic/_index.md index 4141cbb..0dd7cc4 100755 --- a/content/en/docs/API/non-deterministic/_index.md +++ b/content/en/docs/API/non-deterministic/_index.md @@ -23,10 +23,11 @@ An rqlite node addresses this issue by _rewriting_ received SQL statements that ### `RANDOM()` Any SQL statement containing `RANDOM()` is rewritten following these rules: -- the statement is part of a write-request i.e. the request is sent to the `/db/execute` HTTP API. -- the statement is part of a read-request i.e. the request is sent to the `/db/query` HTTP API **and** the read-request is made with _strong_ read consistency. -- if `RANDOM()` is used as an `ORDER BY` qualifier it is not rewritten. -- the HTTP request containing the SQL statement does not have the query parameter `norwrandom` present. +- The statement is part of a write-request i.e. the request is sent to the `/db/execute` HTTP API. +- The statement is part of a read-request i.e. the request is sent to the `/db/query` HTTP API **and** the read-request is made with _strong_ read consistency. +- If `RANDOM()` is used as an `ORDER BY` qualifier it is not rewritten. + - This does mean that certain `INSERT` statements are not rewritten e.g. `INSERT INTO foo (x) SELECT x FROM bar ORDER BY RANDOM()`. Executing such a statement may result in different data under each node. +- The HTTP request containing the SQL statement does not have the query parameter `norwrandom` present. `RANDOM()` is replaced with a random integer between -9223372036854775808 and +9223372036854775807 by the rqlite node that first receives the SQL statement.