Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.11, 11.4, 11.8, 12.3, 13.0, 13.1, 13.2, 12.3.3
-
Linux/amd64
Description
In MariaDB 12.3.3 on Linux/amd64, the doubled-apostrophe literal 'O''Hara' is accepted as a table-level comment and as a partition comment in the default SQL mode, but the partitioned CREATE TABLE fails with error 1064 when NO_BACKSLASH_ESCAPES is enabled. A partition comment without an apostrophe also succeeds in that mode.
Run the following statements:
CREATE DATABASE `partition_comment_test`; |
SET SESSION sql_mode='NO_BACKSLASH_ESCAPES'; |
USE `partition_comment_test`; |
SELECT HEX('O''Hara'); |
CREATE TABLE `partitioned_table` (id INT) ENGINE=InnoDB PARTITION BY RANGE (id) (PARTITION `range_partition` VALUES LESS THAN (MAXVALUE) COMMENT='O''Hara'); |
The SELECT confirms that the literal is valid and evaluates to the expected bytes:
4F2748617261
|
The CREATE TABLE then fails:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' ENGINE = InnoDB)' at line 2
|
For comparison, execute these controls independently in the same database and SQL mode:
CREATE TABLE `plain_partition_comment` (id INT) ENGINE=InnoDB PARTITION BY RANGE (id) (PARTITION `range_partition` VALUES LESS THAN (MAXVALUE) COMMENT='plain'); |
CREATE TABLE `table_comment` (id INT) ENGINE=InnoDB COMMENT='O''Hara'; |
Both controls succeed. The equivalent partitioned statement also succeeds when NO_BACKSLASH_ESCAPES is disabled. In addition, a partitioned table created in the default mode emits SHOW CREATE TABLE text containing a backslash-escaped apostrophe, and replaying that generated definition under NO_BACKSLASH_ESCAPES fails with the same syntax error.
CREATE TABLE should accept 'O''Hara' as a partition COMMENT under NO_BACKSLASH_ESCAPES, preserve the bytes 4F2748617261, and emit SHOW CREATE TABLE syntax that can be replayed under the same mode. Current source is consistent with the observed behavior: partition comments are serialized through append_for_single_quote(), which emits backslash escapes, while internal partition-definition parsing can retain NO_BACKSLASH_ESCAPES.
This occurs when a partition comment containing an apostrophe is created or replayed in a session using NO_BACKSLASH_ESCAPES.
Attachments
Issue Links
- relates to
-
MDEV-6018 Strange interaction of SQL_MODE=ANSI and partition by TIMESTAMP
-
- Open
-
-
MDEV-31187 Add class Sql_mode_save_for_frm_handling
-
- Closed
-