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
Hello, I was just pulling out my non-existent hairs about why the filtering of my blog articles produced article lists that made no sense.
I have this query:
-- name: ListArticles :manyselect*from articles
where
(category in (sqlc.slice(categories))) and
(sqlc.arg(include_drafts) =1or is_visible =1)
order by created_at desc;
Which generates this query code:
constlistArticles=`-- name: ListArticles :manyselect id, created_at, last_edited_at, is_visible, title, category, content, content_typefrom articleswhere (category in (/*SLICE:categories*/?)) and (?2 = 1 or is_visible = 1)order by created_at desc`
However, the ?2 here means that not the wanted IncludeDrafts parameter of the paramter struct is inserted, but the second element in the parameter array, which is the second element of the categories array.
When I manually replace the ?2 with ?, it works as expected.
One solution could be either to not emit placeholder ordinals or to enumerate the slice placeholders as well.
Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
No response
Playground URL
No response
What operating system are you using?
No response
What database engines are you using?
SQLite
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered:
Version
1.27.0
What happened?
Hello, I was just pulling out my non-existent hairs about why the filtering of my blog articles produced article lists that made no sense.
I have this query:
Which generates this query code:
However, the
?2
here means that not the wantedIncludeDrafts
parameter of the paramter struct is inserted, but the second element in the parameter array, which is the second element of thecategories
array.When I manually replace the
?2
with?
, it works as expected.One solution could be either to not emit placeholder ordinals or to enumerate the slice placeholders as well.
Relevant log output
No response
Database schema
No response
SQL queries
No response
Configuration
No response
Playground URL
No response
What operating system are you using?
No response
What database engines are you using?
SQLite
What type of code are you generating?
Go
The text was updated successfully, but these errors were encountered: