sqlc icon indicating copy to clipboard operation
sqlc copied to clipboard

Add support for in(val1,val2,...) syntax

Open kristijorgji opened this issue 3 years ago • 0 comments

What do you want to change?

I would like to have support for select * from table where id in (pleaseaddsupport)

For example the one below is not supported correctly

/* name: GetExercisesByIds :many */
SELECT *
FROM exercises where id in (?);

The id is generated as a string not as array of strings in the query

func (q *Queries) GetExercisesByIds(ctx context.Context, id string)

I called that function with id value of "'0055bd0b-8629-490d-8552-906d04dfca84,0162e545-2678-4cde-a291-665dcf6251a4"'

or "0055bd0b-8629-490d-8552-906d04dfca84,0162e545-2678-4cde-a291-665dcf6251a4"

and does not work with multiple values. The same query in the mysql console works great

select * from exercsies where id in ('0055bd0b-8629-490d-8552-906d04dfca84,0162e545-2678-4cde-a291-665dcf6251a4"')

returned for me 2 rows.

What database engines need to be changed?

MySQL

What programming language backends need to be changed?

Go

kristijorgji avatar Aug 03 '22 14:08 kristijorgji