Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Error: there is no unique or exclusion constraint matching the ON CONFLICT specification

オープン
#1,137 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
fastapi, postgresql, python, sqlalchemy
領域
backend, databases

調査の方向性

asyncpg 0.29.0、PostgreSQL 14.9、Python 3.11.6、SQLAlchemy 2.0.28、および asyncio と uvloop 下で報告された FastAPI の接続パターンを使用して、問題を再現してください。最初の 5 つのクエリと 6 番目のクエリを比較し、スキーマ、生成された ON CONFLICT 文、および接続の動作を示す最小限の再現例を文書化してください。

索引モデルが issue の本文から書いたものです。

説明

  • asyncpg version: 0.29.0
  • PostgreSQL version: 14.9
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : no
  • Python version: 3.11.6
  • Platform: macos, arm, m1 pro
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: yes
  • If you built asyncpg locally, which version of Cython did you use?: no
  • Can the issue be reproduced under both asyncio and
    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.

主要言語
Python
スター
8.1k
フォーク
469
平均マージ
2日 20時間
マージ済み PR(30日)
9

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

MagicStack/asyncpg のほかの issue

MagicStack/asyncpg の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。