diff --git a/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/go/query.sql.go index a8efa1ecc2..aeb7a170a0 100644 --- a/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/go/query.sql.go @@ -12,8 +12,8 @@ import ( ) const myGet = `-- name: MyGet :many -SELECT id, myjson, (mt.myjson->'thing1'->'thing2')::text, mt.myjson->'thing1' -FROM "mytable" mt +SELECT id, myjson,(mt.myjson -> 'thing1' -> 'thing2')::text,mt.myjson -> 'thing1' +FROM mytable mt ` type MyGetRow struct { @@ -47,28 +47,3 @@ func (q *Queries) MyGet(ctx context.Context) ([]MyGetRow, error) { } return items, nil } - -const myGet2 = `-- name: MyGet2 :many -SELECT id::text -FROM "mytable" mt -` - -func (q *Queries) MyGet2(ctx context.Context) ([]string, error) { - rows, err := q.db.Query(ctx, myGet2) - if err != nil { - return nil, err - } - defer rows.Close() - var items []string - for rows.Next() { - var id string - if err := rows.Scan(&id); err != nil { - return nil, err - } - items = append(items, id) - } - if err := rows.Err(); err != nil { - return nil, err - } - return items, nil -} diff --git a/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/query.sql b/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/query.sql index 76ab90dba7..e58c548841 100644 --- a/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/query.sql +++ b/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/query.sql @@ -1,7 +1,3 @@ -- name: MyGet :many -SELECT *, (mt.myjson->'thing1'->'thing2')::text, mt.myjson->'thing1' -FROM "mytable" mt; - --- name: MyGet2 :many -SELECT id::text -FROM "mytable" mt; \ No newline at end of file +SELECT *,(mt.myjson -> 'thing1' -> 'thing2')::text,mt.myjson -> 'thing1' +FROM mytable mt; diff --git a/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/stmttreejson.txt b/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/stmttreejson.txt deleted file mode 100644 index c9b71ef03a..0000000000 --- a/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/stmttreejson.txt +++ /dev/null @@ -1,85 +0,0 @@ -raw tree.Stmt: stmt:{ - select_stmt:{ - target_list:{ - res_target:{ - val:{column_ref:{fields:{a_star:{}} location:28}} - location:28 - } - } - target_list:{ - res_target:{ - val:{ - type_cast:{ - arg:{ - a_expr:{ - kind:AEXPR_OP - name:{string:{sval:"->"}} - lexpr:{ - a_expr:{ - kind:AEXPR_OP - name:{string:{sval:"->"}} - lexpr:{ - column_ref:{ - fields:{string:{sval:"mt"}} - fields:{string:{sval:"myjson"}} - location:32 - } - } - rexpr:{ - a_const:{ - sval:{sval:"thing1"} location:43 - } - } - location:41 - } - } - rexpr:{ - a_const:{sval:{sval:"thing2"} location:53} - } - location:51 - } - } - type_name:{ - names:{string:{sval:"text"}} typemod:-1 location:64 - } - location:62 - } - } - location:31 - } - } - target_list:{ - res_target:{ - val:{ - a_expr:{ - kind:AEXPR_OP - name:{string:{sval:"->"}} - lexpr:{ - column_ref:{ - fields:{string:{sval:"mt"}} - fields:{string:{sval:"myjson"}} - location:70 - } - } - rexpr:{ - a_const:{sval:{sval:"thing1"} location:81} - } - location:79 - } - } - location:70 - } - } - from_clause:{ - range_var:{ - relname:"mytable" - inh:true - relpersistence:"p" - alias:{aliasname:"mt"} - location:95 - } - } - limit_option:LIMIT_OPTION_DEFAULT op:SETOP_NONE - } -} -stmt_len:107 \ No newline at end of file diff --git a/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/stmttreeordinary.txt b/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/stmttreeordinary.txt deleted file mode 100644 index 3d7f814127..0000000000 --- a/internal/endtoend/testdata/json_traversal_as_select_expr_with_type_cast/postgresql/pgx/v5/stmttreeordinary.txt +++ /dev/null @@ -1,30 +0,0 @@ -stmt:{ - select_stmt:{ - target_list:{ - res_target:{ - val:{ - type_cast:{ - arg:{ - column_ref:{ - fields:{string:{sval:"id"}} location:120 - } - } - type_name:{ - names:{string:{sval:"text"}} typemod:-1 location:124 - } - location:122 - } - } - location:120 - } - } - from_clause:{ - range_var:{ - relname:"mytable" inh:true relpersistence:"p" alias:{aliasname:"mt"} location:134 - } - } - limit_option:LIMIT_OPTION_DEFAULT op:SETOP_NONE - } -} -stmt_location:89 -stmt_len:57 \ No newline at end of file