mirror of
https://github.com/MariaDB/server.git
synced 2026-03-09 09:58:41 +01:00
Add support for reversed executable comments using /*!!version */ and /*M!!version */ syntax. These execute the comment body only when the server version is strictly less than the specified version, which is the inverse of the existing /*!version */ syntax. This enables writing portable SQL that uses newer syntax on new servers while falling back to older syntax on older servers, e.g.: CREATE /*!100000 OR REPLACE */ TABLE /*!!100000 IF NOT EXISTS */ t1 ... On MariaDB >= 10.0 this expands to CREATE OR REPLACE TABLE t1, while on older versions it expands to CREATE TABLE IF NOT EXISTS t1. Implementation: in lex_one_token(), after detecting a versioned comment (/*! or /*M!), check for an additional '!' character. If present, invert the version comparison so the comment body is expanded only when MYSQL_VERSION_ID < version. Tests added to main.comments and plugins.server_audit confirming: - Reversed comments with version <= server version do not execute - Reversed comments with version > server version execute - MariaDB-specific /*M!! variant works correctly - Reversed comments without a version number always execute - Audit plugin correctly logs executed reversed comments - Combined forward + reversed comments in a single statement All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. |
||
|---|---|---|
| .. | ||
| archive | ||
| atomic | ||
| binlog | ||
| binlog_encryption | ||
| binlog_in_engine | ||
| client | ||
| compat | ||
| csv | ||
| encryption | ||
| engines | ||
| events | ||
| federated | ||
| funcs_1 | ||
| funcs_2 | ||
| galera | ||
| galera_3nodes | ||
| galera_3nodes_sr | ||
| galera_sr | ||
| gcol | ||
| handler | ||
| heap | ||
| innodb | ||
| innodb_fts | ||
| innodb_gis | ||
| innodb_i_s | ||
| innodb_zip | ||
| jp | ||
| json | ||
| large_tests | ||
| maria | ||
| mariabackup | ||
| merge | ||
| mtr/t | ||
| mtr2 | ||
| multi_source | ||
| optimizer_unfixed_bugs | ||
| parts | ||
| perfschema | ||
| perfschema_stress | ||
| period | ||
| plugins | ||
| roles | ||
| rpl | ||
| s3 | ||
| sql_sequence | ||
| storage_engine | ||
| stress | ||
| sys_vars | ||
| sysschema | ||
| unit | ||
| vcol | ||
| versioning | ||
| wsrep | ||