psycopg2
psycopg2 copied to clipboard
Literal `%` in queries should always be escaped.
Currently in psycopg a lone %
is accepted when the query has no parameters, but must be doubled into %%
if the query takes parameters. This is confusing because changing a query from non-parametrised to parametrised gives weird errors. Plus, there is issues like #825, which we don't know how to solve.
Requiring to always escape the %
is not backward compatible so it won't happen in psycopg2. However it can if we decide to break eggs, so remembering this issue for the mythical psycopg3.
No, that's not going to happen.