Skip to content

sqlc.arg(key) in subquery is not replaced with placeholder #2403

Closed
@nobuyo

Description

@nobuyo

Version

1.18.0

What happened?

When generating query.sql.go, if there is a subquery in the query and one arg is used multiple times, the sqlc.arg in subquery is not expanded to a placeholder.

I've attached the playground url, thanks!

Relevant log output

No response

Database schema

No response

SQL queries

No response

Configuration

No response

Playground URL

https://play.sqlc.dev/p/4db6630bb57b14ff1913c150a2c0140e9eb4e587f54e93586f430e99681ae83b

Edit: add outer parenthesis to subquery, then it works.

https://play.sqlc.dev/p/8f4de494021b1db7476e47349f46a8d773575ef495399a5af5441cde3e9b41ae

What operating system are you using?

Linux

What database engines are you using?

MySQL

What type of code are you generating?

Go

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions