Assert when executing query on partitioned table - Mailing list pgsql-hackers

From Dmitry Koval
Subject Assert when executing query on partitioned table
Date
Msg-id f5fffe4b-11b2-4557-a864-3587ff9b4c36@postgrespro.ru
Whole thread Raw
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: "Zhijie Hou (Fujitsu)"
Date:
Subject: RE: create subscription with (origin = none, copy_data = on)
Next
From: Jim Jones
Date:
Subject: Re: Add XMLNamespaces to XMLElement