pgsql: Fix corner-case 64-bit integer subtraction bug on some platforms

2023-11-09 Thread Dean Rasheed
Fix corner-case 64-bit integer subtraction bug on some platforms. When computing "0 - INT64_MIN", most platforms would report an overflow error, which is correct. However, platforms without integer overflow builtins or 128-bit integers would fail to spot the overflow, and incorrectly return INT64_

pgsql: Fix corner-case 64-bit integer subtraction bug on some platforms

2023-11-09 Thread Dean Rasheed
Fix corner-case 64-bit integer subtraction bug on some platforms. When computing "0 - INT64_MIN", most platforms would report an overflow error, which is correct. However, platforms without integer overflow builtins or 128-bit integers would fail to spot the overflow, and incorrectly return INT64_

pgsql: Fix corner-case 64-bit integer subtraction bug on some platforms

2023-11-09 Thread Dean Rasheed
Fix corner-case 64-bit integer subtraction bug on some platforms. When computing "0 - INT64_MIN", most platforms would report an overflow error, which is correct. However, platforms without integer overflow builtins or 128-bit integers would fail to spot the overflow, and incorrectly return INT64_

pgsql: Fix corner-case 64-bit integer subtraction bug on some platforms

2023-11-09 Thread Dean Rasheed
Fix corner-case 64-bit integer subtraction bug on some platforms. When computing "0 - INT64_MIN", most platforms would report an overflow error, which is correct. However, platforms without integer overflow builtins or 128-bit integers would fail to spot the overflow, and incorrectly return INT64_

pgsql: Fix corner-case 64-bit integer subtraction bug on some platforms

2023-11-09 Thread Dean Rasheed
Fix corner-case 64-bit integer subtraction bug on some platforms. When computing "0 - INT64_MIN", most platforms would report an overflow error, which is correct. However, platforms without integer overflow builtins or 128-bit integers would fail to spot the overflow, and incorrectly return INT64_

pgsql: Fix corner-case 64-bit integer subtraction bug on some platforms

2023-11-09 Thread Dean Rasheed
Fix corner-case 64-bit integer subtraction bug on some platforms. When computing "0 - INT64_MIN", most platforms would report an overflow error, which is correct. However, platforms without integer overflow builtins or 128-bit integers would fail to spot the overflow, and incorrectly return INT64_

pgsql: Ensure we use the correct spelling of "ensure"

2023-11-09 Thread David Rowley
Ensure we use the correct spelling of "ensure" We seem to have accidentally used "insure" in a few places. Correct that. Author: Peter Smith Discussion: https://postgr.es/m/CAHut+Pv0biqrhA3pMhu40aDsj343mTsD75khKnHsLqR8P04f=q...@mail.gmail.com Backpatch-through: 12, oldest supported version Bra

pgsql: Ensure we use the correct spelling of "ensure"

2023-11-09 Thread David Rowley
Ensure we use the correct spelling of "ensure" We seem to have accidentally used "insure" in a few places. Correct that. Author: Peter Smith Discussion: https://postgr.es/m/CAHut+Pv0biqrhA3pMhu40aDsj343mTsD75khKnHsLqR8P04f=q...@mail.gmail.com Backpatch-through: 12, oldest supported version Bra

pgsql: Ensure we use the correct spelling of "ensure"

2023-11-09 Thread David Rowley
Ensure we use the correct spelling of "ensure" We seem to have accidentally used "insure" in a few places. Correct that. Author: Peter Smith Discussion: https://postgr.es/m/CAHut+Pv0biqrhA3pMhu40aDsj343mTsD75khKnHsLqR8P04f=q...@mail.gmail.com Backpatch-through: 12, oldest supported version Bra

pgsql: Ensure we use the correct spelling of "ensure"

2023-11-09 Thread David Rowley
Ensure we use the correct spelling of "ensure" We seem to have accidentally used "insure" in a few places. Correct that. Author: Peter Smith Discussion: https://postgr.es/m/CAHut+Pv0biqrhA3pMhu40aDsj343mTsD75khKnHsLqR8P04f=q...@mail.gmail.com Backpatch-through: 12, oldest supported version Bra

pgsql: Ensure we use the correct spelling of "ensure"

2023-11-09 Thread David Rowley
Ensure we use the correct spelling of "ensure" We seem to have accidentally used "insure" in a few places. Correct that. Author: Peter Smith Discussion: https://postgr.es/m/CAHut+Pv0biqrhA3pMhu40aDsj343mTsD75khKnHsLqR8P04f=q...@mail.gmail.com Backpatch-through: 12, oldest supported version Bra

pgsql: Ensure we use the correct spelling of "ensure"

2023-11-09 Thread David Rowley
Ensure we use the correct spelling of "ensure" We seem to have accidentally used "insure" in a few places. Correct that. Author: Peter Smith Discussion: https://postgr.es/m/CAHut+Pv0biqrhA3pMhu40aDsj343mTsD75khKnHsLqR8P04f=q...@mail.gmail.com Backpatch-through: 12, oldest supported version Bra

pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update.

2023-11-09 Thread Dean Rasheed
Fix AFTER ROW trigger execution in MERGE cross-partition update. When executing a MERGE UPDATE action, if the UPDATE is turned into a cross-partition DELETE then INSERT, do not attempt to invoke AFTER UPDATE ROW triggers, or any of the other post-update actions in ExecUpdateEpilogue(). For consis

pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update.

2023-11-09 Thread Dean Rasheed
Fix AFTER ROW trigger execution in MERGE cross-partition update. When executing a MERGE UPDATE action, if the UPDATE is turned into a cross-partition DELETE then INSERT, do not attempt to invoke AFTER UPDATE ROW triggers, or any of the other post-update actions in ExecUpdateEpilogue(). For consis

pgsql: Fix AFTER ROW trigger execution in MERGE cross-partition update.

2023-11-09 Thread Dean Rasheed
Fix AFTER ROW trigger execution in MERGE cross-partition update. When executing a MERGE UPDATE action, if the UPDATE is turned into a cross-partition DELETE then INSERT, do not attempt to invoke AFTER UPDATE ROW triggers, or any of the other post-update actions in ExecUpdateEpilogue(). For consis

pgsql: Avoid integer overflow hazard in interval_time().

2023-11-09 Thread Dean Rasheed
Avoid integer overflow hazard in interval_time(). When casting an interval to a time, the original code suffered from 64-bit integer overflow for inputs with a sufficiently large negative "time" field, leading to bogus results. Fix by rewriting the algorithm in a simpler form, that more obviously

pgsql: Fix the way SJE removes references from PHVs

2023-11-09 Thread Alexander Korotkov
Fix the way SJE removes references from PHVs Add missing replacement of relids in phv->phexpr. Also, remove extra replace_relid() over phv->phrels. Reported-by: Zuming Jiang Bug: #18187 Discussion: https://postgr.es/m/flat/18187-831da249cbd2ff8e%40postgresql.org Author: Richard Guo Reviewed-by:

pgsql: meson: Install missing example files

2023-11-09 Thread Peter Eisentraut
meson: Install missing example files Install the example files from contrib/spi/, to match makefiles. Reviewed-by: Tristan Partin Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/b018b577-38a2-49c6-8727-adfb577de...@eisentraut.org Branch -- master Details

pgsql: meson: Fix doc installation path computation

2023-11-09 Thread Peter Eisentraut
meson: Fix doc installation path computation This applies the logic from 8f6858064b (append "postgresql" to some installation paths if it does not already contain "pgsql" or "postgres") also to the doc installation directory. Reviewed-by: Tristan Partin Reviewed-by: Andres Freund Discussion: h

pgsql: Ban role pg_signal_backend from more superuser backend types.

2023-11-09 Thread Noah Misch
Ban role pg_signal_backend from more superuser backend types. Documentation says it cannot signal "a backend owned by a superuser". On the contrary, it could signal background workers, including the logical replication launcher. It could signal autovacuum workers and the autovacuum launcher. Blo

pgsql: Ban role pg_signal_backend from more superuser backend types.

2023-11-09 Thread Noah Misch
Ban role pg_signal_backend from more superuser backend types. Documentation says it cannot signal "a backend owned by a superuser". On the contrary, it could signal background workers, including the logical replication launcher. It could signal autovacuum workers and the autovacuum launcher. Blo

pgsql: Ban role pg_signal_backend from more superuser backend types.

2023-11-09 Thread Noah Misch
Ban role pg_signal_backend from more superuser backend types. Documentation says it cannot signal "a backend owned by a superuser". On the contrary, it could signal background workers, including the logical replication launcher. It could signal autovacuum workers and the autovacuum launcher. Blo

pgsql: Ban role pg_signal_backend from more superuser backend types.

2023-11-09 Thread Noah Misch
Ban role pg_signal_backend from more superuser backend types. Documentation says it cannot signal "a backend owned by a superuser". On the contrary, it could signal background workers, including the logical replication launcher. It could signal autovacuum workers and the autovacuum launcher. Blo

pgsql: Ban role pg_signal_backend from more superuser backend types.

2023-11-09 Thread Noah Misch
Ban role pg_signal_backend from more superuser backend types. Documentation says it cannot signal "a backend owned by a superuser". On the contrary, it could signal background workers, including the logical replication launcher. It could signal autovacuum workers and the autovacuum launcher. Blo

pgsql: Ban role pg_signal_backend from more superuser backend types.

2023-11-09 Thread Noah Misch
Ban role pg_signal_backend from more superuser backend types. Documentation says it cannot signal "a backend owned by a superuser". On the contrary, it could signal background workers, including the logical replication launcher. It could signal autovacuum workers and the autovacuum launcher. Blo

pgsql: Compute aggregate argument types correctly in transformAggregate

2023-11-09 Thread Tom Lane
Compute aggregate argument types correctly in transformAggregateCall(). transformAggregateCall() captures the datatypes of the aggregate's arguments immediately to construct the Aggref.aggargtypes list. This seems reasonable because the arguments have already been transformed --- but there is an e

pgsql: Compute aggregate argument types correctly in transformAggregate

2023-11-09 Thread Tom Lane
Compute aggregate argument types correctly in transformAggregateCall(). transformAggregateCall() captures the datatypes of the aggregate's arguments immediately to construct the Aggref.aggargtypes list. This seems reasonable because the arguments have already been transformed --- but there is an e

pgsql: Ban role pg_signal_backend from more superuser backend types.

2023-11-09 Thread Noah Misch
Ban role pg_signal_backend from more superuser backend types. Documentation says it cannot signal "a backend owned by a superuser". On the contrary, it could signal background workers, including the logical replication launcher. It could signal autovacuum workers and the autovacuum launcher. Blo

pgsql: Compute aggregate argument types correctly in transformAggregate

2023-11-09 Thread Tom Lane
Compute aggregate argument types correctly in transformAggregateCall(). transformAggregateCall() captures the datatypes of the aggregate's arguments immediately to construct the Aggref.aggargtypes list. This seems reasonable because the arguments have already been transformed --- but there is an e

pgsql: Detect integer overflow while computing new array dimensions.

2023-11-09 Thread Tom Lane
Detect integer overflow while computing new array dimensions. array_set_element() and related functions allow an array to be enlarged by assigning to subscripts outside the current array bounds. While these places were careful to check that the new bounds are allowable, they neglected to consider

pgsql: Detect integer overflow while computing new array dimensions.

2023-11-09 Thread Tom Lane
Detect integer overflow while computing new array dimensions. array_set_element() and related functions allow an array to be enlarged by assigning to subscripts outside the current array bounds. While these places were careful to check that the new bounds are allowable, they neglected to consider

pgsql: Detect integer overflow while computing new array dimensions.

2023-11-09 Thread Tom Lane
Detect integer overflow while computing new array dimensions. array_set_element() and related functions allow an array to be enlarged by assigning to subscripts outside the current array bounds. While these places were careful to check that the new bounds are allowable, they neglected to consider

pgsql: Last-minute updates for release notes.

2023-11-09 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2023-5868, CVE-2023-5869, CVE-2023-5870 Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/8ff28255b6cd93b2fc3e12b12b05ed5430e48c4c Modified Files -- doc/src/sgml/release-12.sgml | 115 +++

pgsql: Last-minute updates for release notes.

2023-11-09 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2023-5868, CVE-2023-5869, CVE-2023-5870 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/639a8063ca7da421b34b7a49b2773c3cb2436df1 Modified Files -- doc/src/sgml/release-16.sgml | 115 +++

pgsql: Detect integer overflow while computing new array dimensions.

2023-11-09 Thread Tom Lane
Detect integer overflow while computing new array dimensions. array_set_element() and related functions allow an array to be enlarged by assigning to subscripts outside the current array bounds. While these places were careful to check that the new bounds are allowable, they neglected to consider

pgsql: Last-minute updates for release notes.

2023-11-09 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2023-5868, CVE-2023-5869, CVE-2023-5870 Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/95c96ba1d073afeadf193c7a9681a2c665dddead Modified Files -- doc/src/sgml/release-15.sgml | 115 +++

pgsql: Compute aggregate argument types correctly in transformAggregate

2023-11-09 Thread Tom Lane
Compute aggregate argument types correctly in transformAggregateCall(). transformAggregateCall() captures the datatypes of the aggregate's arguments immediately to construct the Aggref.aggargtypes list. This seems reasonable because the arguments have already been transformed --- but there is an e

pgsql: Compute aggregate argument types correctly in transformAggregate

