Skip to content

Commit e6fff7a

Browse files
committed
New pgx tests
1 parent 35dd0ae commit e6fff7a

File tree

8 files changed

+181
-2
lines changed

8 files changed

+181
-2
lines changed

internal/compiler/output_columns.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ func (c *Compiler) sourceTables(qc *QueryCatalog, node ast.Node) ([]*Table, erro
545545
Name: fn.ReturnType.Name,
546546
})
547547

548-
// Successfully found the table
548+
// Failed to find table, check for type with name.
549549
if err != nil {
550550
table, err = qc.GetCompositeType(fn.ReturnType)
551551
}

internal/endtoend/testdata/select_fn/postgresql/pgx/v5/go/db.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/endtoend/testdata/select_fn/postgresql/pgx/v5/go/models.go

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

Lines changed: 58 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-- name: SelectBars :many
2+
SELECT * FROM bar_fn();
3+
4+
-- name: SelectFoos :many
5+
SELECT * FROM foo_fn();
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CREATE TYPE foo AS ENUM ('bar', 'baz');
2+
3+
CREATE TYPE bar AS (foo foo, baz INTEGER);
4+
5+
CREATE FUNCTION bar_fn()
6+
RETURNS SETOF bar LANGUAGE SQL STABLE AS $$
7+
SELECT * FROM VALUES ('bar', 1);
8+
$$;
9+
10+
CREATE FUNCTION foo_fn()
11+
RETURNS SETOF foo LANGUAGE SQL STABLE AS $$
12+
SELECT * FROM VALUES ('bar');
13+
$$;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"version": "1",
3+
"packages": [
4+
{
5+
"path": "go",
6+
"engine": "postgresql",
7+
"sql_package": "pgx/v5",
8+
"name": "querytest",
9+
"schema": "schema.sql",
10+
"queries": "query.sql"
11+
}
12+
]
13+
}

internal/sql/catalog/types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ func (c *Catalog) createCompositeType(stmt *ast.CompositeTypeStmt) error {
155155
Name: stmt.TypeName.Name,
156156
Columns: cols,
157157
})
158-
// schema.Tables = append(schema.Tables, &Table{Rel: tbl, Columns: cols})
159158
return nil
160159
}
161160

0 commit comments

Comments
 (0)