pgsql: Improve test coverage in bump.c

2024-04-15 Thread David Rowley
Improve test coverage in bump.c There were no callers of BumpAllocLarge() in the regression tests, so here we add a sort with a tuple large enough to use that path in bump.c. Also, BumpStats() wasn't being called, so add a test to sysviews.sql to call pg_backend_memory_contexts() while a bump

pgsql: xml2: Replace deprecated routines with recommended ones

2024-04-15 Thread Michael Paquier
xml2: Replace deprecated routines with recommended ones Some functions are used in the tree and are currently marked as deprecated by upstream. This commit refreshes the code to use the recommended functions, leading to the following changes: - xmlSubstituteEntitiesDefault() is gone, and needs

pgsql: xml2: Replace deprecated routines with recommended ones

2024-04-15 Thread Michael Paquier
xml2: Replace deprecated routines with recommended ones Some functions are used in the tree and are currently marked as deprecated by upstream. This commit refreshes the code to use the recommended functions, leading to the following changes: - xmlSubstituteEntitiesDefault() is gone, and needs

pgsql: xml2: Replace deprecated routines with recommended ones

2024-04-15 Thread Michael Paquier
xml2: Replace deprecated routines with recommended ones Some functions are used in the tree and are currently marked as deprecated by upstream. This commit refreshes the code to use the recommended functions, leading to the following changes: - xmlSubstituteEntitiesDefault() is gone, and needs

pgsql: xml2: Replace deprecated routines with recommended ones

2024-04-15 Thread Michael Paquier
xml2: Replace deprecated routines with recommended ones Some functions are used in the tree and are currently marked as deprecated by upstream. This commit refreshes the code to use the recommended functions, leading to the following changes: - xmlSubstituteEntitiesDefault() is gone, and needs

pgsql: xml2: Replace deprecated routines with recommended ones

2024-04-15 Thread Michael Paquier
xml2: Replace deprecated routines with recommended ones Some functions are used in the tree and are currently marked as deprecated by upstream. This commit refreshes the code to use the recommended functions, leading to the following changes: - xmlSubstituteEntitiesDefault() is gone, and needs

Re: pgsql: Move code for backend startup to separate file

2024-04-15 Thread Michael Paquier
On Mon, Apr 15, 2024 at 05:24:39PM +0900, Michael Paquier wrote: > extern PGDLLIMPORT const char *progname; > > +extern bool LoadedSSL; > > This variable is missing a PGDLLIMPORT, it seems. > > aafc05de1bf5 has missed a second one with MyClientSocket. Both are > declared in postmaster.h. For

pgsql: Add missing PGDLLIMPORT markings

2024-04-15 Thread Michael Paquier
Add missing PGDLLIMPORT markings All backend-side variables should be marked with PGDLLIMPORT, as per policy introduced in 8ec569479f. aafc05de1bf5 has forgotten MyClientSocket, and 05c3980e7f47 LoadedSSL. These can be spotted with a command like this one (be careful of not switching

pgsql: docs: Consolidate into new "WAL for Extensions" chapter.

2024-04-15 Thread Robert Haas
docs: Consolidate into new "WAL for Extensions" chapter. Previously, we had consecutive, very short chapters called "Generic WAL" and "Custom WAL Resource Managers," explaining different approaches to the same problem. Merge them into a single chapter. Explain most of the differences between the

pgsql: doc: Note exceptions for SET ROLE's effect on privilege checks.

2024-04-15 Thread Nathan Bossart
doc: Note exceptions for SET ROLE's effect on privilege checks. The documentation for SET ROLE states that superusers who switch to a non-superuser role lose their superuser privileges. While this is true for most commands, there are exceptions such as SET ROLE and SET SESSION AUTHORIZATION,

pgsql: Fix type-checking of RECORD-returning functions in FROM, redux.

2024-04-15 Thread Tom Lane
Fix type-checking of RECORD-returning functions in FROM, redux. Commit 2ed8f9a01 intended to institute a policy that if a RangeTblFunction has a coldeflist, then the function return type is certainly RECORD, and we should use the coldeflist as the source of truth about what the columns of the

pgsql: Fix type-checking of RECORD-returning functions in FROM, redux.

2024-04-15 Thread Tom Lane
Fix type-checking of RECORD-returning functions in FROM, redux. Commit 2ed8f9a01 intended to institute a policy that if a RangeTblFunction has a coldeflist, then the function return type is certainly RECORD, and we should use the coldeflist as the source of truth about what the columns of the

pgsql: Fix type-checking of RECORD-returning functions in FROM, redux.

2024-04-15 Thread Tom Lane
Fix type-checking of RECORD-returning functions in FROM, redux. Commit 2ed8f9a01 intended to institute a policy that if a RangeTblFunction has a coldeflist, then the function return type is certainly RECORD, and we should use the coldeflist as the source of truth about what the columns of the

pgsql: Fix type-checking of RECORD-returning functions in FROM, redux.

2024-04-15 Thread Tom Lane
Fix type-checking of RECORD-returning functions in FROM, redux. Commit 2ed8f9a01 intended to institute a policy that if a RangeTblFunction has a coldeflist, then the function return type is certainly RECORD, and we should use the coldeflist as the source of truth about what the columns of the

pgsql: Fix type-checking of RECORD-returning functions in FROM, redux.

2024-04-15 Thread Tom Lane
Fix type-checking of RECORD-returning functions in FROM, redux. Commit 2ed8f9a01 intended to institute a policy that if a RangeTblFunction has a coldeflist, then the function return type is certainly RECORD, and we should use the coldeflist as the source of truth about what the columns of the

pgsql: Fix type-checking of RECORD-returning functions in FROM, redux.

2024-04-15 Thread Tom Lane
Fix type-checking of RECORD-returning functions in FROM, redux. Commit 2ed8f9a01 intended to institute a policy that if a RangeTblFunction has a coldeflist, then the function return type is certainly RECORD, and we should use the coldeflist as the source of truth about what the columns of the

pgsql: ATTACH PARTITION: Don't match a PK with a UNIQUE constraint

2024-04-15 Thread Alvaro Herrera
ATTACH PARTITION: Don't match a PK with a UNIQUE constraint When matching constraints in AttachPartitionEnsureIndexes() we weren't testing the constraint type, which could make a UNIQUE key lacking a not-null constraint incorrectly satisfy a primary key requirement. Fix this by testing that the

pgsql: Grammar fixes for split/merge partitions code

2024-04-15 Thread Alexander Korotkov
Grammar fixes for split/merge partitions code The fixes relate to comments, error messages, and corresponding expected output of regression tests. Discussion: https://postgr.es/m/CAMbWs49DDsknxyoycBqiE72VxzL_sYHF6zqL8dSeNehKPJhkKg%40mail.gmail.com Discussion:

pgsql: Fix propagating attnotnull in multiple inheritance

2024-04-15 Thread Alvaro Herrera
Fix propagating attnotnull in multiple inheritance In one of the many strange corner cases of multiple inheritance being used, commit b0e96f311985 missed a CommandCounterIncrement() call after updating the attnotnull flag during ALTER TABLE ADD COLUMN, which caused a catalog tuple to be update

Re: pgsql: Move code for backend startup to separate file

2024-04-15 Thread Michael Paquier
Hi Heikki, (Peter E. in CC.) On Mon, Mar 18, 2024 at 09:40:36AM +, Heikki Linnakangas wrote: > Move code for backend startup to separate file > > This is code that runs in the backend process after forking, rather > than postmaster. Move it out of postmaster.c for clarity. > > Reviewed-by:

pgsql: psql: Make output of \dD more stable

2024-04-15 Thread Peter Eisentraut
psql: Make output of \dD more stable \dD showed domain check constraints in arbitrary order, which can cause regression test failures, which was exposed by commit 9895b35cb8. To fix, order the constraints by conname, which matches what psql does in other queries listing constraints. Branch

pgsql: Fix ALTER DOMAIN NOT NULL syntax

2024-04-15 Thread Peter Eisentraut
Fix ALTER DOMAIN NOT NULL syntax This addresses a few problems with commit e5da0fe3c22 ("Catalog domain not-null constraints"). In CREATE DOMAIN, a NOT NULL constraint looks like CREATE DOMAIN d1 AS int [ CONSTRAINT conname ] NOT NULL (Before e5da0fe3c22, the constraint name was accepted