pgsql: Fix incorrect format placeholders

2024-03-12 Thread Peter Eisentraut
Fix incorrect format placeholders Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/6612185883c6a43979693358423ee647421ff621 Modified Files -- src/bin/pg_combinebackup/pg_combinebackup.c | 4 ++-- src/bin/pg_combinebackup/reconstruct.c | 2 +- 2 files

pgsql: Add tests for more row patterns with COPY FROM .. (ON_ERROR igno

2024-03-12 Thread Michael Paquier
Add tests for more row patterns with COPY FROM .. (ON_ERROR ignore) While digging into the code of this feature, I got confused by the fact that a line is skipped when a value cannot be converted to its expected attribute even if the line has fewer attributes than the target relation. The tests

pgsql: Fix a random failure in 038_save_logical_slots_shutdown.pl.

2024-03-12 Thread Amit Kapila
Fix a random failure in 038_save_logical_slots_shutdown.pl. The test ensures that all the WAL on the publisher is sent to the subscriber before shutdown by comparing the confirmed_flush_lsn of the associated slot with the shutdown_checkpoint WAL location. But if the shutdown_checkpoint location

pgsql: ci: Use a RAM disk and more CPUs on FreeBSD.

2024-03-12 Thread Thomas Munro
ci: Use a RAM disk and more CPUs on FreeBSD. Run the tests in a RAM disk. It's still a UFS file system and is backed by 20GB of disk, but this avoids a lot of I/O. Even though we disable fsync, our tests do a lot of directory manipulations, some of which force file system meta-data to disk and

pgsql: Add some asserts based on LWLockHeldByMe() for replication slot

2024-03-12 Thread Michael Paquier
Add some asserts based on LWLockHeldByMe() for replication slot statistics Two assertions checking that ReplicationSlotAllocationLock is acquired are added to pgstat_create_replslot() and pgstat_drop_replslot(), corresponding to the routines in charge of the creation and the drop of replication

pgsql: Fix version check in 002_pg_upgrade.pl.

2024-03-12 Thread Jeff Davis
Fix version check in 002_pg_upgrade.pl. Commit f696c0cd5f tried to account for the version in a way that includes development versions, but it was broken. Fix with suggestion from Tom Lane. Discussion: https://postgr.es/m/1553991.1710191...@sss.pgh.pa.us Reported-by: Tom Lane Branch --

pgsql: Fix confusion about the return rowtype of SQL-language procedure

2024-03-12 Thread Tom Lane
Fix confusion about the return rowtype of SQL-language procedures. There is a very ancient hack in check_sql_fn_retval that allows a single SELECT targetlist entry of composite type to be taken as supplying all the output columns of a function returning composite. (This is grotty and

pgsql: Fix confusion about the return rowtype of SQL-language procedure

2024-03-12 Thread Tom Lane
Fix confusion about the return rowtype of SQL-language procedures. There is a very ancient hack in check_sql_fn_retval that allows a single SELECT targetlist entry of composite type to be taken as supplying all the output columns of a function returning composite. (This is grotty and

pgsql: Fix confusion about the return rowtype of SQL-language procedure

2024-03-12 Thread Tom Lane
Fix confusion about the return rowtype of SQL-language procedures. There is a very ancient hack in check_sql_fn_retval that allows a single SELECT targetlist entry of composite type to be taken as supplying all the output columns of a function returning composite. (This is grotty and

pgsql: Fix confusion about the return rowtype of SQL-language procedure

2024-03-12 Thread Tom Lane
Fix confusion about the return rowtype of SQL-language procedures. There is a very ancient hack in check_sql_fn_retval that allows a single SELECT targetlist entry of composite type to be taken as supplying all the output columns of a function returning composite. (This is grotty and

pgsql: Fix confusion about the return rowtype of SQL-language procedure

2024-03-12 Thread Tom Lane
Fix confusion about the return rowtype of SQL-language procedures. There is a very ancient hack in check_sql_fn_retval that allows a single SELECT targetlist entry of composite type to be taken as supplying all the output columns of a function returning composite. (This is grotty and

pgsql: Fix confusion about the return rowtype of SQL-language procedure

2024-03-12 Thread Tom Lane
Fix confusion about the return rowtype of SQL-language procedures. There is a very ancient hack in check_sql_fn_retval that allows a single SELECT targetlist entry of composite type to be taken as supplying all the output columns of a function returning composite. (This is grotty and

pgsql: Fix incorrect filename reference in comment

2024-03-12 Thread David Rowley
Fix incorrect filename reference in comment Author: Cary Huang Discussion: https://postgr.es/m/18e34071af0.dbfc9663424635.8571906799773344...@highgo.ca Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/fe4750effd61f5a37d18c48caa53892dbdcfb96d Modified Files

Re: pgsql: Catalog changes preparing for builtin collation provider.

2024-03-12 Thread Tom Lane
Jeff Davis writes: > Patch attached, following the example in AdjustUpgrade.pm. It feels a > bit inconsistent to sometimes use $oldnode->pg_version and sometimes > use $old_major_version, but it's certainly better than what I had done > in f696c0cd5f. You're still doing it the hard way. I

pgsql: libpq: Add encrypted and non-blocking query cancellation routine

2024-03-12 Thread Alvaro Herrera
libpq: Add encrypted and non-blocking query cancellation routines The existing PQcancel API uses blocking IO, which makes PQcancel impossible to use in an event loop based codebase without blocking the event loop until the call returns. It also doesn't encrypt the connection over which the

pgsql: Fix copying SockAddr struct

2024-03-12 Thread Heikki Linnakangas
Fix copying SockAddr struct Valgrind alerted about accessing uninitialized bytes after commit 4945e4ed4a: ==700242== VALGRINDERROR-BEGIN ==700242== Conditional jump or move depends on uninitialised value(s) ==700242==at 0x6D8A2A: getnameinfo_unix (ip.c:253) ==700242==by 0x6D8BD1:

pgsql: Set socket options in child process after forking

2024-03-12 Thread Heikki Linnakangas
Set socket options in child process after forking Try to minimize the work done in the postmaster process for each accepted connection, so that postmaster can quickly proceed with its duties. These function calls are very fast so this doesn't make any measurable performance difference in

pgsql: Pass CAC as an argument to the backend process

2024-03-12 Thread Heikki Linnakangas
Pass CAC as an argument to the backend process We used to smuggle it to the child process in the Port struct, but it seems better to pass it down as a separate argument. This paves the way for the next commit, which moves the initialization of the Port struct to the backend process, after

pgsql: Move initialization of the Port struct to the child process

2024-03-12 Thread Heikki Linnakangas
Move initialization of the Port struct to the child process In postmaster, use a more lightweight ClientSocket struct that encapsulates just the socket itself and the remote endpoint's address that you get from accept() call. ClientSocket is passed to the child process, which initializes the

pgsql: Disconnect if socket cannot be put into non-blocking mode

2024-03-12 Thread Heikki Linnakangas
Disconnect if socket cannot be put into non-blocking mode Commit 387da18874 moved the code to put socket into non-blocking mode from socket_set_nonblocking() into the one-time initialization function, pq_init(). In socket_set_nonblocking(), there indeed was a risk of recursion on failure like the

pgsql: Disconnect if socket cannot be put into non-blocking mode

2024-03-12 Thread Heikki Linnakangas
Disconnect if socket cannot be put into non-blocking mode Commit 387da18874 moved the code to put socket into non-blocking mode from socket_set_nonblocking() into the one-time initialization function, pq_init(). In socket_set_nonblocking(), there indeed was a risk of recursion on failure like the

pgsql: Disconnect if socket cannot be put into non-blocking mode

2024-03-12 Thread Heikki Linnakangas
Disconnect if socket cannot be put into non-blocking mode Commit 387da18874 moved the code to put socket into non-blocking mode from socket_set_nonblocking() into the one-time initialization function, pq_init(). In socket_set_nonblocking(), there indeed was a risk of recursion on failure like the

pgsql: Disconnect if socket cannot be put into non-blocking mode

2024-03-12 Thread Heikki Linnakangas
Disconnect if socket cannot be put into non-blocking mode Commit 387da18874 moved the code to put socket into non-blocking mode from socket_set_nonblocking() into the one-time initialization function, pq_init(). In socket_set_nonblocking(), there indeed was a risk of recursion on failure like the

pgsql: Disconnect if socket cannot be put into non-blocking mode

2024-03-12 Thread Heikki Linnakangas
Disconnect if socket cannot be put into non-blocking mode Commit 387da18874 moved the code to put socket into non-blocking mode from socket_set_nonblocking() into the one-time initialization function, pq_init(). In socket_set_nonblocking(), there indeed was a risk of recursion on failure like the

pgsql: Disconnect if socket cannot be put into non-blocking mode

2024-03-12 Thread Heikki Linnakangas
Disconnect if socket cannot be put into non-blocking mode Commit 387da18874 moved the code to put socket into non-blocking mode from socket_set_nonblocking() into the one-time initialization function, pq_init(). In socket_set_nonblocking(), there indeed was a risk of recursion on failure like the

pgsql: libpq: Move pg_cancel to fe-cancel.c

2024-03-12 Thread Alvaro Herrera
libpq: Move pg_cancel to fe-cancel.c No other files need to access this struct, so there is no need to have its definition in a header file. Author: Jelte Fennema-Nio Discussion: https://postgr.es/m/202403061822.spfzqbf7dsgg@alvherre.pgsql Branch -- master Details ---