2023-11-09 Thread Tom Lane
Compute aggregate argument types correctly in transformAggregateCall(). transformAggregateCall() captures the datatypes of the aggregate's arguments immediately to construct the Aggref.aggargtypes list. This seems reasonable because the arguments have already been transformed --- but there is an e

pgsql: Compute aggregate argument types correctly in transformAggregate

2023-11-09 Thread Tom Lane
Compute aggregate argument types correctly in transformAggregateCall(). transformAggregateCall() captures the datatypes of the aggregate's arguments immediately to construct the Aggref.aggargtypes list. This seems reasonable because the arguments have already been transformed --- but there is an e

pgsql: Compute aggregate argument types correctly in transformAggregate

2023-11-09 Thread Tom Lane
Compute aggregate argument types correctly in transformAggregateCall(). transformAggregateCall() captures the datatypes of the aggregate's arguments immediately to construct the Aggref.aggargtypes list. This seems reasonable because the arguments have already been transformed --- but there is an e

pgsql: Detect integer overflow while computing new array dimensions.

2023-11-09 Thread Tom Lane
Detect integer overflow while computing new array dimensions. array_set_element() and related functions allow an array to be enlarged by assigning to subscripts outside the current array bounds. While these places were careful to check that the new bounds are allowable, they neglected to consider

pgsql: Detect integer overflow while computing new array dimensions.

2023-11-09 Thread Tom Lane
Detect integer overflow while computing new array dimensions. array_set_element() and related functions allow an array to be enlarged by assigning to subscripts outside the current array bounds. While these places were careful to check that the new bounds are allowable, they neglected to consider

pgsql: Detect integer overflow while computing new array dimensions.

2023-11-09 Thread Tom Lane
Detect integer overflow while computing new array dimensions. array_set_element() and related functions allow an array to be enlarged by assigning to subscripts outside the current array bounds. While these places were careful to check that the new bounds are allowable, they neglected to consider

pgsql: Last-minute updates for release notes.

2023-11-09 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2023-5868, CVE-2023-5869, CVE-2023-5870 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/ef2950f5700220b9f8a5647c2a9711fc9b1716aa Modified Files -- doc/src/sgml/release-14.sgml | 115 +++

pgsql: Last-minute updates for release notes.

2023-11-09 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2023-5868, CVE-2023-5869, CVE-2023-5870 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/04b66eb417dd9fd1a4a7e2298e840a4b63c0d478 Modified Files -- doc/src/sgml/release-13.sgml | 115 +++

pgsql: Last-minute updates for release notes.

2023-11-09 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2023-5868, CVE-2023-5869, CVE-2023-5870 Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/3dbb3dd2d641af0da92e0a25b490b5bc38490e58 Modified Files -- doc/src/sgml/release-11.sgml | 113 +++

pgsql: Fix computation of varnullingrels when const-folding field selec

2023-11-09 Thread Tom Lane
Fix computation of varnullingrels when const-folding field selection. We can simplify FieldSelect on a whole-row Var into a plain Var for the selected field. However, we should copy the whole-row Var's varnullingrels when we do so, because the new Var is clearly nullable by exactly the same rels

pgsql: Fix computation of varnullingrels when const-folding field selec

2023-11-09 Thread Tom Lane
Fix computation of varnullingrels when const-folding field selection. We can simplify FieldSelect on a whole-row Var into a plain Var for the selected field. However, we should copy the whole-row Var's varnullingrels when we do so, because the new Var is clearly nullable by exactly the same rels

pgsql: doc: remove unnecessary comma in postgres-fdw

2023-11-09 Thread Bruce Momjian
doc: remove unnecessary comma in postgres-fdw Backpatch-through: master Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/80e278e436a7ad5cb4724d8b8ef39e79e4c3f5e6 Modified Files -- doc/src/sgml/postgres-fdw.sgml | 2 +- 1 file changed, 1 insertion(+), 1 d

pgsql: doc: fix wording describing the checkpoint_flush_after GUC

2023-11-09 Thread Bruce Momjian
doc: fix wording describing the checkpoint_flush_after GUC Reported-by: Evan Macbeth Discussion: https://postgr.es/m/155208475619.1380.12815553062985622...@wrigleys.postgresql.org Backpatch-through: master Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5ba1ac99a

pgsql: Prohibit max_slot_wal_keep_size to value other than -1 during up

2023-11-09 Thread Amit Kapila
Prohibit max_slot_wal_keep_size to value other than -1 during upgrade. We don't want existing slots in the old cluster to get invalidated during the upgrade. During an upgrade, we set this variable to -1 via the command line in an attempt to prevent such invalidations, but users have ways to overr