GENERATED colunm as part of PK: handling UPDATE scenario
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
This commit is contained in:
parent
28f7f19e08
commit
faededefcd
@ -188,7 +188,7 @@ func GetTableColumns(db *gosql.DB, databaseName, tableName string) (*sql.ColumnL
|
|||||||
err := sqlutils.QueryRowsMap(db, query, func(rowMap sqlutils.RowMap) error {
|
err := sqlutils.QueryRowsMap(db, query, func(rowMap sqlutils.RowMap) error {
|
||||||
columnName := rowMap.GetString("Field")
|
columnName := rowMap.GetString("Field")
|
||||||
columnNames = append(columnNames, columnName)
|
columnNames = append(columnNames, columnName)
|
||||||
if strings.Contains(rowMap.GetString("Extra"), " GENERATED") {
|
if strings.Contains(rowMap.GetString("Extra"), "GENERATED") || strings.Contains(rowMap.GetString("Extra"), "VIRTUAL") {
|
||||||
log.Debugf("%s is a generated column", columnName)
|
log.Debugf("%s is a generated column", columnName)
|
||||||
virtualColumnNames = append(virtualColumnNames, columnName)
|
virtualColumnNames = append(virtualColumnNames, columnName)
|
||||||
}
|
}
|
||||||
|
@ -27,4 +27,6 @@ begin
|
|||||||
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":19}');
|
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":19}');
|
||||||
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":23}');
|
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":23}');
|
||||||
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":27}');
|
insert into gh_ost_test (id, jsonobj) values (null, '{"_id":27}');
|
||||||
|
|
||||||
|
update gh_ost_test set jsonobj=JSON_OBJECT('_id', 27, 'name', 'carrot') where id>0 and idb=27;
|
||||||
end ;;
|
end ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user