-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: there is no unique or exclusion constraint matching the ON CONFLICT specification #1137
Comments
This isn't asyncpg throwing an error, this is PostgreSQL complaining that your SQL is incorrect. Check your |
@doiodl have you found out the error cause? I'm experiencing the same error with asyncpg=0.29.0, postgres=15.6 and fastapi=0.79.0. Query runs normally twice and fails on the third attempt with input being the same. Running the same query multiple times in a database client doesn't result in error. |
Hi guys. I faced similar issue. In my case the issue occurs in query like |
PG gets into a state where I get the error described above for the query:
for a certain set of values. I can retry those values many times and continue to get the same error. However, other values will work, and once they have, the original problematic set of values will also work. This has been true for both PG 15.3 and 15.8. I've been dealing with this for weeks. I fear I'm going to have to abandon use of ON CONFLICT were the conflict involves partial indices. |
the issue with a local PostgreSQL install?: no
uvloop?: yes
Hello everyone. So, I've written a fairly simple code that updates a table based on a composite index. I'm using sqlalchemy 2.0.28. The query is generated correctly, but exactly on the 6th query to the database, asyncpg supposedly throws an error:
<class 'asyncpg.exceptions.InvalidColumnReferenceError'>: there is no unique or exclusion constraint matching the ON CONFLICT specification
Although, as I mentioned - the first 5 queries work fine. Reloading the application (fastapi) or rather creating a new connection, everything starts working again for the first 5 queries. I looked for the reason in sqlalchemy since there pool_size = 5. Changing this value still gives me the same error.
The text was updated successfully, but these errors were encountered: