fix: pgsql查询列信息解析问题修复等

This commit is contained in:
meilin.huang
2024-10-28 12:13:41 +08:00
parent 5e5afd49dc
commit c1d09f447d
11 changed files with 220 additions and 130 deletions

View File

@@ -9,12 +9,12 @@ import (
func TestParserSimpleSelect(t *testing.T) {
parser := new(PgsqlParser)
sql := `SELECT t.* FROM mayfly.sys_login_log as t where t.id > 0 OFFSET 0 LIMIT 25; select * from tdb where id > 1`
sql := `SELECT t.*,t.id as tid FROM mayfly.sys_login_log as t where t.id > 0 OFFSET 0 LIMIT 25; select * from tdb where id > 1`
stmts, err := parser.Parse(sql)
if err != nil {
t.Fatal(err)
}
stmt := stmts[1].(*sqlstmt.SimpleSelectStmt)
stmt := stmts[0].(*sqlstmt.SimpleSelectStmt)
t.Log(stmt.QuerySpecification.Where.GetText())
fmt.Println(stmt.QuerySpecification.From.GetText())