Skip to content

Where with raw sql string and slice arg #383

@m15h4nya

Description

@m15h4nya

Given:

query := sq.Select("something FROM somewhere").Where("id NOT IN ?", []int{1, 2, 3})

Expected:

SELECT something FROM somewhere WHERE id NOT IN (1, 2, 3);

Actual:

SELECT something FROM somewhere WHERE id NOT IN '[1 2 3]';

Trying to actually execute query returns error (SQLSTATE 42601) saying there is syntax error near ? (or $1 if using dollar placeholders)

go play: https://go.dev/play/p/79B21fBnUgJ

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions