pgsql: Constify the arguments of ilist.c/h functions

2023-01-11 Thread Peter Eisentraut
Constify the arguments of ilist.c/h functions Const qualifiers ensure that we don't do something stupid in the function implementation. Additionally they clarify the interface. As an example: void slist_delete(slist_head *head, const slist_node *node) Here one can instantly tell that n

pgsql: Code cleanup

2023-01-11 Thread Peter Eisentraut
Code cleanup for commit c96de2ce1782116bd0489b1cd69ba88189a495e8 Author: Nathan Bossart Discussion: https://www.postgresql.org/message-id/2023085434.GA1912982@nathanxps13 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/881fa869c6b0c4e2f310d1c145141dd9d6f53774

Re: pgsql: Revert "Get rid of the "new" and "old" entries in a view's range

2023-01-11 Thread Tom Lane
Michael Paquier writes: > -#define CATALOG_VERSION_NO 20230 > +#define CATALOG_VERSION_NO 202301092 > This should have gone upwards, not backwards? I figured I could just do a straight revert. If someone else had pushed another catversion bump meanwhile, then yeah it would have had to go up

Re: pgsql: Revert "Get rid of the "new" and "old" entries in a view's range

2023-01-11 Thread Michael Paquier
On Thu, Jan 12, 2023 at 04:01:31AM +, Tom Lane wrote: > Revert "Get rid of the "new" and "old" entries in a view's rangetable." > > This reverts commit 1b4d280ea1eb7ddb2e16654d5fa16960bb959566. > It's broken the buildfarm members that run cross-version-upgrade tests, > because they're not prep

pgsql: Rename some variables related to ident files in hba.{c,h}

2023-01-11 Thread Michael Paquier
Rename some variables related to ident files in hba.{c,h} The code that handles authentication for user maps was pretty confusing with its choice of variable names. It involves two types of users: a system user and a Postgres user (well, role), and these were not named consistently throughout the

pgsql: Fix incorrect comment in hba.h

2023-01-11 Thread Michael Paquier
Fix incorrect comment in hba.h A comment in hba.h mentioned that AuthTokens are used when building the IdentLines from pg_ident.conf, but since 8fea868 that has added support of regexps for databases and roles in pg_hba.conf, it is also the case of HBA files. This refreshes the comment to refer t

pgsql: Acquire spinlock when updating 2PC slot data during logical deco

2023-01-11 Thread Michael Paquier
Acquire spinlock when updating 2PC slot data during logical decoding creation The creation of a logical decoding context in CreateDecodingContext() updates some data of its slot for two-phase transactions if enabled by the caller, but the code forgot to acquire a spinlock when updating these field

pgsql: Acquire spinlock when updating 2PC slot data during logical deco

2023-01-11 Thread Michael Paquier
Acquire spinlock when updating 2PC slot data during logical decoding creation The creation of a logical decoding context in CreateDecodingContext() updates some data of its slot for two-phase transactions if enabled by the caller, but the code forgot to acquire a spinlock when updating these field

pgsql: Revert "Get rid of the "new" and "old" entries in a view's range

2023-01-11 Thread Tom Lane
Revert "Get rid of the "new" and "old" entries in a view's rangetable." This reverts commit 1b4d280ea1eb7ddb2e16654d5fa16960bb959566. It's broken the buildfarm members that run cross-version-upgrade tests, because they're not prepared to deal with cosmetic differences between CREATE VIEW commands

pgsql: Use WaitEventSet API for postmaster's event loop.

2023-01-11 Thread Thomas Munro
Use WaitEventSet API for postmaster's event loop. Switch to a design similar to regular backends, instead of the previous arrangement where signal handlers did non-trivial state management and called fork(). The main changes are: * The postmaster now has its own local latch to wait on. (For now

pgsql: Refactor DetermineSleepTime() to use milliseconds.

2023-01-11 Thread Thomas Munro
Refactor DetermineSleepTime() to use milliseconds. Since we're not using select() anymore, we don't need to bother with struct timeval. We can work directly in milliseconds, which the latch API wants. Discussion: https://postgr.es/m/CA%2BhUKG%2BZ-HpOj1JsO9eWUP%2Bar7npSVinsC_npxSy%2BjdOMsx%3DGg%

pgsql: Doc: fix silly thinko in 8bf6ec3ba.

