Skip to content

Commit d1dcdf9

Browse files
committed
Fix #1515
1 parent 3396eec commit d1dcdf9

File tree

8 files changed

+127
-0
lines changed

8 files changed

+127
-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/1515
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/cte_update/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/cte_update/postgresql/pgx/go/models.go

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

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

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
-- name: UpdateAttribute :one
2+
with updated_attribute as (UPDATE attribute_value
3+
SET
4+
val = CASE WHEN @filter_value::bool THEN @value ELSE val END
5+
WHERE attribute_value.id = @id
6+
RETURNING id,attribute,val)
7+
select updated_attribute.id, val, name
8+
from updated_attribute
9+
left join attribute on updated_attribute.attribute = attribute.id;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
create table attribute_value
2+
(
3+
id bigserial not null,
4+
val text not null,
5+
attribute bigint not null
6+
);
7+
8+
create table attribute
9+
(
10+
id bigserial not null,
11+
name text not null
12+
);
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)