You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Subqueries in Update().Set() with Postgres dialect generates incorrect query: '?' instead of '$1'
To Reproduce
testDS:=goqu.Dialect("postgres").Update("test.table_1").
Set(goqu.Record{
"sub": goqu.Select("id").
From("test.table_1").
Where(goqu.C("from").Eq(from)),
}).
From("test.table_2").
Where(
goqu.C("test_id").Eq(id),
goqu.C("to").Eq(to),
)
fmt.Println(testDS.Prepared(true).ToSQL())
// Output:// UPDATE "test"."table_1" SET "sub"=(SELECT "id" FROM "test"."table_1" WHERE ("from" = ?)) FROM "test"."table_2"// WHERE (("test_id" = $2) AND ("to" = $3)) [1 12 2] <nil>
Expected behavior
Expected output:
UPDATE "test"."table1" SET "huy"=(SELECT "id" FROM "t"."subtable_1" WHERE ("from" = $1)) FROM "test"."table_2" WHERE (("test_id" = $2) AND ("to" = $3)) [1 12 2] <nil>
But first parameter interpolated incorrectly for PG syntax '?'. Looks like it caused by sybquery in Setect(...)
Dialect:
postgres
mysql
sqlite3
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Describe the bug
Subqueries in Update().Set() with Postgres dialect generates incorrect query: '?' instead of '$1'
To Reproduce
Expected behavior
Expected output:
But first parameter interpolated incorrectly for PG syntax '?'. Looks like it caused by sybquery in Setect(...)
Dialect:
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: