pgsql: Doc: add comments about PreventInTransactionBlock/IsInTransactio

2022-11-09 Thread Tom Lane
Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.

Add a little to the header comments for these functions to make it
clearer what guarantees about commit behavior are provided to callers.
(See commit f92944137 for context.)

Although this is only a comment change, it's really documentation
aimed at authors of extensions, so it seems appropriate to back-patch.

Yugo Nagata and Tom Lane, per further discussion of bug #17434.

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/1949135e79e852e19958873203bf32691754faaa

Modified Files
--
src/backend/access/transam/xact.c | 8 
1 file changed, 8 insertions(+)



pgsql: Doc: add comments about PreventInTransactionBlock/IsInTransactio

2022-11-09 Thread Tom Lane
Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.

Add a little to the header comments for these functions to make it
clearer what guarantees about commit behavior are provided to callers.
(See commit f92944137 for context.)

Although this is only a comment change, it's really documentation
aimed at authors of extensions, so it seems appropriate to back-patch.

Yugo Nagata and Tom Lane, per further discussion of bug #17434.

Discussion: https://postgr.es/m/[email protected]

Branch
--
master

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

Modified Files
--
src/backend/access/transam/xact.c | 8 
1 file changed, 8 insertions(+)



pgsql: Doc: add comments about PreventInTransactionBlock/IsInTransactio

2022-11-09 Thread Tom Lane
Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.

Add a little to the header comments for these functions to make it
clearer what guarantees about commit behavior are provided to callers.
(See commit f92944137 for context.)

Although this is only a comment change, it's really documentation
aimed at authors of extensions, so it seems appropriate to back-patch.

Yugo Nagata and Tom Lane, per further discussion of bug #17434.

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_15_STABLE

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

Modified Files
--
src/backend/access/transam/xact.c | 8 
1 file changed, 8 insertions(+)



pgsql: Doc: add comments about PreventInTransactionBlock/IsInTransactio

2022-11-09 Thread Tom Lane
Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.

Add a little to the header comments for these functions to make it
clearer what guarantees about commit behavior are provided to callers.
(See commit f92944137 for context.)

Although this is only a comment change, it's really documentation
aimed at authors of extensions, so it seems appropriate to back-patch.

Yugo Nagata and Tom Lane, per further discussion of bug #17434.

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/8befa05d78892c3830efb4f356e1de562e4c6cb7

Modified Files
--
src/backend/access/transam/xact.c | 8 
1 file changed, 8 insertions(+)



pgsql: Doc: add comments about PreventInTransactionBlock/IsInTransactio

2022-11-09 Thread Tom Lane
Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.

Add a little to the header comments for these functions to make it
clearer what guarantees about commit behavior are provided to callers.
(See commit f92944137 for context.)

Although this is only a comment change, it's really documentation
aimed at authors of extensions, so it seems appropriate to back-patch.

Yugo Nagata and Tom Lane, per further discussion of bug #17434.

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/17e9ecac011832959b703b1d6a14788f9c8c829c

Modified Files
--
src/backend/access/transam/xact.c | 8 
1 file changed, 8 insertions(+)



pgsql: Doc: add comments about PreventInTransactionBlock/IsInTransactio

2022-11-09 Thread Tom Lane
Doc: add comments about PreventInTransactionBlock/IsInTransactionBlock.

Add a little to the header comments for these functions to make it
clearer what guarantees about commit behavior are provided to callers.
(See commit f92944137 for context.)

Although this is only a comment change, it's really documentation
aimed at authors of extensions, so it seems appropriate to back-patch.

Yugo Nagata and Tom Lane, per further discussion of bug #17434.

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_11_STABLE

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

Modified Files
--
src/backend/access/transam/xact.c | 8 
1 file changed, 8 insertions(+)



pgsql: Report a more useful error for reloptions on a partitioned table

2022-11-09 Thread Tom Lane
Report a more useful error for reloptions on a partitioned table.

Previously, trying to set storage parameters on a partitioned table
always led to "unrecognized parameter foo", because the code expected
there might be some valid parameters; but there aren't any.  The docs
make clear that it's intended that there never will be any, so let's
replace this useless search with a more to-the-point message.

Simon Riggs and Karina Litskevich

Discussion: 
https://postgr.es/m/CANbhV-H=eZ9kTR9mUgKGK0Qv9uXP=u+dqg3rinqhftdfmhb...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/4f981df8e0b7bc00d22ab0db65579589c9d4bb8c

Modified Files
--
src/backend/access/common/reloptions.c | 13 ++---
src/test/regress/expected/alter_table.out  |  4 
src/test/regress/expected/create_table.out |  4 
src/test/regress/sql/alter_table.sql   |  3 +++
src/test/regress/sql/create_table.sql  |  3 +++
5 files changed, 20 insertions(+), 7 deletions(-)



pgsql: Remove redundant declaration for XidInMVCCSnapshot

2022-11-09 Thread Alvaro Herrera
Remove redundant declaration for XidInMVCCSnapshot

This was added for no good reason by c91560defc57, after b7eda3e0e334
had just moved the prototype from utils/tqual.h to utils/snapmgr.h.

Author: Japin Li 
Discussion: 
https://postgr.es/m/meyp282mb16693a409f3282a9db287badb6...@meyp282mb1669.ausp282.prod.outlook.com

Branch
--
master

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

Modified Files
--
src/include/access/heapam.h | 1 -
1 file changed, 1 deletion(-)



pgsql: Apply a better fix to mdunlinkfork().

2022-11-09 Thread Tom Lane
Apply a better fix to mdunlinkfork().

Replace the stopgap fix I made in 0e758ae89 with a cleaner one.

The real problem with 4ab5dae94 is that it contorted this function's
logic substantially, by introducing a third code path that required
different behavior in the function's main loop.  That seems quite
unnecessary on closer inspection: the new IsBinaryUpgrade case can
just share the behavior of the other immediate-unlink cases.  Hence,
revert 4ab5dae94 and most of 0e758ae89 (keeping the latter's
save/restore errno fix), and add IsBinaryUpgrade to the set of
conditions tested to choose immediate unlink.

Also fix some additional places with sloppy handling of errno,
to ensure we have an invariant that we always continue processing
after any non-ENOENT failure of do_truncate.  I doubt that that's
fixing any bug of field importance, so I don't feel it necessary to
back-patch; but we might as well get it right while we're here.

Also improve the comments, which had drifted a bit from what the
code actually does, and neglected to mention some important
considerations.

Back-patch to v15, not because this is fixing any bug but because
it doesn't seem like a good idea for v15's mdunlinkfork logic to be
significantly different from both v14 and v16.

Discussion: https://postgr.es/m/[email protected]

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/85d8b30724c0fd117a683cc72706f71b28463a05

Modified Files
--
src/backend/storage/smgr/md.c | 82 ---
1 file changed, 45 insertions(+), 37 deletions(-)



pgsql: Apply a better fix to mdunlinkfork().

2022-11-09 Thread Tom Lane
Apply a better fix to mdunlinkfork().

Replace the stopgap fix I made in 0e758ae89 with a cleaner one.

The real problem with 4ab5dae94 is that it contorted this function's
logic substantially, by introducing a third code path that required
different behavior in the function's main loop.  That seems quite
unnecessary on closer inspection: the new IsBinaryUpgrade case can
just share the behavior of the other immediate-unlink cases.  Hence,
revert 4ab5dae94 and most of 0e758ae89 (keeping the latter's
save/restore errno fix), and add IsBinaryUpgrade to the set of
conditions tested to choose immediate unlink.

Also fix some additional places with sloppy handling of errno,
to ensure we have an invariant that we always continue processing
after any non-ENOENT failure of do_truncate.  I doubt that that's
fixing any bug of field importance, so I don't feel it necessary to
back-patch; but we might as well get it right while we're here.

Also improve the comments, which had drifted a bit from what the
code actually does, and neglected to mention some important
considerations.

Back-patch to v15, not because this is fixing any bug but because
it doesn't seem like a good idea for v15's mdunlinkfork logic to be
significantly different from both v14 and v16.

Discussion: https://postgr.es/m/[email protected]

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/7b6610508d68f0c6191c01e824d90051295a39fc

Modified Files
--
src/backend/storage/smgr/md.c | 82 ---
1 file changed, 45 insertions(+), 37 deletions(-)



pgsql: Fix comment of SimpleLruInit() in slru.c

2022-11-09 Thread Michael Paquier
Fix comment of SimpleLruInit() in slru.c

sync_handler was not mentioned in the comment block of the function.

Oversight in dee663f.

Author: Aleksander Alekseev
Discussion: 
https://postgr.es/m/CAJ7c6TPUd9BwNY47TtMxaijLHSbyHNdhu=kvbgnvo_bi+oc...@mail.gmail.com
Backpatch-through: 14

Branch
--
REL_14_STABLE

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

Modified Files
--
src/backend/access/transam/slru.c | 1 +
1 file changed, 1 insertion(+)



pgsql: Fix comment of SimpleLruInit() in slru.c

2022-11-09 Thread Michael Paquier
Fix comment of SimpleLruInit() in slru.c

sync_handler was not mentioned in the comment block of the function.

Oversight in dee663f.

Author: Aleksander Alekseev
Discussion: 
https://postgr.es/m/CAJ7c6TPUd9BwNY47TtMxaijLHSbyHNdhu=kvbgnvo_bi+oc...@mail.gmail.com
Backpatch-through: 14

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5ca3645cb3fb4b8b359ea560f6a1a230ea59c8bc

Modified Files
--
src/backend/access/transam/slru.c | 1 +
1 file changed, 1 insertion(+)



pgsql: Fix comment of SimpleLruInit() in slru.c

2022-11-09 Thread Michael Paquier
Fix comment of SimpleLruInit() in slru.c

sync_handler was not mentioned in the comment block of the function.

Oversight in dee663f.

Author: Aleksander Alekseev
Discussion: 
https://postgr.es/m/CAJ7c6TPUd9BwNY47TtMxaijLHSbyHNdhu=kvbgnvo_bi+oc...@mail.gmail.com
Backpatch-through: 14

Branch
--
REL_15_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/5962c8cbe5a6f02aa638279822cc59bd364e2081

Modified Files
--
src/backend/access/transam/slru.c | 1 +
1 file changed, 1 insertion(+)