pgsql: Add -Wshadow=compatible-local to the standard compilation flags

2022-10-06 Thread David Rowley
Add -Wshadow=compatible-local to the standard compilation flags Since cd4e8caaa, we've been able to build the source tree with -Wshadow=compatible-local without any warnings. Lots of work was done by Justin Pryzby and I (David) to get all our code to compile warning free with that flag. In that

pgsql: Improve our ability to detect bogus pointers passed to pfree et

2022-10-06 Thread Tom Lane
Improve our ability to detect bogus pointers passed to pfree et al. Commit c6e0fe1f2 was a shade too trusting that any pointer passed to pfree, repalloc, etc will point at a valid chunk. Notably, passing a pointer that was actually obtained from malloc tended to result in obscure assertion failur

pgsql: meson: Add support for building with precompiled headers

2022-10-06 Thread Andres Freund
meson: Add support for building with precompiled headers This substantially speeds up building for windows, due to the vast amount of headers included via windows.h. A cross build from linux targetting mingw goes from 994.11user 136.43system 0:31.58elapsed 3579%CPU to 422.41user 89.05system 0:14.

pgsql: Create subscription stats entry at CREATE SUBSCRIPTION time

2022-10-06 Thread Andres Freund
Create subscription stats entry at CREATE SUBSCRIPTION time Previously, the subscription stats entry was created when the first stats, i.e., an error on apply worker or tablesync worker, were reported. Therefore, the stats_reset field was not updated by pg_stat_reset_subscription_stats() if the s

pgsql: Fix final warnings produced by -Wshadow=compatible-local

2022-10-06 Thread David Rowley
Fix final warnings produced by -Wshadow=compatible-local I thought I had these in d8df67bb1, but per report from Andres Freund, I missed some. Reviewed-by: Andres Freund Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- http

pgsql: windows: Adjust FD_SETSIZE via commandline define

2022-10-06 Thread Andres Freund
windows: Adjust FD_SETSIZE via commandline define When using precompiled headers, we cannot pre-define macros for the system headers from within .c files, as headers are already processed before the #define in the C file is reached. But we can pre-define using -DFD_SETSIZE, as long as that's also

pgsql: meson: Fix two comments

2022-10-06 Thread Andres Freund
meson: Fix two comments Author: Junwang Zhao Discussion: https://postgr.es/m/CAEG8a3KxObc9g8NTzx1kX0Auf=j7fniubyzxsk6g5wv5shm...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0fa41648d77f04d5ad3ed69ff3e3903bd1abf121 Modified Files --

pgsql: Remove MemoryContextContains().

2022-10-06 Thread Tom Lane
Remove MemoryContextContains(). MemoryContextContains is no longer reliable in the wake of c6e0fe1f2, because there's no longer very much redundancy in chunk headers. (It wasn't *completely* reliable even before that, as there was a chance of a false positive if you passed it something that didn't

pgsql: Remove uses of MemoryContextContains in nodeAgg.c and nodeWindow

2022-10-06 Thread Tom Lane
Remove uses of MemoryContextContains in nodeAgg.c and nodeWindowAgg.c. MemoryContextContains is no longer reliable in the wake of c6e0fe1f2, so we need to get rid of these uses. It appears that there's no really good reason to force the result of an aggregate's finalfn or serialfn to be allocated

pgsql: Take care to de-duplicate entries in standby.c's table of locks.

2022-10-06 Thread Tom Lane
Take care to de-duplicate entries in standby.c's table of locks. The RecoveryLockLists data structure, which tracks all exclusive locks that the startup process is holding on behalf of transactions being replayed, did not have any provision for avoiding duplicate entries for the same lock. Maybe

pgsql: Remove useless character-length checks in contrib/ltree.

2022-10-06 Thread Tom Lane
Remove useless character-length checks in contrib/ltree. The t_iseq() macro does not need to be guarded by a character length check (at least when the comparison value is an ASCII character, as its documentation requires). Some portions of contrib/ltree hadn't read that memo, so simplify them. T

pgsql: Introduce t_isalnum() to replace t_isalpha() || t_isdigit() test

2022-10-06 Thread Tom Lane
Introduce t_isalnum() to replace t_isalpha() || t_isdigit() tests. ts_locale.c omitted support for "isalnum" tests, perhaps on the grounds that there were initially no use-cases for that. However, both ltree and pg_trgm need such tests, and we do also have one use-case now in the core backend. T

pgsql: Fix comment in xlogprefetcher.c

2022-10-06 Thread Michael Paquier
Fix comment in xlogprefetcher.c Author: Sho Kato Discussion: https://postgr.es/m/tycpr01mb684954052ec534a3261b29249f...@tycpr01mb6849.jpnprd01.prod.outlook.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5757141caeaff4af0c206ab672d542cbd608542c Modified Files