sqlvet icon indicating copy to clipboard operation
sqlvet copied to clipboard

Queries with question mark placeholders (?) not valid anymore

Open valichek opened this issue 1 year ago • 1 comments

Queries with (?) are not valid since updated version from 1.1.6 to 1.1.7/1.1.8, doesn't depend on go version

SELECT id FROM my_table WHERE id IN (?);

Getting ERROR: syntax error at or near ")"

Another example:

SELECT * FROM my_table WHERE id = ? AND user_id IN (?);

Getting ERROR: syntax error at or near "AND"

valichek avatar Aug 21 '24 11:08 valichek

relates to https://github.com/pganalyze/pg_query_go/issues/78

This change is intentional - that was always a libpg_query patch, Postgres never supported this syntax for parameter references. Though some ORMs support ? replacement characters, they then do local substitution and don't send the query in that form to the Postgres server.

@houqp not sure if need to fix this

valichek avatar Aug 22 '24 12:08 valichek