Assert when executing query on partitioned table
Dmitry Koval <d.koval@postgrespro.ru>
From: Dmitry Koval <d.koval@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Date: 2025-02-20T11:13:53Z
Lists: pgsql-hackers
Attachments
- stack.txt (text/plain)
- v1-0001-Triggering-Assert-on-query-with-ON-CONFLICT.patch (text/plain)
- v1-0001-draft-of-fix.patch (text/plain)
Hi! I got an Assert when executing an "INSERT ... ON CONFLICT ... UPDATE ..." query on partitioned table. Managed to reproduce this situation. Reproduction order. ------------------- 1) Apply the patch [v1-0001-Triggering-Assert-on-query-with-ON-CONFLICT.patch] to "master" branch. 2) Build postgres with key "--enable-injection-points" + build an extension "injection_points" (src/test/modules/injection_points). 3) Run isolation test onconflict.spec: make check -C src/test/modules/injection_points Assert is triggered in postgres with stack, see attached file [stack.txt]. Clarification. -------------- In the query "INSERT ... ON CONFLICT ... UPDATE ..." when executing INSERT, a conflict is triggered. But when trying to execute UPDATE, our tuple has already been moved to another partition and Assert is triggered. Fixing. ------- I suggest replace Assert with an error message, see [v1-0001-draft-of-fix.patch]. This is not a final fix as I am confused by the comment for Assert: "we don't support an UPDATE of INSERT ON CONFLICT for a partitioned table". (Why "don't support an UPDATE"? It's not forbidden by syntax or errors ...) -- With best regards, Dmitry Koval Postgres Professional: http://postgrespro.com