pgsql: Add static assertion ensuring sizeof(ExprEvalStep) <= 64 bytes

2023-02-22 Thread Andres Freund
Add static assertion ensuring sizeof(ExprEvalStep) <= 64 bytes This was previously only documented in a comment. Given the size of the struct, it's not hard to miss that comment. As evidenced by the commits leading up to fe3caa14393, 67b26703b41. It's possible, but not likely, that we might have

pgsql: Check for unbounded authentication exchanges in libpq.

2023-02-22 Thread Heikki Linnakangas
Check for unbounded authentication exchanges in libpq. A couple of code paths in CONNECTION_AWAITING_RESPONSE will eagerly read bytes off a connection that should be closed. Don't let a misbehaving server chew up client resources here; a v2 error can't be infinitely long, and a v3 error should be

pgsql: Fix some issues with wrong placement of pseudo-constant quals.

2023-02-22 Thread Tom Lane
Fix some issues with wrong placement of pseudo-constant quals. initsplan.c figured that it could push Var-free qual clauses to the top of the current JoinDomain, which is okay in the abstract. But if the current domain is inside some outer join, and we later commute an inside-the-domain outer

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Fix snapshot handling in logicalmsg_decode

2023-02-22 Thread Tomas Vondra
Fix snapshot handling in logicalmsg_decode Whe decoding a transactional logical message, logicalmsg_decode called SnapBuildGetOrBuildSnapshot. But we may not have a consistent snapshot yet at that point. We don't actually need the snapshot in this case (during replay we'll have the snapshot from

pgsql: Add missing support for the latest SPI status codes.

2023-02-22 Thread Dean Rasheed
Add missing support for the latest SPI status codes. SPI_result_code_string() was missing support for SPI_OK_TD_REGISTER, and in v15 and later, it was missing support for SPI_OK_MERGE, as was pltcl_process_SPI_result(). The last of those would trigger an error if a MERGE was executed from

pgsql: Add missing support for the latest SPI status codes.

2023-02-22 Thread Dean Rasheed
Add missing support for the latest SPI status codes. SPI_result_code_string() was missing support for SPI_OK_TD_REGISTER, and in v15 and later, it was missing support for SPI_OK_MERGE, as was pltcl_process_SPI_result(). The last of those would trigger an error if a MERGE was executed from

pgsql: Add missing support for the latest SPI status codes.

2023-02-22 Thread Dean Rasheed
Add missing support for the latest SPI status codes. SPI_result_code_string() was missing support for SPI_OK_TD_REGISTER, and in v15 and later, it was missing support for SPI_OK_MERGE, as was pltcl_process_SPI_result(). The last of those would trigger an error if a MERGE was executed from

pgsql: Add missing support for the latest SPI status codes.

2023-02-22 Thread Dean Rasheed
Add missing support for the latest SPI status codes. SPI_result_code_string() was missing support for SPI_OK_TD_REGISTER, and in v15 and later, it was missing support for SPI_OK_MERGE, as was pltcl_process_SPI_result(). The last of those would trigger an error if a MERGE was executed from

pgsql: Add missing support for the latest SPI status codes.

2023-02-22 Thread Dean Rasheed
Add missing support for the latest SPI status codes. SPI_result_code_string() was missing support for SPI_OK_TD_REGISTER, and in v15 and later, it was missing support for SPI_OK_MERGE, as was pltcl_process_SPI_result(). The last of those would trigger an error if a MERGE was executed from

pgsql: Add missing support for the latest SPI status codes.

2023-02-22 Thread Dean Rasheed
Add missing support for the latest SPI status codes. SPI_result_code_string() was missing support for SPI_OK_TD_REGISTER, and in v15 and later, it was missing support for SPI_OK_MERGE, as was pltcl_process_SPI_result(). The last of those would trigger an error if a MERGE was executed from

pgsql: Fix Assert failure for MERGE into a partitioned table with RLS.

2023-02-22 Thread Dean Rasheed
Fix Assert failure for MERGE into a partitioned table with RLS. In ExecInitPartitionInfo(), the Assert when building the WITH CHECK OPTION list for the new partition assumed that the command would be an INSERT or UPDATE, but it can also be a MERGE. This can be triggered by a MERGE into a

pgsql: Fix Assert failure for MERGE into a partitioned table with RLS.

2023-02-22 Thread Dean Rasheed
Fix Assert failure for MERGE into a partitioned table with RLS. In ExecInitPartitionInfo(), the Assert when building the WITH CHECK OPTION list for the new partition assumed that the command would be an INSERT or UPDATE, but it can also be a MERGE. This can be triggered by a MERGE into a

pgsql: Remove newly added asserts from pg_bitutils.h

2023-02-22 Thread John Naylor
Remove newly added asserts from pg_bitutils.h These were valuable during development, but are unlikely to tell us anything going forward. This reverts 204b0cbec and adjusts the content of 677319746 to more closely match the more-readable original style. Per review from Tom Lane Discussion:

pgsql: doc: Add default value of createrole_self_grant

2023-02-22 Thread Daniel Gustafsson
doc: Add default value of createrole_self_grant Document that the default value for createrole_self_grant is an empty string which in turn disable the feature. Author: Shi Yu Discussion: https://postgr.es/m/oszpr01mb63105d0d96a9a72a7fcd4ffefd...@oszpr01mb6310.jpnprd01.prod.outlook.com Branch

pgsql: Fix MERGE command tag for cross-partition updates.

2023-02-22 Thread Dean Rasheed
Fix MERGE command tag for cross-partition updates. This ensures that the row count in the command tag for a MERGE is correctly computed. Previously, if MERGE updated a partitioned table, the row count would be incorrect if any row was moved to a different partition, since such updates were

pgsql: Fix MERGE command tag for cross-partition updates.

2023-02-22 Thread Dean Rasheed
Fix MERGE command tag for cross-partition updates. This ensures that the row count in the command tag for a MERGE is correctly computed. Previously, if MERGE updated a partitioned table, the row count would be incorrect if any row was moved to a different partition, since such updates were

pgsql: Implement ANY_VALUE aggregate

2023-02-22 Thread Peter Eisentraut
Implement ANY_VALUE aggregate SQL:2023 defines an ANY_VALUE aggregate whose purpose is to emit an implementation-dependent (i.e. non-deterministic) value from the aggregated rows. Author: Vik Fearing Reviewed-by: Peter Eisentraut Reviewed-by: David Rowley Discussion:

pgsql: gitattributes: Ignore imported pg_bsd_indent code for whitespace

2023-02-22 Thread Peter Eisentraut
gitattributes: Ignore imported pg_bsd_indent code for whitespace checks Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7e5ddf7e4d1ee36233371661c5e96007c8d7c665 Modified Files -- .gitattributes | 2 ++ 1 file changed, 2 insertions(+)