Skip to content

Commit f2587e9

Browse files
committed
Fix PG functions
1 parent e1f7d2a commit f2587e9

File tree

4 files changed

+69
-9
lines changed

4 files changed

+69
-9
lines changed

internal/compiler/output_columns.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,7 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro
599599
DataType: arg.Type.Name,
600600
})
601601
}
602-
}
603-
if fn.ReturnType != nil {
602+
} else if fn.ReturnType != nil {
604603
table.Columns = []*Column{
605604
{
606605
Name: colName,

internal/endtoend/testdata/ddl_create_function_table/postgresql/pgx/v5/go/query.sql.go

Lines changed: 64 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
-- name: SelectAll :many
22
SELECT * FROM public.get_test();
3+
4+
-- name: SelectWithTime :many
5+
SELECT * FROM public.get_test($1::timestamp);

internal/sql/catalog/func.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func (f *Function) OutArgs() []*Argument {
4343
var args []*Argument
4444
for _, a := range f.Args {
4545
switch a.Mode {
46-
case ast.FuncParamOut:
46+
case ast.FuncParamOut, ast.FuncParamTable:
4747
args = append(args, a)
4848
}
4949
}

0 commit comments

Comments
 (0)