pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix state reversal after partition tuple routing
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix state reversal after partition tuple routing
@ 2018-03-19 20:46 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2018-03-19 20:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix state reversal after partition tuple routing

We make some changes to ModifyTableState and the EState it uses whenever
we route tuples to partitions; but we weren't restoring properly in all
cases, possibly causing crashes when partitions with different tuple
descriptors are targeted by tuples inserted in the same command.
Refactor some code, creating ExecPrepareTupleRouting, to encapsulate the
needed state changing logic, and have it invoked one level above its
current place (ie. put it in ExecModifyTable instead of ExecInsert);
this makes it all more readable.

Add a test case to exercise this.

We don't support having views as partitions; and since only views can
have INSTEAD OF triggers, there is no point in testing for INSTEAD OF
when processing insertions into a partitioned table.  Remove code that
appears to support this (but which is actually never relevant.)

In passing, fix location of some very confusing comments in
ModifyTableState.

Reported-by: Amit Langote
Author: Etsuro Fujita, Amit Langote
Discussion: https://postgr/es/m/0473bf5c-57b1-f1f7-3d58-455c2230bc5f@lab.ntt.co.jp

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6666ee49f49c4a6b008591aea457becffa0df041

Modified Files
--------------
src/backend/commands/copy.c            |  20 +--
src/backend/executor/nodeModifyTable.c | 230 +++++++++++++++++----------------
src/include/nodes/execnodes.h          |  12 +-
src/test/regress/expected/insert.out   |  26 ++++
src/test/regress/sql/insert.sql        |  23 ++++
5 files changed, 188 insertions(+), 123 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Fix state reversal after partition tuple routing
@ 2018-03-19 20:46 Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Alvaro Herrera @ 2018-03-19 20:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix state reversal after partition tuple routing

We make some changes to ModifyTableState and the EState it uses whenever
we route tuples to partitions; but we weren't restoring properly in all
cases, possibly causing crashes when partitions with different tuple
descriptors are targeted by tuples inserted in the same command.
Refactor some code, creating ExecPrepareTupleRouting, to encapsulate the
needed state changing logic, and have it invoked one level above its
current place (ie. put it in ExecModifyTable instead of ExecInsert);
this makes it all more readable.

Add a test case to exercise this.

We don't support having views as partitions; and since only views can
have INSTEAD OF triggers, there is no point in testing for INSTEAD OF
when processing insertions into a partitioned table.  Remove code that
appears to support this (but which is actually never relevant.)

In passing, fix location of some very confusing comments in
ModifyTableState.

Reported-by: Amit Langote
Author: Etsuro Fujita, Amit Langote
Discussion: https://postgr/es/m/0473bf5c-57b1-f1f7-3d58-455c2230bc5f@lab.ntt.co.jp

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e3faddf537903144553abd989b156168cb7984df

Modified Files
--------------
src/backend/commands/copy.c            |  20 +--
src/backend/executor/nodeModifyTable.c | 216 ++++++++++++++++++---------------
src/include/nodes/execnodes.h          |  17 ++-
src/test/regress/expected/insert.out   |  26 ++++
src/test/regress/sql/insert.sql        |  23 ++++
5 files changed, 189 insertions(+), 113 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2018-03-19 20:46 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-19 20:46 pgsql: Fix state reversal after partition tuple routing Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-19 20:46 pgsql: Fix state reversal after partition tuple routing Alvaro Herrera <alvherre@alvh.no-ip.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox