Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add UnconvertedStmt instead of nil (#2351)
rebelicee3a0d6928f3d
diff --git a/plugin/parser/ast/unconverted_stmt.go b/plugin/parser/ast/unconverted_stmt.gonew file mode 100644index 0000000000..4d6039c860--- /dev/null+++ b/plugin/parser/ast/unconverted_stmt.go@@ -0,0 +1,8 @@+package ast++// UnconvertedStmt is the struct for unconverted statement definition.+// TODO(rebelice): remove it.+// We define this because we can not convert all statement types now.+type UnconvertedStmt struct {+ node+}diff --git a/plugin/parser/engine/pg/convert.go b/plugin/parser/engine/pg/convert.goindex 0db1256c7a..3e0db0d183 100644--- a/plugin/parser/engine/pg/convert.go+++ b/plugin/parser/engine/pg/convert.go@@ -362,6 +362,8 @@ func convert(node *pgquery.Node, statement parser.SingleSQL) (res ast.Node, err}return ©Stmt, nil+ default:+ return &ast.UnconvertedStmt{}, nil}return nil, nildiff --git a/plugin/parser/engine/pg/convert_test.go b/plugin/parser/engine/pg/convert_test.goindex 6e3020ad7e..e6035b8cdc 100644--- a/plugin/parser/engine/pg/convert_test.go+++ b/plugin/parser/engine/pg/convert_test.go@@ -1520,3 +1520,20 @@ func TestCopyStmt(t *testing.T) {runTests(t, tests)}++func TestUnconvertStmt(t *testing.T) {+ tests := []testData{+ {+ stmt: "SHOW TABLES",+ want: []ast.Node{&ast.UnconvertedStmt{}},+ statementList: []parser.SingleSQL{+ {+ Text: "SHOW TABLES",+ Line: 1,+ },+ },+ },+ }++ runTests(t, tests)+}