Commit 1995c626 authored by Daniel Lenski's avatar Daniel Lenski Committed by Daniel Black

[MDEV-30854] Do not use " as string delimiter in mariadb-tzinfo-to-sql

If SQL_MODE contains ANSI_QUOTES (https://mariadb.com/kb/en/sql-mode/), then
the double-quote character (") is not a legal string delimiter.

In https://github.com/MariaDB/server/commit/13e77930e615f05cc74d408110e887b00e1abcc9#diff-a333d4ebb2d73b6361ef7dfebc86d883f7e19853b4a9eb85984b039058fae47cR2431-R2435,
Daniel Black introduced a case where the double-quote character would be used as
a string delimiter in the SQL queries generated by mariadb-tzinfo-to-sql.

This tool tool generates SQL queries which should be able to run on any
MariaDB server of the matching version.  Therefore, it should be extremely
conservative in the SQL that it outputs, in order to maximize the chance
that it can run regardless of the build or execution environment of the
server.

See MDEV-18778, MDEV-28263, and MDEV-28782 for previous cases where MariaDB
has FAILED TO ENSURE that the generated timezone.sql actually works in
different build and execution environments.  More test coverage is clearly
needed here.

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.
parent 8f87023d
......@@ -2429,9 +2429,9 @@ print_tz_as_sql(const char* tz_name, const TIME_ZONE_INFO *sp)
#define SAVE_ENGINE(e) \
"\"select ENGINE into @" e "_engine" \
"'select ENGINE into @" e "_engine" \
" from information_schema.TABLES" \
" where TABLE_SCHEMA=DATABASE() and TABLE_NAME='" e "'\""
" where TABLE_SCHEMA=DATABASE() and TABLE_NAME=''" e "'''"
/*
Print info about leap seconds in time zone as SQL statements
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment