pgsql: Move code around in StartupXLOG().

2022-02-15 Thread Heikki Linnakangas
Move code around in StartupXLOG(). This is in preparation for the next commit, which will split off recovery-related code from xlog.c into a new source file. This is the order that things will happen with the next commit, and the point of this commit is to make these ordering changes more explicit

pgsql: Refactor setting XLP_FIRST_IS_OVERWRITE_CONTRECORD.

2022-02-15 Thread Heikki Linnakangas
Refactor setting XLP_FIRST_IS_OVERWRITE_CONTRECORD. Set it directly in CreateOverwriteContrecordRecord(). That way, AdvanceXLInsertBuffer() doesn't need the missingContrecPtr global variable. This is in preparation for splitting xlog.c into multiple files. Reviewed-by: Robert Haas Discussion: ht

pgsql: Split xlog.c into xlog.c and xlogrecovery.c.

2022-02-15 Thread Heikki Linnakangas
Split xlog.c into xlog.c and xlogrecovery.c. This moves the functions related to performing WAL recovery into the new xlogrecovery.c source file, leaving xlog.c responsible for maintaining the WAL buffers, coordinating the startup and switch from recovery to normal operations, and other miscellane

pgsql: Run pgindent on xlog.c.

2022-02-15 Thread Heikki Linnakangas
Run pgindent on xlog.c. To tidy up after some recent refactorings in xlog.c. These would be fixed by the pgindent run we do at the end of the development cycle, but I want to clean these up now as I'm about to do some more big refactorings on xlog.c. Branch -- master Details --- https://

pgsql: Doc: Update documentation for modifying postgres_fdw foreign tab

2022-02-15 Thread Etsuro Fujita
Doc: Update documentation for modifying postgres_fdw foreign tables. Document that they can be modified using COPY as well. Back-patch to v11 where commit 3d956d956 added support for COPY in postgres_fdw. Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a9e18

pgsql: Doc: Update documentation for modifying postgres_fdw foreign tab

2022-02-15 Thread Etsuro Fujita
Doc: Update documentation for modifying postgres_fdw foreign tables. Document that they can be modified using COPY as well. Back-patch to v11 where commit 3d956d956 added support for COPY in postgres_fdw. Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/af2d4

pgsql: Doc: Update documentation for modifying postgres_fdw foreign tab

2022-02-15 Thread Etsuro Fujita
Doc: Update documentation for modifying postgres_fdw foreign tables. Document that they can be modified using COPY as well. Back-patch to v11 where commit 3d956d956 added support for COPY in postgres_fdw. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/27d195a57849

pgsql: Doc: Update documentation for modifying postgres_fdw foreign tab

2022-02-15 Thread Etsuro Fujita
Doc: Update documentation for modifying postgres_fdw foreign tables. Document that they can be modified using COPY as well. Back-patch to v11 where commit 3d956d956 added support for COPY in postgres_fdw. Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/48bf7

pgsql: Doc: Update documentation for modifying postgres_fdw foreign tab

2022-02-15 Thread Etsuro Fujita
Doc: Update documentation for modifying postgres_fdw foreign tables. Document that they can be modified using COPY as well. Back-patch to v11 where commit 3d956d956 added support for COPY in postgres_fdw. Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/0dc02

pgsql: Add TAP test to automate the equivalent of check_guc, take two

2022-02-15 Thread Michael Paquier
Add TAP test to automate the equivalent of check_guc, take two src/backend/utils/misc/check_guc is a script that cross-checks the consistency of the GUCs with postgresql.conf.sample, making sure that its format is in line with what guc.c has. It has never been run automatically, and has rotten ov

pgsql: Fix race condition in 028_pitr_timelines.pl test, add note to do

2022-02-15 Thread Heikki Linnakangas
Fix race condition in 028_pitr_timelines.pl test, add note to docs. The 028_pitr_timelines.pl test would sometimes hang, waiting for a WAL segment that was just filled up to be archived. It was because the test used 'pg_stat_archiver.last_archived_wal' to check if a file was archived, but the orde

pgsql: Update "don't truncate with failsafe" rationale.

2022-02-15 Thread Peter Geoghegan
Update "don't truncate with failsafe" rationale. There is a very good (though non-obvious) reason to avoid relation truncation during a VACUUM that has triggered the failsafe mechanism, which was missed before now. Update related comments, so this isn't forgotten. Reported-By: John Naylor Discu

Re: pgsql: Ensure that length argument of memcmp() isn't seen as negative.

2022-02-15 Thread Andres Freund
Hi, On 2022-02-15 22:28:23 +, Tom Lane wrote: > Ensure that length argument of memcmp() isn't seen as negative. > > I think this will shut up a weird warning from buildfarm member > serinus. Perhaps it'd be better to change tsCompareString's > length arguments to unsigned, but that seems mor

Re: pgsql: Track LLVM 15 changes.

2022-02-15 Thread Tom Lane
Andres Freund writes: > On 2022-02-16 09:18:53 +1300, Thomas Munro wrote: >> Yeah I mentioned this problem in the other thread. I got as far as >> finding this write-up: >> https://llvm.org/docs/OpaquePointers.html > Given that major parts of llvm (clang alone contains ~1k references) aren't > y

Re: pgsql: Track LLVM 15 changes.

2022-02-15 Thread Andres Freund
Hi, On 2022-02-16 09:18:53 +1300, Thomas Munro wrote: > Yeah I mentioned this problem in the other thread. I got as far as > finding this write-up: > > https://llvm.org/docs/OpaquePointers.html Given that major parts of llvm (clang alone contains ~1k references) aren't yet transitioned, I wonde

pgsql: Ensure that length argument of memcmp() isn't seen as negative.

2022-02-15 Thread Tom Lane
Ensure that length argument of memcmp() isn't seen as negative. I think this will shut up a weird warning from buildfarm member serinus. Perhaps it'd be better to change tsCompareString's length arguments to unsigned, but that seems more invasive than is justified. Part of a general push to remo

pgsql: Ensure that the argument of shmdt(2) is declared "void *".

2022-02-15 Thread Tom Lane
Ensure that the argument of shmdt(2) is declared "void *". Our gcc-on-Solaris buildfarm members emit "incompatible pointer type" warnings in places where it's not. This is a bit odd, since AFAICT Solaris follows the POSIX spec in declaring shmdt's argument as "const void *", and you'd think any p

pgsql: docs: Work around bug in the docbook xsl stylesheets.

2022-02-15 Thread Andres Freund
docs: Work around bug in the docbook xsl stylesheets. docbook-xsl's index generation stylesheet (autoidx.xsl) has a small bug: It doesn't include xlink in exclude-result-prefixes. Normally just leads to a a single xmlns:xlink in the containing the index, but because our customization emits that,

Re: pgsql: Track LLVM 15 changes.

2022-02-15 Thread Thomas Munro
On Wed, Feb 16, 2022 at 7:34 AM Tom Lane wrote: > Although seawasp isn't actually failing at the moment, it's emitting > a boatload of deprecation warnings, eg > > In file included from llvmjit_deform.c:27: > ../../../../src/include/jit/llvmjit_emit.h:112:23: warning: > 'LLVMBuildStructGEP' is de

Re: pgsql: Track LLVM 15 changes.

2022-02-15 Thread Tom Lane
Thomas Munro writes: > This really depends on *their* release cycle, not ours. Hmm. Well, > if we had a buildfarm animal that ran their latest release branch as > recently discussed, not their main branch, then we could say "if that > machine is failing, but seawasp is passing, now is the time t

pgsql: Reject change of output-column collation in CREATE OR REPLACE VI

2022-02-15 Thread Tom Lane
Reject change of output-column collation in CREATE OR REPLACE VIEW. checkViewTupleDesc() didn't get the memo that it should verify same attcollation along with same type/typmod. (A quick scan did not find other similar oversights.) Per bug #17404 from Pierre-Aurélien Georges. On another day I m

pgsql: Improve subscriber's error message for wrong publication relkind

2022-02-15 Thread Tom Lane
Improve subscriber's error message for wrong publication relkind. Pre-v13 versions only support logical replication from plain tables, while v13 and later also allow partitioned tables to be published. If you tried to subscribe an older server to such a publication, you got "table XXX not found on

pgsql: Improve subscriber's error message for wrong publication relkind

2022-02-15 Thread Tom Lane
Improve subscriber's error message for wrong publication relkind. Pre-v13 versions only support logical replication from plain tables, while v13 and later also allow partitioned tables to be published. If you tried to subscribe an older server to such a publication, you got "table XXX not found on

pgsql: Improve subscriber's error message for wrong publication relkind

2022-02-15 Thread Tom Lane
Improve subscriber's error message for wrong publication relkind. Pre-v13 versions only support logical replication from plain tables, while v13 and later also allow partitioned tables to be published. If you tried to subscribe an older server to such a publication, you got "table XXX not found on

Re: pgsql: Remove IS_AF_UNIX macro

2022-02-15 Thread Andres Freund
Hi, On 2022-02-15 10:41:44 -0500, Tom Lane wrote: > We might as well just nuke all the HAVE_UNIX_SOCKETS conditional compilation > if we let this stand. > > (Now, maybe we should indeed do that. I don't have much > interest in the possibility that we'll worry about such > platforms in future.)

Re: pgsql: Remove IS_AF_UNIX macro

2022-02-15 Thread Tom Lane
Peter Eisentraut writes: > Remove IS_AF_UNIX macro > The AF_UNIX macro was being used unprotected by HAVE_UNIX_SOCKETS, > apparently since 2008. I hadn't looked closely at this patch, but are you referring to this bit in ip.h? #ifdef HAVE_UNIX_SOCKETS #define IS_AF_UNIX(fam) ((fam) == AF_UNIX)

pgsql: Ensure that STDERR is empty in connect_ok tests

2022-02-15 Thread Daniel Gustafsson
Ensure that STDERR is empty in connect_ok tests Connections performed via connect_ok() in TAP tests should not write anything to STDERR. Author: Jacob Champion Reviewed-by: Tom Lane Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/9d4ffb61-392b-4a2c-b7e4-911797b4a...@yesql.se Discu

pgsql: Fix XML namespace declarations

2022-02-15 Thread Peter Eisentraut
Fix XML namespace declarations The XSL stylesheets used a mix of incorrect or outdated namespace declarations for XHTML, probably based on ancient advice and examples. Clean all this up. Besides improving correctness (although probably no impact in practice, other than possible validation failure

pgsql: Add more logging to new 028_pitr_timelines.pl test.

2022-02-15 Thread Heikki Linnakangas
Add more logging to new 028_pitr_timelines.pl test. The test has failed a couple of times on buildfarm member 'hoverfly'. It gets stuck waiting for the standby to archive 00020003 WAL segment. I don't understand why, but with DEBUG1, we will get messages in the log whenever a segme

pgsql: Remove IS_AF_UNIX macro

2022-02-15 Thread Peter Eisentraut
Remove IS_AF_UNIX macro The AF_UNIX macro was being used unprotected by HAVE_UNIX_SOCKETS, apparently since 2008. So the redirection through IS_AF_UNIX() is apparently no longer necessary. (More generally, all supported platforms are now HAVE_UNIX_SOCKETS, but even if there were a new platform i