pgsql: libpq: Add support for require_auth to control authorized auth m

2023-03-13 Thread Michael Paquier
libpq: Add support for require_auth to control authorized auth methods The new connection parameter require_auth allows a libpq client to define a list of comma-separated acceptable authentication types for use with the server. There is no negotiation: if the server does not present one of the al

pgsql: meson: fix openssl detection issues in 6a30027

2023-03-13 Thread Andres Freund
meson: fix openssl detection issues in 6a30027 When not detecting openssl via pkg-config, we'd error out if the headers weren't found, even if -Dssl=auto. When detecting via pkg-config, but the headers could not be found, we'd error out because the ssl_int variable would not exist. Reported-by: N

Re: pgsql: Add standard collation UNICODE

2023-03-13 Thread Jeff Davis
On Sat, 2023-03-11 at 15:47 -0500, Tom Lane wrote: > In general, I see no good reason for our regression tests to be > making > assumptions about exactly how ICU's root locale behaves, so I'd > suggest > just lobotomizing this test case so it doesn't depend on upper/lower > sort order. [ Looks lik

pgsql: Fix JSON error reporting for many cases of erroneous string valu

2023-03-13 Thread Tom Lane
Fix JSON error reporting for many cases of erroneous string values. The majority of error exit cases in json_lex_string() failed to set lex->token_terminator, causing problems for the error context reporting code: it would see token_terminator less than token_start and do something more or less nu

pgsql: Fix JSON error reporting for many cases of erroneous string valu

2023-03-13 Thread Tom Lane
Fix JSON error reporting for many cases of erroneous string values. The majority of error exit cases in json_lex_string() failed to set lex->token_terminator, causing problems for the error context reporting code: it would see token_terminator less than token_start and do something more or less nu

pgsql: Fix JSON error reporting for many cases of erroneous string valu

2023-03-13 Thread Tom Lane
Fix JSON error reporting for many cases of erroneous string values. The majority of error exit cases in json_lex_string() failed to set lex->token_terminator, causing problems for the error context reporting code: it would see token_terminator less than token_start and do something more or less nu

pgsql: Fix JSON error reporting for many cases of erroneous string valu

2023-03-13 Thread Tom Lane
Fix JSON error reporting for many cases of erroneous string values. The majority of error exit cases in json_lex_string() failed to set lex->token_terminator, causing problems for the error context reporting code: it would see token_terminator less than token_start and do something more or less nu

pgsql: Fix JSON error reporting for many cases of erroneous string valu

2023-03-13 Thread Tom Lane
Fix JSON error reporting for many cases of erroneous string values. The majority of error exit cases in json_lex_string() failed to set lex->token_terminator, causing problems for the error context reporting code: it would see token_terminator less than token_start and do something more or less nu

pgsql: Fix JSON error reporting for many cases of erroneous string valu

2023-03-13 Thread Tom Lane
Fix JSON error reporting for many cases of erroneous string values. The majority of error exit cases in json_lex_string() failed to set lex->token_terminator, causing problems for the error context reporting code: it would see token_terminator less than token_start and do something more or less nu

Re: pgsql: Add standard collation UNICODE

2023-03-13 Thread Tom Lane
Andrew Dunstan writes: > How would I discover that? Or if it's quicker I can give you access to > one or two machines which exhibit the issue. Looks like Peter already found the answer -- several of the unhappy animals have gone green since d72900bde. regards, tom lane

Re: pgsql: Add standard collation UNICODE

2023-03-13 Thread Andrew Dunstan
On 2023-03-12 Su 18:47, Thomas Munro wrote: On Mon, Mar 13, 2023 at 9:10 AM Tom Lane wrote: Andrew Dunstan writes: On 2023-03-11 Sa 15:47, Tom Lane wrote: In general, I see no good reason for our regression tests to be making assumptions about exactly how ICU's root locale behaves, so I'd s

pgsql: Fix failure to detect some cases of improperly-nested aggregates

2023-03-13 Thread Tom Lane
Fix failure to detect some cases of improperly-nested aggregates. check_agg_arguments_walker() supposed that it needn't descend into the arguments of a lower-level aggregate function, but this is just wrong in the presence of multiple levels of sub-select. The oversight would lead to executor fai

pgsql: Fix failure to detect some cases of improperly-nested aggregates

2023-03-13 Thread Tom Lane
Fix failure to detect some cases of improperly-nested aggregates. check_agg_arguments_walker() supposed that it needn't descend into the arguments of a lower-level aggregate function, but this is just wrong in the presence of multiple levels of sub-select. The oversight would lead to executor fai

pgsql: Fix failure to detect some cases of improperly-nested aggregates

2023-03-13 Thread Tom Lane
Fix failure to detect some cases of improperly-nested aggregates. check_agg_arguments_walker() supposed that it needn't descend into the arguments of a lower-level aggregate function, but this is just wrong in the presence of multiple levels of sub-select. The oversight would lead to executor fai

pgsql: Fix failure to detect some cases of improperly-nested aggregates

2023-03-13 Thread Tom Lane
Fix failure to detect some cases of improperly-nested aggregates. check_agg_arguments_walker() supposed that it needn't descend into the arguments of a lower-level aggregate function, but this is just wrong in the presence of multiple levels of sub-select. The oversight would lead to executor fai

pgsql: Fix failure to detect some cases of improperly-nested aggregates

2023-03-13 Thread Tom Lane
Fix failure to detect some cases of improperly-nested aggregates. check_agg_arguments_walker() supposed that it needn't descend into the arguments of a lower-level aggregate function, but this is just wrong in the presence of multiple levels of sub-select. The oversight would lead to executor fai

pgsql: Fix failure to detect some cases of improperly-nested aggregates

2023-03-13 Thread Tom Lane
Fix failure to detect some cases of improperly-nested aggregates. check_agg_arguments_walker() supposed that it needn't descend into the arguments of a lower-level aggregate function, but this is just wrong in the presence of multiple levels of sub-select. The oversight would lead to executor fai

pgsql: Add a DEFAULT option to COPY FROM

2023-03-13 Thread Andrew Dunstan
Add a DEFAULT option to COPY FROM This allows for a string which if an input field matches causes the column's default value to be inserted. The advantage of this is that the default can be inserted in some rows and not others, for which non-default data is available. The file_fdw extension is a

pgsql: Fix MERGE command tag for actions blocked by BEFORE ROW triggers

2023-03-13 Thread Dean Rasheed
Fix MERGE command tag for actions blocked by BEFORE ROW triggers. This ensures that the row count in the command tag for a MERGE is correctly computed in the case where UPDATEs or DELETEs are skipped due to a BEFORE ROW trigger returning NULL (the INSERT case was already handled correctly by ExecM

pgsql: Fix MERGE command tag for actions blocked by BEFORE ROW triggers

2023-03-13 Thread Dean Rasheed
Fix MERGE command tag for actions blocked by BEFORE ROW triggers. This ensures that the row count in the command tag for a MERGE is correctly computed in the case where UPDATEs or DELETEs are skipped due to a BEFORE ROW trigger returning NULL (the INSERT case was already handled correctly by ExecM

pgsql: Fix concurrent update issues with MERGE.

2023-03-13 Thread Dean Rasheed
Fix concurrent update issues with MERGE. If MERGE attempts an UPDATE or DELETE on a table with BEFORE ROW triggers, or a cross-partition UPDATE (with or without triggers), and a concurrent UPDATE or DELETE happens, the merge code would fail. In some cases this would lead to a crash, while in othe

pgsql: Fix concurrent update issues with MERGE.

2023-03-13 Thread Dean Rasheed
Fix concurrent update issues with MERGE. If MERGE attempts an UPDATE or DELETE on a table with BEFORE ROW triggers, or a cross-partition UPDATE (with or without triggers), and a concurrent UPDATE or DELETE happens, the merge code would fail. In some cases this would lead to a crash, while in othe

pgsql: Fix expected test output

2023-03-13 Thread Peter Eisentraut
Fix expected test output For builds without lz4, for 208bf364a9. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b2bd9a6796d60bae7bfc3d780b6727f76fca1a7d Modified Files -- src/test/regress/expected/compression_1.out | 2 +- 1 file changed, 1 insertion(+)

pgsql: Remove incidental md5() function uses from main regression tests

2023-03-13 Thread Peter Eisentraut
Remove incidental md5() function uses from main regression tests Most of these calls were to generate some random data. These can be replaced by appropriately adapted sha256() calls. To keep the diff smaller, we wrap this into a helper function that produces the same output format and length as

pgsql: Improve support for UNICODE collation on older ICU

2023-03-13 Thread Peter Eisentraut
Improve support for UNICODE collation on older ICU The recently added standard collation UNICODE (0d21d4b9bc) doesn't give consistent results on some build farm members with old ICU versions. Apparently, the ICU locale specification 'und' (language tag style) misbehaves on some older ICU versions

pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll() The error cases for TLS and GSS encryption were inconsistent. After TLS fails, the connection is marked as dead and follow-up calls of PQconnectPoll() would return immediately, but GSS encryption was not doing that, so the conn

pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll() The error cases for TLS and GSS encryption were inconsistent. After TLS fails, the connection is marked as dead and follow-up calls of PQconnectPoll() would return immediately, but GSS encryption was not doing that, so the conn

pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll() The error cases for TLS and GSS encryption were inconsistent. After TLS fails, the connection is marked as dead and follow-up calls of PQconnectPoll() would return immediately, but GSS encryption was not doing that, so the conn

pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll() The error cases for TLS and GSS encryption were inconsistent. After TLS fails, the connection is marked as dead and follow-up calls of PQconnectPoll() would return immediately, but GSS encryption was not doing that, so the conn

pgsql: Fix inconsistent error handling for GSS encryption in PQconnectP

2023-03-13 Thread Michael Paquier
Fix inconsistent error handling for GSS encryption in PQconnectPoll() The error cases for TLS and GSS encryption were inconsistent. After TLS fails, the connection is marked as dead and follow-up calls of PQconnectPoll() would return immediately, but GSS encryption was not doing that, so the conn