public inbox for [email protected]
help / color / mirror / Atom feedpgsql: refint: Remove plan cache.
6+ messages / 1 participants
[nested] [flat]
* pgsql: refint: Remove plan cache.
@ 2026-06-05 17:08 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2026-06-05 17:08 UTC (permalink / raw)
To: [email protected]
refint: Remove plan cache.
Presently, refint stores plans in a per-backend cache to avoid
re-preparing in each call. This has a few problems. For one,
check_foreign_key() embeds the new key values in its cascade-UPDATE
queries, so a cached plan reuses the values from preparation.
Also, the cache is never invalidated, so it can return stale
entries that cause other problems. There may very well be more
bugs lurking.
We could spend a lot of time trying to address all these problems,
but this module is primarily intended as sample code, and by all
indications, it sees minimal use. Furthermore, there is a growing
consensus for removing refint in v20. However, since we'll need to
support it on the back-branches for a while longer, it probably
still makes sense to fix some of the more egregious bugs.
Therefore, let's just remove refint's plan cache entirely. That
means we'll re-prepare on every call, but that seems quite unlikely
to bother anyone. On v17 and older versions, the regression test
for triggers fails after this change, so I've borrowed pieces of
commit 8cfbdf8f4d to fix it.
Author: Ayush Tiwari <[email protected]>
Discussion: https://postgr.es/m/CAJTYsWXU%2BfhuzrEd_bnrxyGH3%2Bny8QRQC2QHf3ws6s9iki3c2Q%40mail.gmail.com
Backpatch-through: 14
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/a572dd213f79898ad6ca66ac9d8b0912040e6691
Modified Files
--------------
contrib/spi/refint.c | 352 +++++++++++----------------------
src/test/regress/expected/triggers.out | 37 ++--
src/test/regress/sql/triggers.sql | 10 +-
3 files changed, 138 insertions(+), 261 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: refint: Remove plan cache.
@ 2026-06-05 17:08 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2026-06-05 17:08 UTC (permalink / raw)
To: [email protected]
refint: Remove plan cache.
Presently, refint stores plans in a per-backend cache to avoid
re-preparing in each call. This has a few problems. For one,
check_foreign_key() embeds the new key values in its cascade-UPDATE
queries, so a cached plan reuses the values from preparation.
Also, the cache is never invalidated, so it can return stale
entries that cause other problems. There may very well be more
bugs lurking.
We could spend a lot of time trying to address all these problems,
but this module is primarily intended as sample code, and by all
indications, it sees minimal use. Furthermore, there is a growing
consensus for removing refint in v20. However, since we'll need to
support it on the back-branches for a while longer, it probably
still makes sense to fix some of the more egregious bugs.
Therefore, let's just remove refint's plan cache entirely. That
means we'll re-prepare on every call, but that seems quite unlikely
to bother anyone. On v17 and older versions, the regression test
for triggers fails after this change, so I've borrowed pieces of
commit 8cfbdf8f4d to fix it.
Author: Ayush Tiwari <[email protected]>
Discussion: https://postgr.es/m/CAJTYsWXU%2BfhuzrEd_bnrxyGH3%2Bny8QRQC2QHf3ws6s9iki3c2Q%40mail.gmail.com
Backpatch-through: 14
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/b7b513d9afabf43124edda3dff7dd8af39906951
Modified Files
--------------
contrib/spi/refint.c | 352 +++++++++++----------------------
src/test/regress/expected/triggers.out | 37 ++--
src/test/regress/sql/triggers.sql | 10 +-
3 files changed, 138 insertions(+), 261 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: refint: Remove plan cache.
@ 2026-06-05 17:08 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2026-06-05 17:08 UTC (permalink / raw)
To: [email protected]
refint: Remove plan cache.
Presently, refint stores plans in a per-backend cache to avoid
re-preparing in each call. This has a few problems. For one,
check_foreign_key() embeds the new key values in its cascade-UPDATE
queries, so a cached plan reuses the values from preparation.
Also, the cache is never invalidated, so it can return stale
entries that cause other problems. There may very well be more
bugs lurking.
We could spend a lot of time trying to address all these problems,
but this module is primarily intended as sample code, and by all
indications, it sees minimal use. Furthermore, there is a growing
consensus for removing refint in v20. However, since we'll need to
support it on the back-branches for a while longer, it probably
still makes sense to fix some of the more egregious bugs.
Therefore, let's just remove refint's plan cache entirely. That
means we'll re-prepare on every call, but that seems quite unlikely
to bother anyone. On v17 and older versions, the regression test
for triggers fails after this change, so I've borrowed pieces of
commit 8cfbdf8f4d to fix it.
Author: Ayush Tiwari <[email protected]>
Discussion: https://postgr.es/m/CAJTYsWXU%2BfhuzrEd_bnrxyGH3%2Bny8QRQC2QHf3ws6s9iki3c2Q%40mail.gmail.com
Backpatch-through: 14
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/5b72d0279be1f1e981abddff95bbf1913b2b16fc
Modified Files
--------------
contrib/spi/refint.c | 352 +++++++++++----------------------
src/test/regress/expected/triggers.out | 37 ++--
src/test/regress/sql/triggers.sql | 10 +-
3 files changed, 137 insertions(+), 262 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: refint: Remove plan cache.
@ 2026-06-05 17:08 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2026-06-05 17:08 UTC (permalink / raw)
To: [email protected]
refint: Remove plan cache.
Presently, refint stores plans in a per-backend cache to avoid
re-preparing in each call. This has a few problems. For one,
check_foreign_key() embeds the new key values in its cascade-UPDATE
queries, so a cached plan reuses the values from preparation.
Also, the cache is never invalidated, so it can return stale
entries that cause other problems. There may very well be more
bugs lurking.
We could spend a lot of time trying to address all these problems,
but this module is primarily intended as sample code, and by all
indications, it sees minimal use. Furthermore, there is a growing
consensus for removing refint in v20. However, since we'll need to
support it on the back-branches for a while longer, it probably
still makes sense to fix some of the more egregious bugs.
Therefore, let's just remove refint's plan cache entirely. That
means we'll re-prepare on every call, but that seems quite unlikely
to bother anyone. On v17 and older versions, the regression test
for triggers fails after this change, so I've borrowed pieces of
commit 8cfbdf8f4d to fix it.
Author: Ayush Tiwari <[email protected]>
Discussion: https://postgr.es/m/CAJTYsWXU%2BfhuzrEd_bnrxyGH3%2Bny8QRQC2QHf3ws6s9iki3c2Q%40mail.gmail.com
Backpatch-through: 14
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/1fbe2066dcc882321e87fdac43b942b890338f34
Modified Files
--------------
contrib/spi/refint.c | 350 +++++++++++++++++----------------------------------
1 file changed, 115 insertions(+), 235 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: refint: Remove plan cache.
@ 2026-06-05 17:08 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2026-06-05 17:08 UTC (permalink / raw)
To: [email protected]
refint: Remove plan cache.
Presently, refint stores plans in a per-backend cache to avoid
re-preparing in each call. This has a few problems. For one,
check_foreign_key() embeds the new key values in its cascade-UPDATE
queries, so a cached plan reuses the values from preparation.
Also, the cache is never invalidated, so it can return stale
entries that cause other problems. There may very well be more
bugs lurking.
We could spend a lot of time trying to address all these problems,
but this module is primarily intended as sample code, and by all
indications, it sees minimal use. Furthermore, there is a growing
consensus for removing refint in v20. However, since we'll need to
support it on the back-branches for a while longer, it probably
still makes sense to fix some of the more egregious bugs.
Therefore, let's just remove refint's plan cache entirely. That
means we'll re-prepare on every call, but that seems quite unlikely
to bother anyone. On v17 and older versions, the regression test
for triggers fails after this change, so I've borrowed pieces of
commit 8cfbdf8f4d to fix it.
Author: Ayush Tiwari <[email protected]>
Discussion: https://postgr.es/m/CAJTYsWXU%2BfhuzrEd_bnrxyGH3%2Bny8QRQC2QHf3ws6s9iki3c2Q%40mail.gmail.com
Backpatch-through: 14
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/79a506228bef41339ba64d27a47e7756dc1fd8db
Modified Files
--------------
contrib/spi/refint.c | 350 +++++++++++++++++----------------------------------
1 file changed, 115 insertions(+), 235 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: refint: Remove plan cache.
@ 2026-06-05 17:08 Nathan Bossart <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2026-06-05 17:08 UTC (permalink / raw)
To: [email protected]
refint: Remove plan cache.
Presently, refint stores plans in a per-backend cache to avoid
re-preparing in each call. This has a few problems. For one,
check_foreign_key() embeds the new key values in its cascade-UPDATE
queries, so a cached plan reuses the values from preparation.
Also, the cache is never invalidated, so it can return stale
entries that cause other problems. There may very well be more
bugs lurking.
We could spend a lot of time trying to address all these problems,
but this module is primarily intended as sample code, and by all
indications, it sees minimal use. Furthermore, there is a growing
consensus for removing refint in v20. However, since we'll need to
support it on the back-branches for a while longer, it probably
still makes sense to fix some of the more egregious bugs.
Therefore, let's just remove refint's plan cache entirely. That
means we'll re-prepare on every call, but that seems quite unlikely
to bother anyone. On v17 and older versions, the regression test
for triggers fails after this change, so I've borrowed pieces of
commit 8cfbdf8f4d to fix it.
Author: Ayush Tiwari <[email protected]>
Discussion: https://postgr.es/m/CAJTYsWXU%2BfhuzrEd_bnrxyGH3%2Bny8QRQC2QHf3ws6s9iki3c2Q%40mail.gmail.com
Backpatch-through: 14
Branch
------
REL_17_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/66a5146dc73d3ac1befe6ab595815157d5281cb5
Modified Files
--------------
contrib/spi/refint.c | 352 +++++++++++----------------------
src/test/regress/expected/triggers.out | 37 ++--
src/test/regress/sql/triggers.sql | 10 +-
3 files changed, 138 insertions(+), 261 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2026-06-05 17:08 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-05 17:08 pgsql: refint: Remove plan cache. Nathan Bossart <[email protected]>
2026-06-05 17:08 pgsql: refint: Remove plan cache. Nathan Bossart <[email protected]>
2026-06-05 17:08 pgsql: refint: Remove plan cache. Nathan Bossart <[email protected]>
2026-06-05 17:08 pgsql: refint: Remove plan cache. Nathan Bossart <[email protected]>
2026-06-05 17:08 pgsql: refint: Remove plan cache. Nathan Bossart <[email protected]>
2026-06-05 17:08 pgsql: refint: Remove plan cache. Nathan Bossart <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox