summaryrefslogtreecommitdiff
path: root/storage/federatedx
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2020-05-28 22:22:20 +0300
committerAleksey Midenkov <midenok@gmail.com>2020-05-28 22:22:20 +0300
commit19da9a51ae174785806c87bcc8fa47406af9ed96 (patch)
treedad7b5a305f06053b8121ad33cba7cfe16098370 /storage/federatedx
parentdd9773b72380eeb98b9dabba219452f29ee5603b (diff)
downloadmariadb-git-19da9a51ae174785806c87bcc8fa47406af9ed96.tar.gz
MDEV-16937 Strict SQL with system versioned tables causes issues
Respect system fields in NO_ZERO_DATE mode. This is the subject for refactoring in MDEV-19597
Diffstat (limited to 'storage/federatedx')
-rw-r--r--storage/federatedx/ha_federatedx.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc
index 4a717eead20..1adb7b214f0 100644
--- a/storage/federatedx/ha_federatedx.cc
+++ b/storage/federatedx/ha_federatedx.cc
@@ -3611,6 +3611,9 @@ int ha_federatedx::discover_assisted(handlerton *hton, THD* thd,
char buf[1024];
String query(buf, sizeof(buf), cs);
static LEX_CSTRING cut_clause={STRING_WITH_LEN(" WITH SYSTEM VERSIONING")};
+ static LEX_CSTRING cut_start={STRING_WITH_LEN("GENERATED ALWAYS AS ROW START")};
+ static LEX_CSTRING cut_end={STRING_WITH_LEN("GENERATED ALWAYS AS ROW END")};
+ static LEX_CSTRING set_ts={STRING_WITH_LEN("DEFAULT TIMESTAMP'1971-01-01 00:00:00'")};
int cut_offset;
MYSQL_RES *res;
MYSQL_ROW rdata;
@@ -3649,7 +3652,21 @@ int ha_federatedx::discover_assisted(handlerton *hton, THD* thd,
cut_offset= (int)query.length() - (int)cut_clause.length;
if (cut_offset > 0 && !memcmp(query.ptr() + cut_offset,
cut_clause.str, cut_clause.length))
+ {
query.length(cut_offset);
+ const char *ptr= strstr(query.ptr(), cut_start.str);
+ if (ptr)
+ {
+ query.replace((uint32) (ptr - query.ptr()), (uint32) cut_start.length,
+ set_ts.str, (uint32) set_ts.length);
+ }
+ ptr= strstr(query.ptr(), cut_end.str);
+ if (ptr)
+ {
+ query.replace((uint32) (ptr - query.ptr()), (uint32) cut_end.length,
+ set_ts.str, (uint32) set_ts.length);
+ }
+ }
query.append(STRING_WITH_LEN(" CONNECTION='"), cs);
query.append_for_single_quote(table_s->connect_string.str,
table_s->connect_string.length);