2023-01-11 Thread Tom Lane
Doc: fix silly thinko in 8bf6ec3ba. Amit Langote Discussion: https://postgr.es/m/CA+HiwqG2v-SnWyJuyVM-Z8DEFukY8+qe3XLMwSG4Xp7Yf=r...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d93d68aeeaeeda0e871825b461fd9ab68c7c0de3 Modified Files ---

pgsql: Make lazy_vacuum_heap_rel match lazy_scan_heap.

2023-01-11 Thread Peter Geoghegan
Make lazy_vacuum_heap_rel match lazy_scan_heap. Make lazy_vacuum_heap_rel variable names match those from lazy_scan_heap where that makes sense. Extracted from a larger patch to deal with issues with how vacuumlazy.c sets pages all-frozen. Author: Peter Geoghegan Discussion: https://postgr.es/

pgsql: vacuumlazy.c: Tweak local variable name.

2023-01-11 Thread Peter Geoghegan
vacuumlazy.c: Tweak local variable name. Make a local variable name consistent with the name from its WAL record. Extracted from a larger patch to deal with issues with how vacuumlazy.c sets pages all-frozen. Author: Peter Geoghegan Discussion: https://postgr.es/m/cah2-wznungszf8v6osgjac5aysb3

pgsql: Rename and relocate freeze plan dedup routines.

2023-01-11 Thread Peter Geoghegan
Rename and relocate freeze plan dedup routines. Rename the heapam.c freeze plan deduplication routines added by commit 9e540599 to names that follow conventions for functions in heapam.c. Also relocate the functions so that they're next to their caller, which runs during original execution, when F

pgsql: Get rid of the "new" and "old" entries in a view's rangetable.

2023-01-11 Thread Tom Lane
Get rid of the "new" and "old" entries in a view's rangetable. The rule system needs "old" and/or "new" pseudo-RTEs in rule actions that are ON INSERT/UPDATE/DELETE. Historically it's put such entries into the ON SELECT rules of views as well, but those are really quite vestigial. The only thing

pgsql: Add support for tab completion after ALTER EXTENSION ADD|DROP in

2023-01-11 Thread Michael Paquier
Add support for tab completion after ALTER EXTENSION ADD|DROP in psql This appends the set of object types supported by these commands, and the objects defined in the cluster are completed after that. Note that these may not be in the extension being working on when using DROP, to keep the code s

pgsql: Improve TransactionIdDidAbort() documentation.

2023-01-11 Thread Peter Geoghegan
Improve TransactionIdDidAbort() documentation. Document that TransactionIdDidAbort() won't indicate that transactions that were in-progress during a crash have aborted. Tie this to existing discussion of the TransactionIdDidCommit() and TransactionIdDidCommit() protocol that code in heapam_visibi

Re: pgsql: Doc: add XML ID attributes to and tags.

2023-01-11 Thread Peter Eisentraut
On 09.01.23 21:08, Tom Lane wrote: Doc: add XML ID attributes to and tags. Any reason the new ids in create_database.sgml deviate from the normal naming schemes used everywhere else? Is it to preserve the existing create-database-strategy? Maybe we should rename that one and make the new

pgsql: Improve handling of inherited GENERATED expressions.

2023-01-11 Thread Tom Lane
Improve handling of inherited GENERATED expressions. In both partitioning and traditional inheritance, require child columns to be GENERATED if and only if their parent(s) are. Formerly we allowed the case of an inherited column being GENERATED when its parent isn't, but that results in inconsiste

pgsql: Don't leave roles behind after core regression tests.

2023-01-11 Thread Tom Lane
Don't leave roles behind after core regression tests. Commits cf5eb37c5 and e5b8a4c09 each created a new role that they forgot to remove again. This breaks the use-case of running "make installcheck" more than once, and it's also against project policy because it'd be quite unfriendly behavior if

pgsql: Fix MSVC build

2023-01-11 Thread Peter Eisentraut
Fix MSVC build for commit c96de2ce1782116bd0489b1cd69ba88189a495e8 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c971a5b27ac946e7c94f7f655d321279512c7ee7 Modified Files -- src/tools/msvc/Mkvcbuild.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-

pgsql: Common function for percent placeholder replacement

2023-01-11 Thread Peter Eisentraut
Common function for percent placeholder replacement There are a number of places where a shell command is constructed with percent-placeholders (like %x). It's cumbersome to have to open-code this several times. This factors out this logic into a separate function. This also allows us to ensure