pgsql: Add regression tests for psql's \o and \g on files

2022-11-29 Thread Michael Paquier
Add regression tests for psql's \o and \g on files This adds coverage for a few scenarios not checked yet in psql, with multiple query combined across files defined by \o, \g or both at the same time. The results are saved in the output files defined, then reloaded back to check what has been wri

pgsql: doc: add transaction processing chapter with internals info

2022-11-29 Thread Bruce Momjian
doc: add transaction processing chapter with internals info This also adds references to this new chapter at relevant sections of our documentation. Previously much of these internal details were exposed to users, but not explained. This also updates RELEASE SAVEPOINT. Discussion: https://pos

pgsql: doc: add transaction processing chapter with internals info

2022-11-29 Thread Bruce Momjian
doc: add transaction processing chapter with internals info This also adds references to this new chapter at relevant sections of our documentation. Previously much of these internal details were exposed to users, but not explained. This also updates RELEASE SAVEPOINT. Discussion: https://pos

pgsql: doc: add transaction processing chapter with internals info

2022-11-29 Thread Bruce Momjian
doc: add transaction processing chapter with internals info This also adds references to this new chapter at relevant sections of our documentation. Previously much of these internal details were exposed to users, but not explained. This also updates RELEASE SAVEPOINT. Discussion: https://pos

pgsql: doc: add transaction processing chapter with internals info

2022-11-29 Thread Bruce Momjian
doc: add transaction processing chapter with internals info This also adds references to this new chapter at relevant sections of our documentation. Previously much of these internal details were exposed to users, but not explained. This also updates RELEASE SAVEPOINT. Discussion: https://pos

pgsql: doc: add transaction processing chapter with internals info

2022-11-29 Thread Bruce Momjian
doc: add transaction processing chapter with internals info This also adds references to this new chapter at relevant sections of our documentation. Previously much of these internal details were exposed to users, but not explained. This also updates RELEASE SAVEPOINT. Discussion: https://pos

pgsql: doc: add transaction processing chapter with internals info

2022-11-29 Thread Bruce Momjian
doc: add transaction processing chapter with internals info This also adds references to this new chapter at relevant sections of our documentation. Previously much of these internal details were exposed to users, but not explained. This also updates RELEASE SAVEPOINT. Discussion: https://pos

pgsql: Refactor code parsing compression option values (-Z/--compress)

2022-11-29 Thread Michael Paquier
Refactor code parsing compression option values (-Z/--compress) This commit moves the code in charge of deparsing the method and detail strings fed later to parse_compress_specification() to a common routine, where the backward-compatible case of only an integer being found (N = 0 => "none", N > 1

pgsql: Fix comment in fe-auth-scram.c

2022-11-29 Thread Michael Paquier
Fix comment in fe-auth-scram.c The frontend-side routine in charge of building a SCRAM verifier mentioned that the restrictions applying to SASLprep on the password with the encoding are described at the top of fe-auth-scram.c, but this information is in auth-scram.c. This is wrong since 8f8b9be,

pgsql: Fix comment in fe-auth-scram.c

2022-11-29 Thread Michael Paquier
Fix comment in fe-auth-scram.c The frontend-side routine in charge of building a SCRAM verifier mentioned that the restrictions applying to SASLprep on the password with the encoding are described at the top of fe-auth-scram.c, but this information is in auth-scram.c. This is wrong since 8f8b9be,

pgsql: Fix comment in fe-auth-scram.c

2022-11-29 Thread Michael Paquier
Fix comment in fe-auth-scram.c The frontend-side routine in charge of building a SCRAM verifier mentioned that the restrictions applying to SASLprep on the password with the encoding are described at the top of fe-auth-scram.c, but this information is in auth-scram.c. This is wrong since 8f8b9be,

pgsql: Fix comment in fe-auth-scram.c

2022-11-29 Thread Michael Paquier
Fix comment in fe-auth-scram.c The frontend-side routine in charge of building a SCRAM verifier mentioned that the restrictions applying to SASLprep on the password with the encoding are described at the top of fe-auth-scram.c, but this information is in auth-scram.c. This is wrong since 8f8b9be,

pgsql: Fix comment in fe-auth-scram.c

2022-11-29 Thread Michael Paquier
Fix comment in fe-auth-scram.c The frontend-side routine in charge of building a SCRAM verifier mentioned that the restrictions applying to SASLprep on the password with the encoding are described at the top of fe-auth-scram.c, but this information is in auth-scram.c. This is wrong since 8f8b9be,

pgsql: Fix comment in fe-auth-scram.c

2022-11-29 Thread Michael Paquier
Fix comment in fe-auth-scram.c The frontend-side routine in charge of building a SCRAM verifier mentioned that the restrictions applying to SASLprep on the password with the encoding are described at the top of fe-auth-scram.c, but this information is in auth-scram.c. This is wrong since 8f8b9be,

pgsql: Improve heuristics for compressing the KnownAssignedXids array.

2022-11-29 Thread Tom Lane
Improve heuristics for compressing the KnownAssignedXids array. Previously, we'd compress only when the active range of array entries reached Max(4 * PROCARRAY_MAXPROCS, 2 * pArray->numKnownAssignedXids). If max_connections is large, the first term could result in not compressing for a long time,

pgsql: Improve heuristics for compressing the KnownAssignedXids array.

2022-11-29 Thread Tom Lane
Improve heuristics for compressing the KnownAssignedXids array. Previously, we'd compress only when the active range of array entries reached Max(4 * PROCARRAY_MAXPROCS, 2 * pArray->numKnownAssignedXids). If max_connections is large, the first term could result in not compressing for a long time,

pgsql: Improve heuristics for compressing the KnownAssignedXids array.

2022-11-29 Thread Tom Lane
Improve heuristics for compressing the KnownAssignedXids array. Previously, we'd compress only when the active range of array entries reached Max(4 * PROCARRAY_MAXPROCS, 2 * pArray->numKnownAssignedXids). If max_connections is large, the first term could result in not compressing for a long time,

pgsql: Improve heuristics for compressing the KnownAssignedXids array.

2022-11-29 Thread Tom Lane
Improve heuristics for compressing the KnownAssignedXids array. Previously, we'd compress only when the active range of array entries reached Max(4 * PROCARRAY_MAXPROCS, 2 * pArray->numKnownAssignedXids). If max_connections is large, the first term could result in not compressing for a long time,

pgsql: Improve heuristics for compressing the KnownAssignedXids array.

2022-11-29 Thread Tom Lane
Improve heuristics for compressing the KnownAssignedXids array. Previously, we'd compress only when the active range of array entries reached Max(4 * PROCARRAY_MAXPROCS, 2 * pArray->numKnownAssignedXids). If max_connections is large, the first term could result in not compressing for a long time,

pgsql: Improve heuristics for compressing the KnownAssignedXids array.

2022-11-29 Thread Tom Lane
Improve heuristics for compressing the KnownAssignedXids array. Previously, we'd compress only when the active range of array entries reached Max(4 * PROCARRAY_MAXPROCS, 2 * pArray->numKnownAssignedXids). If max_connections is large, the first term could result in not compressing for a long time,

pgsql: Prevent clobbering of utility statements in SQL function caches.

2022-11-29 Thread Tom Lane
Prevent clobbering of utility statements in SQL function caches. This is an oversight in commit 7c337b6b5: I apparently didn't think about the possibility of a SQL function being executed multiple times within a query. In that case, functions.c's primitive caching mechanism allows the same utilit

pgsql: Prevent clobbering of utility statements in SQL function caches.

2022-11-29 Thread Tom Lane
Prevent clobbering of utility statements in SQL function caches. This is an oversight in commit 7c337b6b5: I apparently didn't think about the possibility of a SQL function being executed multiple times within a query. In that case, functions.c's primitive caching mechanism allows the same utilit

pgsql: Prevent clobbering of utility statements in SQL function caches.

2022-11-29 Thread Tom Lane
Prevent clobbering of utility statements in SQL function caches. This is an oversight in commit 7c337b6b5: I apparently didn't think about the possibility of a SQL function being executed multiple times within a query. In that case, functions.c's primitive caching mechanism allows the same utilit

pgsql: Remove bogus Assert and dead code in remove_useless_results_recu

2022-11-29 Thread Tom Lane
Remove bogus Assert and dead code in remove_useless_results_recurse(). The JOIN_SEMI case Assert'ed that there are no PlaceHolderVars that need to be evaluated at the semijoin's RHS, which is wrong because there could be some in the semijoin's qual condition. However, there could not be any refer

pgsql: Remove bogus Assert and dead code in remove_useless_results_recu

2022-11-29 Thread Tom Lane
Remove bogus Assert and dead code in remove_useless_results_recurse(). The JOIN_SEMI case Assert'ed that there are no PlaceHolderVars that need to be evaluated at the semijoin's RHS, which is wrong because there could be some in the semijoin's qual condition. However, there could not be any refer

pgsql: Remove bogus Assert and dead code in remove_useless_results_recu

2022-11-29 Thread Tom Lane
Remove bogus Assert and dead code in remove_useless_results_recurse(). The JOIN_SEMI case Assert'ed that there are no PlaceHolderVars that need to be evaluated at the semijoin's RHS, which is wrong because there could be some in the semijoin's qual condition. However, there could not be any refer

pgsql: Remove bogus Assert and dead code in remove_useless_results_recu

2022-11-29 Thread Tom Lane
Remove bogus Assert and dead code in remove_useless_results_recurse(). The JOIN_SEMI case Assert'ed that there are no PlaceHolderVars that need to be evaluated at the semijoin's RHS, which is wrong because there could be some in the semijoin's qual condition. However, there could not be any refer

pgsql: Remove bogus Assert and dead code in remove_useless_results_recu

2022-11-29 Thread Tom Lane
Remove bogus Assert and dead code in remove_useless_results_recurse(). The JOIN_SEMI case Assert'ed that there are no PlaceHolderVars that need to be evaluated at the semijoin's RHS, which is wrong because there could be some in the semijoin's qual condition. However, there could not be any refer

pgsql: Add 'missing_ok' argument to build_attrmap_by_name

2022-11-29 Thread Alvaro Herrera
Add 'missing_ok' argument to build_attrmap_by_name When it's given as true, return a 0 in the position of the missing column rather than raising an error. This is currently unused, but it allows us to reimplement column permission checking in a subsequent commit. It seems worth breaking into a s