Skip to content

Commit 085ce34

Browse files
committed
Fix #1322
1 parent b581867 commit 085ce34

File tree

8 files changed

+111
-0
lines changed

8 files changed

+111
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://github.com/sqlc-dev/sqlc/issues/1322
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"contexts": ["managed-db"]
3+
}

internal/endtoend/testdata/func_return_table/postgresql/pgx/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/func_return_table/postgresql/pgx/go/models.go

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

internal/endtoend/testdata/func_return_table/postgresql/pgx/go/query.sql.go

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- name: Foo :one
2+
SELECT * FROM register_account('a', 'b');
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
CREATE TABLE accounts (
2+
id INTEGER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
3+
username TEXT NOT NULL UNIQUE,
4+
password TEXT NOT NULL
5+
);
6+
7+
-- this is a useless and horrifying function cause we don't hash
8+
-- the password, this is just to repro the bug in sqlc
9+
CREATE OR REPLACE FUNCTION register_account(
10+
_username TEXT,
11+
_password VARCHAR(70)
12+
)
13+
RETURNS TABLE (
14+
account_id INTEGER
15+
)
16+
AS $$
17+
BEGIN
18+
INSERT INTO accounts (username, password)
19+
VALUES (
20+
_username,
21+
_password
22+
)
23+
RETURNING id INTO account_id;
24+
25+
RETURN NEXT;
26+
END;
27+
$$ LANGUAGE plpgsql;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: "2"
2+
sql:
3+
- engine: "postgresql"
4+
schema: "schema.sql"
5+
queries: "query.sql"
6+
gen:
7+
go:
8+
package: "querytest"
9+
out: "go"
10+
sql_package: "pgx/v5"

0 commit comments

Comments
 (0)