Skip to content

Commit

Permalink
fix generated column check in information_schema extra field
Browse files Browse the repository at this point in the history
  • Loading branch information
amyangfei committed Jun 12, 2019
1 parent 25518f4 commit 55210e6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mydumper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 55210e6

Please sign in to comment.