From 55210e6024971ad6fab5c1be09b955f644e50182 Mon Sep 17 00:00:00 2001 From: amyangfei Date: Wed, 12 Jun 2019 22:19:05 +0800 Subject: [PATCH] fix generated column check in information_schema extra field --- mydumper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mydumper.c b/mydumper.c index 41c76106e..b1e00f382 100644 --- a/mydumper.c +++ b/mydumper.c @@ -1796,7 +1796,7 @@ MYSQL_STMT *execute_detect_fields_stmt(MYSQL *conn, char *database, char *table, } gboolean detect_generated_fields(MYSQL *conn, char *database, char *table){ - const char* query = "select 1 from information_schema.COLUMNS where TABLE_SCHEMA=? and TABLE_NAME=? and extra like '%GENERATED%'"; + const char* query = "select 1 from information_schema.COLUMNS where TABLE_SCHEMA=? and TABLE_NAME=? and (extra like '%STORED GENERATED%' or extra like '%VIRTUAL GENERATED%')"; MYSQL_STMT *stmt = execute_detect_fields_stmt(conn, database, table, query); if (!stmt) { return FALSE; @@ -1848,7 +1848,7 @@ gboolean detect_tidb_rowid(MYSQL *conn, char *database, char *table) { } GString * get_insertable_fields(MYSQL *conn, char *database, char *table){ - const char* query = "select COLUMN_NAME from information_schema.COLUMNS where TABLE_SCHEMA=? and TABLE_NAME=? and extra not like '%GENERATED%'"; + const char* query = "select COLUMN_NAME from information_schema.COLUMNS where TABLE_SCHEMA=? and TABLE_NAME=? and extra not like '%STORED GENERATED%' and extra not like '%VIRTUAL GENERATED%'"; MYSQL_STMT *stmt = execute_detect_fields_stmt(conn, database, table, query); if (!stmt) { return NULL;