You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Cannot insert multiple commands into prepared statement" issue while executing query with params #30
The executing fails with asyncpg.exceptions.PostgresSyntaxError: cannot insert multiple commands into a prepared statement error, while the another example (without passing params to the query) works well with multiple commands:
changed the title [-]Insert multiple commands into prepared statement issue while executing query with params[/-][+]"Cannot insert multiple commands into prepared statement" issue while executing query with params[/+]on Sep 14, 2016
Parameters are only supported in prepared statements, and there can be only one command per prepared statement. This is a PostgreSQL protocol limitation. asyncpg does not itself attempt to mogrify the query. We may implement that at some point (see also #9).
I have the same problem with fetch( cant even do 2 selects). Is there a way of inserting stuff while using RETURNING clause while doing other queries ? I mean is there a non prepared version of fetch? The obvious workaround would be to to parse every query provided to broke them into individuals queries, but I would rather just desactive the auto prepared-statement mechanism if it is possible.
Activity
[-]Insert multiple commands into prepared statement issue while executing query with params[/-][+]"Cannot insert multiple commands into prepared statement" issue while executing query with params[/+]elprans commentedon Sep 15, 2016
Parameters are only supported in prepared statements, and there can be only one command per prepared statement. This is a PostgreSQL protocol limitation. asyncpg does not itself attempt to mogrify the query. We may implement that at some point (see also #9).
coldmind commentedon Sep 15, 2016
Got it.
Maybe documentation should be clearer and will contain a note that prepared statement will be executed in that case.
crazyhouse33 commentedon Jun 2, 2019
I have the same problem with fetch( cant even do 2 selects). Is there a way of inserting stuff while using RETURNING clause while doing other queries ? I mean is there a non prepared version of fetch? The obvious workaround would be to to parse every query provided to broke them into individuals queries, but I would rather just desactive the auto prepared-statement mechanism if it is possible.