agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: Prevent access to other sessions' empty temp tables 5+ messages / 1 participants [nested] [flat]
* pgsql: Prevent access to other sessions' empty temp tables @ 2026-07-03 15:01 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Alexander Korotkov @ 2026-07-03 15:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent access to other sessions' empty temp tables Commit ce146621 ensures that ERROR is raised if a session tries to read pages of another session's temp table. But there is a corner case where the other session's temp table is empty -- in this case the INSERT command bypasses our checks and executes without any errors. Such behavior is inconsistent and erroneous: it leaves an invalid buffer in the temp buffers pool. Since the buffer was created for another session's temp table, we get an error "no such file or directory" when trying to flush it. This commit fixes it by adding a RELATION_IS_OTHER_TEMP check in the relation-extension path. Backpatch to 16, because it is the first release after 31966b151e6, which introduced a separate local relation extension function ExtendBufferedRelLocal(), which lacks of RELATION_IS_OTHER_TEMP() check. As this fix introduces more checks to 013_temp_obj_multisession.pl, backpatch the whole test script to 16. Discussion: https://postgr.es/m/CAJDiXgiX2XZBHDNo%2BzBbvku%2BtchrUurvPRaN1_40mEQ1_sG90g%40mail.gmail.com Author: Daniil Davydov <3danissimo@gmail.com> Reviewed-by: Jim Jones <jim.jones@uni-muenster.de> Reviewed-by: Imran Zaheer <imran.zhir@gmail.com> Reviewed-by: ZizhuanLiu X-MAN <44973863@qq.com> Backpatch-through: 16 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3aaefe8924f4828eabd414bfda98793e769aed8e Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 14 ++++++++++++++ src/include/utils/rel.h | 8 ++++---- .../modules/test_misc/t/013_temp_obj_multisession.pl | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Prevent access to other sessions' empty temp tables @ 2026-07-03 15:01 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Alexander Korotkov @ 2026-07-03 15:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent access to other sessions' empty temp tables Commit ce146621 ensures that ERROR is raised if a session tries to read pages of another session's temp table. But there is a corner case where the other session's temp table is empty -- in this case the INSERT command bypasses our checks and executes without any errors. Such behavior is inconsistent and erroneous: it leaves an invalid buffer in the temp buffers pool. Since the buffer was created for another session's temp table, we get an error "no such file or directory" when trying to flush it. This commit fixes it by adding a RELATION_IS_OTHER_TEMP check in the relation-extension path. Backpatch to 16, because it is the first release after 31966b151e6, which introduced a separate local relation extension function ExtendBufferedRelLocal(), which lacks of RELATION_IS_OTHER_TEMP() check. As this fix introduces more checks to 013_temp_obj_multisession.pl, backpatch the whole test script to 16. Discussion: https://postgr.es/m/CAJDiXgiX2XZBHDNo%2BzBbvku%2BtchrUurvPRaN1_40mEQ1_sG90g%40mail.gmail.com Author: Daniil Davydov <3danissimo@gmail.com> Reviewed-by: Jim Jones <jim.jones@uni-muenster.de> Reviewed-by: Imran Zaheer <imran.zhir@gmail.com> Reviewed-by: ZizhuanLiu X-MAN <44973863@qq.com> Backpatch-through: 16 Branch ------ REL_16_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cc3fe7e2a7471c541df7ff168bc41a3435f61fb0 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 14 ++ .../test_misc/t/013_temp_obj_multisession.pl | 274 +++++++++++++++++++++ 2 files changed, 288 insertions(+) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Prevent access to other sessions' empty temp tables @ 2026-07-03 15:01 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Alexander Korotkov @ 2026-07-03 15:01 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent access to other sessions' empty temp tables Commit ce146621 ensures that ERROR is raised if a session tries to read pages of another session's temp table. But there is a corner case where the other session's temp table is empty -- in this case the INSERT command bypasses our checks and executes without any errors. Such behavior is inconsistent and erroneous: it leaves an invalid buffer in the temp buffers pool. Since the buffer was created for another session's temp table, we get an error "no such file or directory" when trying to flush it. This commit fixes it by adding a RELATION_IS_OTHER_TEMP check in the relation-extension path. Backpatch to 16, because it is the first release after 31966b151e6, which introduced a separate local relation extension function ExtendBufferedRelLocal(), which lacks of RELATION_IS_OTHER_TEMP() check. As this fix introduces more checks to 013_temp_obj_multisession.pl, backpatch the whole test script to 16. Discussion: https://postgr.es/m/CAJDiXgiX2XZBHDNo%2BzBbvku%2BtchrUurvPRaN1_40mEQ1_sG90g%40mail.gmail.com Author: Daniil Davydov <3danissimo@gmail.com> Reviewed-by: Jim Jones <jim.jones@uni-muenster.de> Reviewed-by: Imran Zaheer <imran.zhir@gmail.com> Reviewed-by: ZizhuanLiu X-MAN <44973863@qq.com> Backpatch-through: 16 Branch ------ REL_17_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/4e49f68b72dea48b2f6772b66b7565b8f652291b Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 14 ++++++++++++++ src/include/utils/rel.h | 8 ++++---- .../modules/test_misc/t/013_temp_obj_multisession.pl | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Prevent access to other sessions' empty temp tables @ 2026-07-03 15:02 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Alexander Korotkov @ 2026-07-03 15:02 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent access to other sessions' empty temp tables Commit ce146621 ensures that ERROR is raised if a session tries to read pages of another session's temp table. But there is a corner case where the other session's temp table is empty -- in this case the INSERT command bypasses our checks and executes without any errors. Such behavior is inconsistent and erroneous: it leaves an invalid buffer in the temp buffers pool. Since the buffer was created for another session's temp table, we get an error "no such file or directory" when trying to flush it. This commit fixes it by adding a RELATION_IS_OTHER_TEMP check in the relation-extension path. Backpatch to 16, because it is the first release after 31966b151e6, which introduced a separate local relation extension function ExtendBufferedRelLocal(), which lacks of RELATION_IS_OTHER_TEMP() check. As this fix introduces more checks to 013_temp_obj_multisession.pl, backpatch the whole test script to 16. Discussion: https://postgr.es/m/CAJDiXgiX2XZBHDNo%2BzBbvku%2BtchrUurvPRaN1_40mEQ1_sG90g%40mail.gmail.com Author: Daniil Davydov <3danissimo@gmail.com> Reviewed-by: Jim Jones <jim.jones@uni-muenster.de> Reviewed-by: Imran Zaheer <imran.zhir@gmail.com> Reviewed-by: ZizhuanLiu X-MAN <44973863@qq.com> Backpatch-through: 16 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/8021cdceb0186d3e0fb2c56ffef9ece46840a7e3 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 14 ++++++++++++++ src/include/utils/rel.h | 8 ++++---- .../modules/test_misc/t/013_temp_obj_multisession.pl | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
* pgsql: Prevent access to other sessions' empty temp tables @ 2026-07-03 15:02 Alexander Korotkov <akorotkov@postgresql.org> 0 siblings, 0 replies; 5+ messages in thread From: Alexander Korotkov @ 2026-07-03 15:02 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent access to other sessions' empty temp tables Commit ce146621 ensures that ERROR is raised if a session tries to read pages of another session's temp table. But there is a corner case where the other session's temp table is empty -- in this case the INSERT command bypasses our checks and executes without any errors. Such behavior is inconsistent and erroneous: it leaves an invalid buffer in the temp buffers pool. Since the buffer was created for another session's temp table, we get an error "no such file or directory" when trying to flush it. This commit fixes it by adding a RELATION_IS_OTHER_TEMP check in the relation-extension path. Backpatch to 16, because it is the first release after 31966b151e6, which introduced a separate local relation extension function ExtendBufferedRelLocal(), which lacks of RELATION_IS_OTHER_TEMP() check. As this fix introduces more checks to 013_temp_obj_multisession.pl, backpatch the whole test script to 16. Discussion: https://postgr.es/m/CAJDiXgiX2XZBHDNo%2BzBbvku%2BtchrUurvPRaN1_40mEQ1_sG90g%40mail.gmail.com Author: Daniil Davydov <3danissimo@gmail.com> Reviewed-by: Jim Jones <jim.jones@uni-muenster.de> Reviewed-by: Imran Zaheer <imran.zhir@gmail.com> Reviewed-by: ZizhuanLiu X-MAN <44973863@qq.com> Backpatch-through: 16 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/c40819ebf954eefe8ec35c210b8a3d7a7a7aaea0 Modified Files -------------- src/backend/storage/buffer/bufmgr.c | 14 ++++++++++++++ src/include/utils/rel.h | 8 ++++---- .../modules/test_misc/t/013_temp_obj_multisession.pl | 16 ++++++++++++++++ 3 files changed, 34 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2026-07-03 15:02 UTC | newest] Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-07-03 15:01 pgsql: Prevent access to other sessions' empty temp tables Alexander Korotkov <akorotkov@postgresql.org> 2026-07-03 15:01 pgsql: Prevent access to other sessions' empty temp tables Alexander Korotkov <akorotkov@postgresql.org> 2026-07-03 15:01 pgsql: Prevent access to other sessions' empty temp tables Alexander Korotkov <akorotkov@postgresql.org> 2026-07-03 15:02 pgsql: Prevent access to other sessions' empty temp tables Alexander Korotkov <akorotkov@postgresql.org> 2026-07-03 15:02 pgsql: Prevent access to other sessions' empty temp tables Alexander Korotkov <akorotkov@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox