summaryrefslogtreecommitdiff
path: root/sql/json_table.h
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2021-05-13 12:25:01 +0300
committerSergei Petrunia <psergey@askmonty.org>2021-05-13 12:25:01 +0300
commitc67d69abb9b6d05a1c837dc92e1faad770741f55 (patch)
tree0ff9e0a13495f2f845c961ac399cf481f4e1a047 /sql/json_table.h
parent370b310b1d67ad42df96b75c3876fdcf67a8694f (diff)
downloadmariadb-git-bb-10.6-mdev25154.tar.gz
MDEV-25154: JSON_TABLE: Queries involving ordinality columns are unsafe ...bb-10.6-mdev25154
Mark the JSON_TABLE function as SBR-unsafe. It is not unsafe for the current implementation. But we still mark it as such in order to be future-proof and keep it possible to change JSON data representation in the future.
Diffstat (limited to 'sql/json_table.h')
-rw-r--r--sql/json_table.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/json_table.h b/sql/json_table.h
index beae5405d25..3560b4ca137 100644
--- a/sql/json_table.h
+++ b/sql/json_table.h
@@ -183,6 +183,22 @@ public:
into the TABLE_LIST::table_function.
Then the ha_json_table instance is created based on it in
the create_table_for_function().
+
+ == Replication: whether JSON_TABLE is deterministic ==
+
+ In sql_yacc.yy, we set BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION whenever
+ JSON_TABLE is used. The reasoning behind this is as follows:
+
+ In the current MariaDB code, evaluation of JSON_TABLE is deterministic,
+ that is, for a given input string JSON_TABLE will always produce the same
+ set of rows in the same order. However one can think of JSON documents
+ that one can consider indentical which will produce different output.
+ In order to be feature-proof and withstand changes like:
+ - sorting JSON object members by name (like MySQL does)
+ - changing the way duplicate object members are handled
+ we mark the function as SBR-unsafe.
+ (If there is ever an issue with this, marking the function as SBR-safe
+ is a non-intrusive change we will always be able to make)
*/
class Table_function_json_table : public Sql_alloc