Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix generated column check in information_schema extra field #29

Merged
merged 2 commits into from
Jun 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 REGEXP '(STORED|VIRTUAL) GENERATED'";
MYSQL_STMT *stmt = execute_detect_fields_stmt(conn, database, table, query);
if (!stmt) {
return FALSE;
Expand Down Expand Up @@ -1861,7 +1861,7 @@ void append_escaped_identifier(GString *str, const gchar *identifier) {
}

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 REGEXP '(STORED|VIRTUAL) GENERATED'";
MYSQL_STMT *stmt = execute_detect_fields_stmt(conn, database, table, query);
if (!stmt) {
return NULL;
Expand Down