Re: ON CONFLICT DO UPDATE for partitioned tables
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Pavan Deolasee <pavan.deolasee@gmail.com>
Cc: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, Pg Hackers <pgsql-hackers@postgresql.org>, Peter Geoghegan <pg@bowt.ie>, Andres Freund <andres@anarazel.de>
Date: 2018-03-16T18:21:06Z
Lists: pgsql-hackers
So ExecInsert receives the ModifyTableState, and separately it receives arbiterIndexes and the OnConflictAction, both of which are members of the passed ModifyTableState. I wonder why does it do that; wouldn't it be simpler to extract those members from the node? With the patch proposed upthread, we receive arbiterIndexes as a parameter and if the table is a partition we summarily ignore those and use the list as extracted from the PartitionRoutingInfo. This is confusing and pointless. It seems to me that the logic ought to be "if partition then use the list in PartitionRoutingInfo; if not partition use it from ModifyTableState". This requires changing as per above, i.e. make the arbiter index list not part of the ExecInsert's API. The OnConflictAction doesn't matter much; not passing it is merely a matter of cleanliness. Or is there another reason to pass the index list? -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Remove quick path in ExecInitPartitionInfo for equal tupdescs
- 79b2e52615fa 11.0 landed
-
Ignore whole-rows in INSERT/CONFLICT with partitioned tables
- 158b7bc6d779 11.0 landed
-
Handle INSERT .. ON CONFLICT with partitioned tables
- 555ee77a9668 11.0 landed
-
Remove unnecessary members from ModifyTableState and ExecInsert
- ee0a1fc84eb2 11.0 landed