Skip to content

MDEV-39412: parse error reading tabs in ranges#4994

Open
bsrikanth-mariadb wants to merge 1 commit intobb-12.3-MDEV-38805-dev-sprint-work-2from
12.3-MDEV-39412-parse-error-reading-tabs-in-ranges
Open

MDEV-39412: parse error reading tabs in ranges#4994
bsrikanth-mariadb wants to merge 1 commit intobb-12.3-MDEV-38805-dev-sprint-work-2from
12.3-MDEV-39412-parse-error-reading-tabs-in-ranges

Conversation

@bsrikanth-mariadb
Copy link
Copy Markdown
Contributor

@bsrikanth-mariadb bsrikanth-mariadb commented Apr 27, 2026

Note:
while reading from information_schema.optimizer_context one level of unescaping is already done i.e. (\\t becomes \t or \\\\t becomes \\t)

w.r.t the MDEV, there are 2 problems: -

When reading from the sql script file, json parser is not able to parse the range value in json_read_value() from json_lib.c "ranges": [
"(b\t\t\t\t\t\t) <= (b) <= (b???????)"
],
mainly the \t\t stuff, and hence a warning.
It also stops loading the context into memory.
Since, a new table is created with empty data, and without context, we get Impossible WHERE noticed after reading const tables

There is unescaping call being made in read_string() from sql_json_lib.cc while parsing of the context. With this \\t was becoming \t. However, print_range() from opt_range.cc already does escaping of the values. The value "b\t\t\t" was in fact produced as "b\\t\\t\\t". Later, we try to compare range values from the query and the context.

Here a mismatch a found because, in one case there was escaping, and in the other case escaping got removed.

Solutions

For Problem 1. have escaping for ranges.
This should be done while dumping range values into the context.

For Problem 2. Remove unscaping call in read_string().

Note:
while reading from information_schema.optimizer_context one level of unescaping
is already done i.e. (\\t becomes \t or \\\\t becomes \\t)

w.r.t the MDEV, there are 2 problems: -

1.
When reading from the sql script file, json parser is not able to parse
the range value in json_read_value() from json_lib.c
"ranges": [
            "(b\t\t\t\t\t\t) <= (b) <= (b???????)"
          ],
mainly the \t\t stuff, and hence a warning.
It also stops loading the context into memory.
Since, a new table is created with empty data, and without context,
we get Impossible WHERE noticed after reading const tables

2.
There is unescaping call being made in read_string() from sql_json_lib.cc
while parsing of the context. With this \\t was becoming \t.
However, print_range() from opt_range.cc already does escaping of the values.
The value "b\t\t\t" was in fact produced as "\b\\t\\t\\t".
Later, we try to compare range values from the query and the context.

Here a mismatch a found because, in one case there was escaping,
and in the other case escaping got removed.

Solutions
=========
For Problem 1. have escaping for ranges.
This should be done while dumping range values into the context.

For Problem 2. Remove unscaping call in read_string().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant