pgsql: pg_amcheck: Keep trying to fix the tests.

2021-03-12 Thread Tom Lane
pg_amcheck: Keep trying to fix the tests. Fix another example of non-portable option ordering in the tests. Oversight in 24189277f. Mark Dilger Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org

pgsql: Fix new pthread code to respect --disable-thread-safety.

2021-03-12 Thread Thomas Munro
Fix new pthread code to respect --disable-thread-safety. Don't try to compile src/port/pthread_barrier_wait.c if we opted out of threads at configure time. Revealed by build farm member gaur, which can't compile this code because of problems with its pthread implementation. It shouldn't be tryin

pgsql: Improve FK trigger parallel-safety check added by 05c8482f7f.

2021-03-12 Thread Amit Kapila
Improve FK trigger parallel-safety check added by 05c8482f7f. Commit 05c8482f7f added special logic related to parallel-safety of FK triggers. This is a bit of a hack and should have instead been done by simply setting appropriate proparallel values on those trigger functions themselves. Suggeste

pgsql: pg_amcheck: Keep trying to fix the tests.

2021-03-12 Thread Robert Haas
pg_amcheck: Keep trying to fix the tests. Commit 24189277f6ff3169b15c7bc82926a372ca7f2dbf managed to remove one of the two places where we were checking for a "no such user" error while leaving the other one right next to it. So remove that too. In fact, remove the entire test, because the whole p

pgsql: pg_amcheck: Try to fix still more test failures.

2021-03-12 Thread Robert Haas
pg_amcheck: Try to fix still more test failures. Avoid use of non-portable option ordering in command_checks_all(). The use of bare command line arguments before switches doesn't work everywhere. Per buildfarm members drongo and hoverfly. Avoid testing for the message "role \"%s\" does not exist

Re: pgsql: Try to fix compiler warnings.

2021-03-12 Thread Robert Haas
On Fri, Mar 12, 2021 at 3:18 PM Erik Rijkers wrote: > Now compile is OK again, no errors, no warnings. Thanks. Cool, thanks for confirming. -- Robert Haas EDB: http://www.enterprisedb.com

pgsql: Try to avoid apparent platform-dependency in IPC::Run

2021-03-12 Thread Robert Haas
Try to avoid apparent platform-dependency in IPC::Run It's hard to believe, but buildfarm results from the new pg_amcheck suggest that command_checks_all() perform shell expansion on some machines but not others, apparently due to an underlying behavior difference in IPC::Run. Let's see if we can

pgsql: Fix portability issues in pg_amcheck's 004_verify_heapam.pl.

2021-03-12 Thread Robert Haas
Fix portability issues in pg_amcheck's 004_verify_heapam.pl. Test #12 overwrote a 1-byte varlena header to make it look like the initial byte of a 4-byte varlena header, but the results were endian-dependent. Also, the byte "abc" that followed the overwritten byte would be interpreted differently

pgsql: Consolidate nbtree VACUUM metapage routines.

2021-03-12 Thread Peter Geoghegan
Consolidate nbtree VACUUM metapage routines. Simplify _bt_vacuum_needs_cleanup() functions's signature (it only needs a single 'rel' argument now), and move it next to its sibling function in nbtpage.c. I believe that _bt_vacuum_needs_cleanup() was originally located in nbtree.c due to an include

Re: pgsql: Try to fix compiler warnings.

2021-03-12 Thread Erik Rijkers
> On 2021.03.12. 21:06 Robert Haas wrote: > On Fri, Mar 12, 2021 at 2:52 PM wrote: > > > On 2021.03.12. 20:36 Robert Haas wrote: > > ../../../src/Makefile.global:919: recipe for target 'pg_amcheck.o' failed > > Makefile:43: recipe for target 'all-pg_amcheck-recurse' failed > > Makefile:42: recip

Re: pgsql: Try to fix compiler warnings.

2021-03-12 Thread Robert Haas
On Fri, Mar 12, 2021 at 2:52 PM wrote: > > On 2021.03.12. 20:36 Robert Haas wrote: > > Try to fix compiler warnings. > > > > Per report from Peter Geoghegan. > > I had the same errors Peter reported. gcc 10.2 on debian. > > The compile stops with: > > In file included from ../../../src/include/p

pgsql: Move PG_USED_FOR_ASSERTS_ONLY before initializer.

2021-03-12 Thread Robert Haas
Move PG_USED_FOR_ASSERTS_ONLY before initializer. Erik Rijkers reported a compile failure, and I think this is probably the reason. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ac445955852fe6bc0e02e87a409f25ab6e0a82d6 Modified Files -- src/bin/pg_amc

pgsql: Adjust perl style.

2021-03-12 Thread Robert Haas
Adjust perl style. Per buildfarm member crake. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7a1527c02c147a4107490662cb1872524c54a8ae Modified Files -- src/bin/pg_amcheck/t/003_check.pl | 13 ++--- src/bin/pg_amcheck/t/004_verify_heapam

Re: pgsql: Try to fix compiler warnings.

2021-03-12 Thread er
> On 2021.03.12. 20:36 Robert Haas wrote: > > > Try to fix compiler warnings. > > Per report from Peter Geoghegan. I had the same errors Peter reported. gcc 10.2 on debian. The compile stops with: In file included from ../../../src/include/postgres_fe.h:25, from pg_amche

pgsql: Try to fix compiler warnings.

2021-03-12 Thread Robert Haas
Try to fix compiler warnings. Per report from Peter Geoghegan. Discussion: http://postgr.es/m/CAH2-WznpwULZ3uJ1_6WXvNMXYbOy8k8tYs3r=qsdgmzerd6...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d60e61de4fb4a8e7ca88204c2c409e7380887d76 Modified File

pgsql: Add pg_amcheck, a CLI for contrib/amcheck.

2021-03-12 Thread Robert Haas
Add pg_amcheck, a CLI for contrib/amcheck. This makes it a lot easier to run the corruption checks that are implemented by contrib/amcheck against lots of relations and get the result in an easily understandable format. It has a wide variety of options for choosing which relations to check and whi

pgsql: Fix race condition in psql \e's detection of file modification.

2021-03-12 Thread Tom Lane
Fix race condition in psql \e's detection of file modification. psql's editing commands decide whether the user has edited the file by checking for change of modification timestamp. This is probably fine for a pre-existing file, but with a temporary file that is created within the command, it's p

pgsql: Fix race condition in psql \e's detection of file modification.

2021-03-12 Thread Tom Lane
Fix race condition in psql \e's detection of file modification. psql's editing commands decide whether the user has edited the file by checking for change of modification timestamp. This is probably fine for a pre-existing file, but with a temporary file that is created within the command, it's p

pgsql: Fix race condition in psql \e's detection of file modification.

2021-03-12 Thread Tom Lane
Fix race condition in psql \e's detection of file modification. psql's editing commands decide whether the user has edited the file by checking for change of modification timestamp. This is probably fine for a pre-existing file, but with a temporary file that is created within the command, it's p

pgsql: Fix race condition in psql \e's detection of file modification.

2021-03-12 Thread Tom Lane
Fix race condition in psql \e's detection of file modification. psql's editing commands decide whether the user has edited the file by checking for change of modification timestamp. This is probably fine for a pre-existing file, but with a temporary file that is created within the command, it's p

pgsql: Fix race condition in psql \e's detection of file modification.

2021-03-12 Thread Tom Lane
Fix race condition in psql \e's detection of file modification. psql's editing commands decide whether the user has edited the file by checking for change of modification timestamp. This is probably fine for a pre-existing file, but with a temporary file that is created within the command, it's p

pgsql: Fix race condition in psql \e's detection of file modification.

2021-03-12 Thread Tom Lane
Fix race condition in psql \e's detection of file modification. psql's editing commands decide whether the user has edited the file by checking for change of modification timestamp. This is probably fine for a pre-existing file, but with a temporary file that is created within the command, it's p

pgsql: Forbid marking an identity column as nullable.

2021-03-12 Thread Tom Lane
Forbid marking an identity column as nullable. GENERATED ALWAYS AS IDENTITY implies NOT NULL, but the code failed to complain if you overrode that with "GENERATED ALWAYS AS IDENTITY NULL". One might think the old behavior was a feature, but it was inconsistent because the outcome varied depending

pgsql: Forbid marking an identity column as nullable.

2021-03-12 Thread Tom Lane
Forbid marking an identity column as nullable. GENERATED ALWAYS AS IDENTITY implies NOT NULL, but the code failed to complain if you overrode that with "GENERATED ALWAYS AS IDENTITY NULL". One might think the old behavior was a feature, but it was inconsistent because the outcome varied depending

pgsql: Forbid marking an identity column as nullable.

2021-03-12 Thread Tom Lane
Forbid marking an identity column as nullable. GENERATED ALWAYS AS IDENTITY implies NOT NULL, but the code failed to complain if you overrode that with "GENERATED ALWAYS AS IDENTITY NULL". One might think the old behavior was a feature, but it was inconsistent because the outcome varied depending

pgsql: Forbid marking an identity column as nullable.

2021-03-12 Thread Tom Lane
Forbid marking an identity column as nullable. GENERATED ALWAYS AS IDENTITY implies NOT NULL, but the code failed to complain if you overrode that with "GENERATED ALWAYS AS IDENTITY NULL". One might think the old behavior was a feature, but it was inconsistent because the outcome varied depending

pgsql: Forbid marking an identity column as nullable.

2021-03-12 Thread Tom Lane
Forbid marking an identity column as nullable. GENERATED ALWAYS AS IDENTITY implies NOT NULL, but the code failed to complain if you overrode that with "GENERATED ALWAYS AS IDENTITY NULL". One might think the old behavior was a feature, but it was inconsistent because the outcome varied depending

pgsql: Specialize checkpointer sort functions.

2021-03-12 Thread Thomas Munro
Specialize checkpointer sort functions. When sorting a potentially large number of dirty buffers, the checkpointer can benefit from a faster sort routine. One reported improvement on a large buffer pool system was 1.4s -> 0.6s. Reviewed-by: Andres Freund Discussion: https://postgr.es/m/CA%2BhU

pgsql: Fix size overflow in calculation introduced by commits d6ad34f3

2021-03-12 Thread Amit Kapila
Fix size overflow in calculation introduced by commits d6ad34f3 and bea449c6. Reported-by: Thomas Munro Author: Takayuki Tsunakawa Reviewed-by: Kyotaro Horiguchi Discussion: https://postgr.es/m/CA+hUKG+oPoFizjABt=gxzwtehx3oev5rae2scjw2r6f1rgu...@mail.gmail.com Branch -- master Details -

pgsql: Fix use of relcache TriggerDesc field introduced by commit 05c84

2021-03-12 Thread Amit Kapila
Fix use of relcache TriggerDesc field introduced by commit 05c8482f7f. The commit added code which used a relcache TriggerDesc field across another cache access, which it shouldn't because the relcache doesn't guarantee it won't get moved. Diagnosed-by: Tom Lane Author: Greg Nancarrow Reviewed-by