Skip to content

Issue with parameters in relation to in and a dynamic/1 collection #164

Open
@LostKobrakai

Description

@LostKobrakai

Doesn't work:

val = dynamic(^["abc", "def"])
cond = dynamic([a], a.col in ^val)
query = from a in "table", where: ^cond, select: a.col

{sql, x} = Repo.to_sql(:all, query)
# sql = SELECT t0."col" FROM "table" AS t0 WHERE (t0."col" IN (?,?))
# x = [["abc", "def"]]

Works:

cond = dynamic([a], a.col in ^["abc", "def"])
query = from a in "table", where: ^cond, select: a.col

{sql, x} = Repo.to_sql(:all, query)
# sql = SELECT t0."col" FROM "table" AS t0 WHERE (t0."col" IN (?,?))
# x = ["abc", "def"]

Looks like there's some place flattening out the parameters, which doesn't catch the dynamic case

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions