pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Disallow collecting transition tuples from child foreign tables.
7+ messages / 1 participants
[nested] [flat]

* pgsql: Disallow collecting transition tuples from child foreign tables.
@ 2025-08-08 01:52 Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2025-08-08 01:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow collecting transition tuples from child foreign tables.

Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture.  This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.

To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture.  Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.

Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/62a1211d3389095b685a4f80f7b864794cf114f6

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 113 +++++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  78 +++++++++++++++++
src/backend/commands/trigger.c                 |  28 ++++++
src/backend/optimizer/plan/createplan.c        |  24 +++++-
src/backend/optimizer/util/plancat.c           |  54 ++++++++++++
src/include/optimizer/plancat.h                |   2 +
6 files changed, 295 insertions(+), 4 deletions(-)



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

* pgsql: Disallow collecting transition tuples from child foreign tables.
@ 2025-08-08 01:52 Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2025-08-08 01:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow collecting transition tuples from child foreign tables.

Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture.  This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.

To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture.  Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.

Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13

Branch
------
REL_18_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 113 +++++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  78 +++++++++++++++++
src/backend/commands/trigger.c                 |  28 ++++++
src/backend/optimizer/plan/createplan.c        |  24 +++++-
src/backend/optimizer/util/plancat.c           |  54 ++++++++++++
src/include/optimizer/plancat.h                |   2 +
6 files changed, 295 insertions(+), 4 deletions(-)



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

* pgsql: Disallow collecting transition tuples from child foreign tables.
@ 2025-08-08 01:52 Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2025-08-08 01:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow collecting transition tuples from child foreign tables.

Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture.  This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.

To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture.  Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.

Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9048a83c7a2d099304dca3d2e1f41f1b26926f72

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 113 +++++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  78 +++++++++++++++++
src/backend/commands/trigger.c                 |  28 ++++++
src/backend/optimizer/plan/createplan.c        |  18 +++-
src/backend/optimizer/util/plancat.c           |  54 ++++++++++++
src/include/optimizer/plancat.h                |   2 +
6 files changed, 291 insertions(+), 2 deletions(-)



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

* pgsql: Disallow collecting transition tuples from child foreign tables.
@ 2025-08-08 01:52 Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2025-08-08 01:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow collecting transition tuples from child foreign tables.

Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture.  This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.

To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture.  Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.

Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9cca445dfd2c39c1dbc031bb1596c67594b54668

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 113 +++++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  78 +++++++++++++++++
src/backend/commands/trigger.c                 |  28 ++++++
src/backend/optimizer/plan/createplan.c        |  18 +++-
src/backend/optimizer/util/plancat.c           |  54 ++++++++++++
src/include/optimizer/plancat.h                |   2 +
6 files changed, 291 insertions(+), 2 deletions(-)



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

* pgsql: Disallow collecting transition tuples from child foreign tables.
@ 2025-08-08 01:52 Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2025-08-08 01:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow collecting transition tuples from child foreign tables.

Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture.  This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.

To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture.  Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.

Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13

Branch
------
REL_15_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 113 +++++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  78 +++++++++++++++++
src/backend/commands/trigger.c                 |  28 ++++++
src/backend/optimizer/plan/createplan.c        |  18 +++-
src/backend/optimizer/util/plancat.c           |  54 ++++++++++++
src/include/optimizer/plancat.h                |   2 +
6 files changed, 291 insertions(+), 2 deletions(-)



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

* pgsql: Disallow collecting transition tuples from child foreign tables.
@ 2025-08-08 01:52 Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2025-08-08 01:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow collecting transition tuples from child foreign tables.

Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture.  This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.

To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture.  Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.

Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13

Branch
------
REL_14_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 113 +++++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  78 +++++++++++++++++
src/backend/commands/trigger.c                 |  28 ++++++
src/backend/optimizer/plan/createplan.c        |  18 +++-
src/backend/optimizer/util/plancat.c           |  50 +++++++++++
src/include/optimizer/plancat.h                |   2 +
6 files changed, 287 insertions(+), 2 deletions(-)



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

* pgsql: Disallow collecting transition tuples from child foreign tables.
@ 2025-08-08 01:52 Etsuro Fujita <efujita@postgresql.org>
  0 siblings, 0 replies; 7+ messages in thread

From: Etsuro Fujita @ 2025-08-08 01:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Disallow collecting transition tuples from child foreign tables.

Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture.  This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.

To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture.  Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.

Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13

Branch
------
REL_13_STABLE

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 102 +++++++++++++++++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |  68 +++++++++++++++++
src/backend/commands/trigger.c                 |  22 ++++++
src/backend/optimizer/plan/createplan.c        |  18 ++++-
src/backend/optimizer/util/plancat.c           |  50 ++++++++++++
src/include/optimizer/plancat.h                |   2 +
6 files changed, 260 insertions(+), 2 deletions(-)



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


end of thread, other threads:[~2025-08-08 01:52 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-08-08 01:52 pgsql: Disallow collecting transition tuples from child foreign tables. Etsuro Fujita <efujita@postgresql.org>
2025-08-08 01:52 pgsql: Disallow collecting transition tuples from child foreign tables. Etsuro Fujita <efujita@postgresql.org>
2025-08-08 01:52 pgsql: Disallow collecting transition tuples from child foreign tables. Etsuro Fujita <efujita@postgresql.org>
2025-08-08 01:52 pgsql: Disallow collecting transition tuples from child foreign tables. Etsuro Fujita <efujita@postgresql.org>
2025-08-08 01:52 pgsql: Disallow collecting transition tuples from child foreign tables. Etsuro Fujita <efujita@postgresql.org>
2025-08-08 01:52 pgsql: Disallow collecting transition tuples from child foreign tables. Etsuro Fujita <efujita@postgresql.org>
2025-08-08 01:52 pgsql: Disallow collecting transition tuples from child foreign tables. Etsuro Fujita <efujita@postgresql.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