From 1612d02f320c9560eecd7f651d4b21fb0d43c638 Mon Sep 17 00:00:00 2001 From: Yaiba <4yaiba@gmail.com> Date: Sun, 10 Mar 2024 20:31:12 -0500 Subject: [PATCH] parse: fix action recog func call as sql stmt --- go.mod | 2 +- go.sum | 4 ++-- parse/action/parser_test.go | 10 ++++++++++ parse/go.mod | 2 +- parse/go.sum | 4 ++-- test/go.mod | 2 +- test/go.sum | 4 ++-- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index a35bf0eca..8a89c097c 100644 --- a/go.mod +++ b/go.mod @@ -92,7 +92,7 @@ require ( github.com/jackc/puddle/v2 v2.2.1 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.17.0 // indirect - github.com/kwilteam/action-grammar-go v0.1.0 // indirect + github.com/kwilteam/action-grammar-go v0.1.1 // indirect github.com/kwilteam/sql-grammar-go v0.1.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect diff --git a/go.sum b/go.sum index 741d54068..cd8943177 100644 --- a/go.sum +++ b/go.sum @@ -272,8 +272,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kwilteam/action-grammar-go v0.1.0 h1:pAjWZUYlDwQUWpQz5uOPQDIz1TLWXyLY4gribS7UTBY= -github.com/kwilteam/action-grammar-go v0.1.0/go.mod h1:hHGHtnrJpASW9P+F7pdr/EP2M1Hxy1N9Wx/TmjVdV6I= +github.com/kwilteam/action-grammar-go v0.1.1 h1:0NeWrIN0B+pQMyiTwW/kWtqLWl7P4ExmfHwaXaJ14zI= +github.com/kwilteam/action-grammar-go v0.1.1/go.mod h1:hHGHtnrJpASW9P+F7pdr/EP2M1Hxy1N9Wx/TmjVdV6I= github.com/kwilteam/kuneiform v0.6.0 h1:Y8VWrJN1cl9idqX+LBSQd+c3m/JjDDRInBSKq3i27NY= github.com/kwilteam/kuneiform v0.6.0/go.mod h1:b3Ce6falEDBQ0xgLpa/hjFjUQoD8aFEg96yewS/3wzg= github.com/kwilteam/kwil-extensions v0.0.0-20230727040522-1cfd930226b7 h1:YiPBu0pOeYOtOVfwKQqdWB07SUef9LvngF4bVFD+x34= diff --git a/parse/action/parser_test.go b/parse/action/parser_test.go index ee280ca12..fe8b8bcc0 100644 --- a/parse/action/parser_test.go +++ b/parse/action/parser_test.go @@ -138,6 +138,16 @@ func TestParseActionStmt(t *testing.T) { }, }, }, + { + name: "action_call with sql keyword prefix", + input: `update_xx(1);`, + expect: &actparser.ActionCallStmt{ + Method: "update_xx", + Args: []tree.Expression{ + &tree.ExpressionLiteral{Value: "1"}, + }, + }, + }, { name: "dml select", input: `SELECT * FROM users;`, diff --git a/parse/go.mod b/parse/go.mod index b6b8e8ea8..23716bade 100644 --- a/parse/go.mod +++ b/parse/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/antlr4-go/antlr/v4 v4.13.0 - github.com/kwilteam/action-grammar-go v0.1.0 + github.com/kwilteam/action-grammar-go v0.1.1 github.com/kwilteam/sql-grammar-go v0.1.0 github.com/pganalyze/pg_query_go/v5 v5.1.0 // This is only for unit testing github.com/stretchr/testify v1.8.4 diff --git a/parse/go.sum b/parse/go.sum index d56ccabd3..ead01b8d2 100644 --- a/parse/go.sum +++ b/parse/go.sum @@ -14,8 +14,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kwilteam/action-grammar-go v0.1.0 h1:pAjWZUYlDwQUWpQz5uOPQDIz1TLWXyLY4gribS7UTBY= -github.com/kwilteam/action-grammar-go v0.1.0/go.mod h1:hHGHtnrJpASW9P+F7pdr/EP2M1Hxy1N9Wx/TmjVdV6I= +github.com/kwilteam/action-grammar-go v0.1.1 h1:0NeWrIN0B+pQMyiTwW/kWtqLWl7P4ExmfHwaXaJ14zI= +github.com/kwilteam/action-grammar-go v0.1.1/go.mod h1:hHGHtnrJpASW9P+F7pdr/EP2M1Hxy1N9Wx/TmjVdV6I= github.com/kwilteam/sql-grammar-go v0.1.0 h1:rSS7DER9PWVDmFwNyoInG5oXrn+E9UrZkjref84L4Qk= github.com/kwilteam/sql-grammar-go v0.1.0/go.mod h1:A9AXaH5Vl/uPsY88fWqvU9O7z7P4YfvndaGyc8s//2s= github.com/pganalyze/pg_query_go/v5 v5.1.0 h1:MlxQqHZnvA3cbRQYyIrjxEjzo560P6MyTgtlaf3pmXg= diff --git a/test/go.mod b/test/go.mod index 3e8d76cde..ff6131339 100644 --- a/test/go.mod +++ b/test/go.mod @@ -135,7 +135,7 @@ require ( github.com/json-iterator/go v1.1.12 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/compress v1.17.0 // indirect - github.com/kwilteam/action-grammar-go v0.1.0 // indirect + github.com/kwilteam/action-grammar-go v0.1.1 // indirect github.com/kwilteam/kwil-db/parse v0.1.1 // indirect github.com/kwilteam/sql-grammar-go v0.1.0 // indirect github.com/lib/pq v1.10.7 // indirect diff --git a/test/go.sum b/test/go.sum index 14249bc0d..de1efb31c 100644 --- a/test/go.sum +++ b/test/go.sum @@ -472,8 +472,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kwilteam/action-grammar-go v0.1.0 h1:pAjWZUYlDwQUWpQz5uOPQDIz1TLWXyLY4gribS7UTBY= -github.com/kwilteam/action-grammar-go v0.1.0/go.mod h1:hHGHtnrJpASW9P+F7pdr/EP2M1Hxy1N9Wx/TmjVdV6I= +github.com/kwilteam/action-grammar-go v0.1.1 h1:0NeWrIN0B+pQMyiTwW/kWtqLWl7P4ExmfHwaXaJ14zI= +github.com/kwilteam/action-grammar-go v0.1.1/go.mod h1:hHGHtnrJpASW9P+F7pdr/EP2M1Hxy1N9Wx/TmjVdV6I= github.com/kwilteam/kuneiform v0.6.0 h1:Y8VWrJN1cl9idqX+LBSQd+c3m/JjDDRInBSKq3i27NY= github.com/kwilteam/kuneiform v0.6.0/go.mod h1:b3Ce6falEDBQ0xgLpa/hjFjUQoD8aFEg96yewS/3wzg= github.com/kwilteam/sql-grammar-go v0.1.0 h1:rSS7DER9PWVDmFwNyoInG5oXrn+E9UrZkjref84L4Qk=