pgsql: Fix typo

2024-05-13 Thread Alvaro Herrera
Fix typo Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/11c1984cccad1d41f461d3bb00f9e662332d002b Modified Files -- doc/src/sgml/catalogs.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Revert structural changes to not-null constraints

2024-05-13 Thread Alvaro Herrera
Revert structural changes to not-null constraints There are some problems with the new way to handle these constraints that were detected at the last minute, and require fixes that appear too invasive to be doing this late in the cycle. Revert this (again) for now, we'll try again with these

pgsql: Fix test case to do what it intends to

2024-05-13 Thread Alvaro Herrera
Fix test case to do what it intends to This test case intended to fail because setting a column as generated to the partitioned table while leaving the partition alone is not allowed; but instead failed because of a discrepancy of not-null constraint. Fix this by adding the not-null constraint

pgsql: Fix inconsistencies in error messages

2024-05-09 Thread Alvaro Herrera
Fix inconsistencies in error messages Reported by Kyotaro Horiguchi Also some comments mentioning wrong version numbers, spotted by Justin Pryzby. Discussion: https://postgr.es/m/20240507.171724.750916195320223609.horikyota@gmail.com Discussion:

Re: pgsql: Revert "Skip .DS_Store files in server side utils"

2024-05-06 Thread Alvaro Herrera
On 2024-Feb-13, Daniel Gustafsson wrote: > Revert "Skip .DS_Store files in server side utils" > > This reverts commit aeee173d229232f94acc61e7bfe81d40f56e478e. > Per failure reports from the buildfarm. I think you jumped the gun on this one. As far as I can tell, the problem was this:

pgsql: Remove mention of nchar

2024-05-06 Thread Alvaro Herrera
Remove mention of nchar This datatype is purposefully not documented. Erik Wienhold Discussion: https://postgr.es/m/om3g7p7u3ztlrdp4tfswgulavljgn2fe6u2agk34mrr65dffuu@cpzlzuv6flko Branch -- master Details ---

pgsql: Remove mention of nchar

2024-05-06 Thread Alvaro Herrera
Remove mention of nchar This datatype is purposefully not documented. Erik Wienhold Discussion: https://postgr.es/m/om3g7p7u3ztlrdp4tfswgulavljgn2fe6u2agk34mrr65dffuu@cpzlzuv6flko Branch -- REL_16_STABLE Details ---

pgsql: Disallow direct change of NO INHERIT of not-null constraints

2024-05-02 Thread Alvaro Herrera
Disallow direct change of NO INHERIT of not-null constraints We support changing NO INHERIT constraint to INHERIT for constraints in child relations when adding a constraint to some ancestor relation, and also during pg_upgrade's schema restore; but other than those special cases, command ALTER

pgsql: Disallow NO INHERIT not-null constraints on partitioned tables

2024-05-02 Thread Alvaro Herrera
Disallow NO INHERIT not-null constraints on partitioned tables Such constraints are semantically useless and only bring weird cases along, so reject them. As a side effect, we can no longer have "throwaway" constraints in pg_dump for primary keys in partitioned tables, but since they don't serve

pgsql: Skip invalid database pg_upgrade test on obsolete servers

2024-05-01 Thread Alvaro Herrera
Skip invalid database pg_upgrade test on obsolete servers When testing pg_upgrade against an old server, ignore failures on the check to upgrade invalid databases. This is necessary because old servers don't know to raise the appropriate error of the database being invalid. This change causes

pgsql: Skip invalid database pg_upgrade test on obsolete servers

2024-05-01 Thread Alvaro Herrera
Skip invalid database pg_upgrade test on obsolete servers When testing pg_upgrade against an old server, ignore failures on the check to upgrade invalid databases. This is necessary because old servers don't know to raise the appropriate error of the database being invalid. This change causes

pgsql: Better handle indirect constraint drops

2024-04-19 Thread Alvaro Herrera
Better handle indirect constraint drops It is possible for certain cases to remove not-null constraints without maintaining the attnotnull in its correct state; for example if you drop a column that's part of the primary key, and the other columns of the PK don't have not-null constraints, then

pgsql: Don't try to assign smart names to constraints

2024-04-18 Thread Alvaro Herrera
Don't try to assign smart names to constraints This part of my previous commit seems to have broken pg_upgrade on crake, at least from 9.2. I'll see if there's a better fix, but in the meantime this should suffice to keep the buildfarm green. Branch -- master Details ---

Re: pgsql: Fix restore of not-null constraints with inheritance

2024-04-18 Thread Alvaro Herrera
On 2024-Apr-18, Alvaro Herrera wrote: > Lastly, make two changes to pg_dump: 1) do not try to drop a not-null > constraint that's marked as inherited; this allows a dump to restore > with no errors if a table with a PK inherits from another which also has > a PK; 2) avoid givi

pgsql: Fix restore of not-null constraints with inheritance

2024-04-18 Thread Alvaro Herrera
Fix restore of not-null constraints with inheritance In tables with primary keys, pg_dump creates tables with primary keys by initially dumping them with throw-away not-null constraints (marked "no inherit" so that they don't create problems elsewhere), to later drop them once the primary key is

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: 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

pgsql: Use conditional variable to wait for next MultiXact offset

2024-04-07 Thread Alvaro Herrera
Use conditional variable to wait for next MultiXact offset In one multixact.c edge case, we need a mechanism to wait for one multixact offset to be written before being allowed to read the next one. We used to handle this case by sleeping for one millisecond and retrying, but such sleeps have

pgsql: Add XLogCtl->logInsertResult

2024-04-07 Thread Alvaro Herrera
Add XLogCtl->logInsertResult This tracks the position of WAL that's been fully copied into WAL buffers by all processes emitting WAL. (For some reason we call that "WAL insertion"). This is updated using atomic monotonic advance during WaitXLogInsertionsToFinish, which is not when the

pgsql: Make libpqsrv_cancel's return const char *, not char *

2024-04-05 Thread Alvaro Herrera
Make libpqsrv_cancel's return const char *, not char * Per headerscheck's C++ check. Discussion: https://postgr.es/m/372769.1712179...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b8b37e41ba4aae1e79dcfaeb9eb0fd7549773ff5 Modified Files

pgsql: Operate XLogCtl->log{Write,Flush}Result with atomics

2024-04-05 Thread Alvaro Herrera
Operate XLogCtl->log{Write,Flush}Result with atomics This removes the need to hold both the info_lck spinlock and WALWriteLock to update them. We use stock atomic write instead, with WALWriteLock held. Readers can use atomic read, without any locking. This allows for some code to be reordered:

pgsql: Split XLogCtl->LogwrtResult into separate struct members

2024-04-03 Thread Alvaro Herrera
Split XLogCtl->LogwrtResult into separate struct members After this change we have XLogCtl->logWriteResult and ->logFlushResult. There's no functional change, other than the fact that the assignment from shared memory to local is no longer done via struct assignment, but instead using a macro

pgsql: Fix zeroing of pg_serial page without SLRU bank lock

2024-04-03 Thread Alvaro Herrera
Fix zeroing of pg_serial page without SLRU bank lock Bug in commit 53c2a97a9266: we failed to acquire the correct SLRU bank lock when iterating to zero-out intermediate pages in predicate.c. Rewrite the code block so that we follow the locking protocol correctly. Also update an outdated comment

pgsql: Don't use the pg_am system catalog in new test

2024-04-02 Thread Alvaro Herrera
Don't use the pg_am system catalog in new test This causes deadlocks because it's a highly trafficked catalog. Use a regular table created by the same test instead. Discussion: https://postgr.es/m/f3e61e27-19d0-5e40-3eb2-53282fa05...@gmail.com Branch -- master Details ---

pgsql: Stabilize postgres_fdw test

2024-03-30 Thread Alvaro Herrera
Stabilize postgres_fdw test The test fails when RESET statement_timeout takes longer than 10ms. Avoid the problem by using SET LOCAL instead. Overall, this test is not ideal: 10ms could be shorter than the time to have sent the query to the "remote" server, so it's possible that on some machines

pgsql: doc: Improve "Partition Maintenance" section

2024-03-30 Thread Alvaro Herrera
doc: Improve "Partition Maintenance" section This adds some reference links and clarifies the wording a bit. Author: Robert Treat Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/CABV9wwNGn-pweak6_pvL5PJ1mivDNPKfg0Tck_1oTUETv5Y=d...@mail.gmail.com Branch -- master Details

pgsql: ALTER TABLE: rework determination of access method ID

2024-03-28 Thread Alvaro Herrera
ALTER TABLE: rework determination of access method ID Avoid setting an access method OID for relation kinds that don't take one. Code review for new feature added in 374c7a229042. Author: Justin Pryzby Reported-by: Alexander Lakhin Discussion:

pgsql: Remove translation markers from libpq-be-fe-helpers.h

2024-03-28 Thread Alvaro Herrera
Remove translation markers from libpq-be-fe-helpers.h Apparently these markers cause the modules to not link correctly in some platforms, at least per buildfarm member indri; moreover, this code is only used in modules that don't have a translation. If we someday add i18n support to contrib/ it

pgsql: libpq-be-fe-helpers.h: wrap new cancel APIs

2024-03-28 Thread Alvaro Herrera
libpq-be-fe-helpers.h: wrap new cancel APIs Commit 61461a300c1c introduced new functions to libpq for cancelling queries. This commit introduces a helper function that backend-side libraries and extensions can use to invoke those. This function takes a timeout and can itself be interrupted

pgsql: Allow specifying an access method for partitioned tables

2024-03-25 Thread Alvaro Herrera
Allow specifying an access method for partitioned tables It's now possible to specify a table access method via CREATE TABLE ... USING for a partitioned table, as well change it with ALTER TABLE ... SET ACCESS METHOD. Specifying an AM for a partitioned table lets the value be used for all future

Re: pgsql: Do not translate dummy SpecialJoinInfos for child joins

2024-03-25 Thread Alvaro Herrera
On 2024-Mar-25, Amit Langote wrote: > I noticed a failure that I don't know what to make of after this and > the other commit (5278d0a2e) reached the buildfarm animal morepork: > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=morepork=2024-03-25%2009%3A30%3A38 > > In file included

pgsql: Review wording on tablespaces w.r.t. partitioned tables

2024-03-20 Thread Alvaro Herrera
Review wording on tablespaces w.r.t. partitioned tables Remove a redundant comment, and document pg_class.reltablespace properly in catalogs.sgml. After commits a36c84c3e4a9, 87259588d0ab and others. Backpatch to 12. Discussion: https://postgr.es/m/202403191013.w2kr7wqlamqz@alvherre.pgsql

pgsql: Review wording on tablespaces w.r.t. partitioned tables

2024-03-20 Thread Alvaro Herrera
Review wording on tablespaces w.r.t. partitioned tables Remove a redundant comment, and document pg_class.reltablespace properly in catalogs.sgml. After commits a36c84c3e4a9, 87259588d0ab and others. Backpatch to 12. Discussion: https://postgr.es/m/202403191013.w2kr7wqlamqz@alvherre.pgsql

pgsql: Review wording on tablespaces w.r.t. partitioned tables

2024-03-20 Thread Alvaro Herrera
Review wording on tablespaces w.r.t. partitioned tables Remove a redundant comment, and document pg_class.reltablespace properly in catalogs.sgml. After commits a36c84c3e4a9, 87259588d0ab and others. Backpatch to 12. Discussion: https://postgr.es/m/202403191013.w2kr7wqlamqz@alvherre.pgsql

pgsql: Review wording on tablespaces w.r.t. partitioned tables

2024-03-20 Thread Alvaro Herrera
Review wording on tablespaces w.r.t. partitioned tables Remove a redundant comment, and document pg_class.reltablespace properly in catalogs.sgml. After commits a36c84c3e4a9, 87259588d0ab and others. Backpatch to 12. Discussion: https://postgr.es/m/202403191013.w2kr7wqlamqz@alvherre.pgsql

pgsql: Review wording on tablespaces w.r.t. partitioned tables

2024-03-20 Thread Alvaro Herrera
Review wording on tablespaces w.r.t. partitioned tables Remove a redundant comment, and document pg_class.reltablespace properly in catalogs.sgml. After commits a36c84c3e4a9, 87259588d0ab and others. Backpatch to 12. Discussion: https://postgr.es/m/202403191013.w2kr7wqlamqz@alvherre.pgsql

pgsql: Review wording on tablespaces w.r.t. partitioned tables

2024-03-20 Thread Alvaro Herrera
Review wording on tablespaces w.r.t. partitioned tables Remove a redundant comment, and document pg_class.reltablespace properly in catalogs.sgml. After commits a36c84c3e4a9, 87259588d0ab and others. Backpatch to 12. Discussion: https://postgr.es/m/202403191013.w2kr7wqlamqz@alvherre.pgsql

pgsql: Rework lwlocknames.txt to become lwlocklist.h

2024-03-20 Thread Alvaro Herrera
Rework lwlocknames.txt to become lwlocklist.h This way, we can fold the list of lock names to occur in BuiltinTrancheNames instead of having its own separate array. This saves two lines of code in GetLWTrancheName and some space in BuiltinTrancheNames, as foreseen in commit 74a730631065, as well

pgsql: dblink/isolationtester/fe_utils: Use new cancel API

2024-03-18 Thread Alvaro Herrera
dblink/isolationtester/fe_utils: Use new cancel API Commit 61461a300c1c introduced new functions to libpq for cancelling queries. This replaces the usage of the old ones in parts of the codebase with these newer ones. This specifically leaves out changes to psql and pgbench, as those would need

pgsql: Put libpq_pipeline cancel test back

2024-03-18 Thread Alvaro Herrera
Put libpq_pipeline cancel test back I disabled it in cc6e64afda53 because it was unstable; hopefully the changes here make it more stable. (Jelte proposed to submit the queries using simple query protocol, but I chose to instead make the monitor connection wait until the PgSleep wait event is

pgsql: Comment out noisy libpq_pipeline test

2024-03-14 Thread Alvaro Herrera
Comment out noisy libpq_pipeline test libpq_pipeline's new 'cancel' test needs more research; disable it temporarily to prevent measles in the buildfarm. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/cc6e64afda530576d83e331365d36c758495a7cd Modified Files

pgsql: Hopefully make libpq_pipeline's new cancel test more reliable

2024-03-13 Thread Alvaro Herrera
Hopefully make libpq_pipeline's new cancel test more reliable The newly introduced cancel test in libpq_pipeline was flaky. It's not completely clear why, but one option is that the check for "active" was actually seeing the active state for the previous query. This change should address any such

pgsql: libpq: Add encrypted and non-blocking query cancellation routine

2024-03-12 Thread Alvaro Herrera
libpq: Add encrypted and non-blocking query cancellation routines The existing PQcancel API uses blocking IO, which makes PQcancel impossible to use in an event loop based codebase without blocking the event loop until the call returns. It also doesn't encrypt the connection over which the

pgsql: libpq: Move pg_cancel to fe-cancel.c

2024-03-12 Thread Alvaro Herrera
libpq: Move pg_cancel to fe-cancel.c No other files need to access this struct, so there is no need to have its definition in a header file. Author: Jelte Fennema-Nio Discussion: https://postgr.es/m/202403061822.spfzqbf7dsgg@alvherre.pgsql Branch -- master Details ---

pgsql: Add tests for libpq query cancellation APIs

2024-03-11 Thread Alvaro Herrera
Add tests for libpq query cancellation APIs This is in preparation of making changes and additions to these APIs. Author: Jelte Fennema-Nio Discussion: https://postgr.es/m/CAGECzQRb21spiiykQ48rzz8w+Hcykz+mB2_hxR65D9Qk6nnw=w...@mail.gmail.com Branch -- master Details ---

pgsql: Add missing connection statuses to docs

2024-03-11 Thread Alvaro Herrera
Add missing connection statuses to docs The list of connection statuses that PQstatus might return during an asynchronous connection attempt was outdated: 1. CONNECTION_SETENV is never returned anymore and is only part of the enum for backwards compatibility, so remove it from the docs. 2.

pgsql: Admit deferrable PKs into rd_pkindex, but flag them as such

2024-03-08 Thread Alvaro Herrera
Admit deferrable PKs into rd_pkindex, but flag them as such ... and in particular don't return them as replica identity. The motivation for this change is letting the primary keys be seen by code that derives NOT NULL constraints from them, when creating inheritance children; before this change,

Re: pgsql: Add template for adaptive radix tree

2024-03-07 Thread Alvaro Herrera
On 2024-Mar-07, John Naylor wrote: > Understandably so. FWIW, the use case proposed by the authors was for > secondary indexes within in-memory databases, not as a type of > associative array. I'm unable to find patents for the thing itself, > but IANAL. I believe I've been in contact with some

pgsql: Fix misspelled assertions

2024-03-05 Thread Alvaro Herrera
Fix misspelled assertions Remove an extra & operator, per Tom Lane. My bugs, introduced with commit 53c2a97a9266. Discussion: https://postgr.es/m/3885480.1709590...@sss.pgh.pa.us Branch -- master Details ---

pgsql: Rework redundant code in subtrans.c

2024-03-05 Thread Alvaro Herrera
Rework redundant code in subtrans.c When this code was written the duplicity didn't matter, but with all the SLRU-bank stuff we just added, it has become excessive. Turn it into a simpler loop with no code duplication. Also add a test so that this code becomes covered. Discussion:

pgsql: Rework locking code in GetMultiXactIdMembers

2024-03-04 Thread Alvaro Herrera
Rework locking code in GetMultiXactIdMembers After commit 53c2a97a9266, the code flow around the "retry" goto label in GetMultiXactIdMembers was confused about what was possible: we never return there with a held lock, so there's no point in testing for one. This realization lets us simplify the

pgsql: Simplify coding in slru.c

2024-03-04 Thread Alvaro Herrera
Simplify coding in slru.c New code in 53c2a97a9266 uses direct array access to shared->bank_locks[bankno].lock which can be made a little bit more legible by using the SimpleLruGetBankLock helper function. Nothing terribly serious, but let's add some clarity. Discussion:

Re: pgsql: Remove the adminpack contrib extension

2024-03-04 Thread Alvaro Herrera
On 2024-Mar-04, Daniel Gustafsson wrote: > The pg_upgrade Xversion test on crake failed on this, I'm trying to reproduce > the cross-version test locally to verify the below diff but it's right now > failing on an unrelated thing. What unrelated thing? I suggest to try to initdb the old version

pgsql: GUC table: Add description to computed variables

2024-03-03 Thread Alvaro Herrera
GUC table: Add description to computed variables Per suggestion from Kyotaro Horiguchi Discussion: https://postgr.es/m/20240229.130404.1411153273308142188.horikyota@gmail.com Branch -- master Details ---

pgsql: Improve performance of subsystems on top of SLRU

2024-02-28 Thread Alvaro Herrera
Improve performance of subsystems on top of SLRU More precisely, what we do here is make the SLRU cache sizes configurable with new GUCs, so that sites with high concurrency and big ranges of transactions in flight (resp. multixacts/subtransactions) can benefit from bigger caches. In order for

pgsql: Rename SLRU elements in view pg_stat_slru

2024-02-28 Thread Alvaro Herrera
Rename SLRU elements in view pg_stat_slru The new names are intended to match those in an upcoming patch that adds a few GUCs to configure the SLRU buffer sizes. Backwards compatibility concern: this changes the accepted names for function pg_stat_slru_rest(). Since this function recognizes

pgsql: Revise MERGE documentation

2024-02-26 Thread Alvaro Herrera
Revise MERGE documentation Add a note about the additional privileges required after the fix in 4989ce72644b (wording per Tom Lane); also change marked-up mentions of "target_table_name" to be simply "the target table" or the like. Also, note that "join_condition" is scouted for requisite

pgsql: Revise MERGE documentation

2024-02-26 Thread Alvaro Herrera
Revise MERGE documentation Add a note about the additional privileges required after the fix in 4989ce72644b (wording per Tom Lane); also change marked-up mentions of "target_table_name" to be simply "the target table" or the like. Also, note that "join_condition" is scouted for requisite

pgsql: Revise MERGE documentation

2024-02-26 Thread Alvaro Herrera
Revise MERGE documentation Add a note about the additional privileges required after the fix in 4989ce72644b (wording per Tom Lane); also change marked-up mentions of "target_table_name" to be simply "the target table" or the like. Also, note that "join_condition" is scouted for requisite

pgsql: slru.c: Reduce scope of variables in 'for' blocks

2024-02-26 Thread Alvaro Herrera
slru.c: Reduce scope of variables in 'for' blocks Pretty boring. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5f79cb7629a4ce6321f509694ebf475a931608b6 Modified Files -- src/backend/access/transam/slru.c | 33 +++-- 1 file

pgsql: MERGE ... DO NOTHING: require SELECT privileges

2024-02-21 Thread Alvaro Herrera
MERGE ... DO NOTHING: require SELECT privileges Verify that a user running MERGE with a DO NOTHING clause has privileges to read the table, even if no columns are referenced. Such privileges were already required if the ON clause or any of the WHEN conditions referenced any column at all, so

pgsql: Fix typo

2024-02-21 Thread Alvaro Herrera
Fix typo Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ed345c2728b3ebc160d8335464765679a08031b9 Modified Files -- src/backend/tcop/postgres.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: MERGE ... DO NOTHING: require SELECT privileges

2024-02-21 Thread Alvaro Herrera
MERGE ... DO NOTHING: require SELECT privileges Verify that a user running MERGE with a DO NOTHING clause has privileges to read the table, even if no columns are referenced. Such privileges were already required if the ON clause or any of the WHEN conditions referenced any column at all, so

pgsql: MERGE ... DO NOTHING: require SELECT privileges

2024-02-21 Thread Alvaro Herrera
MERGE ... DO NOTHING: require SELECT privileges Verify that a user running MERGE with a DO NOTHING clause has privileges to read the table, even if no columns are referenced. Such privileges were already required if the ON clause or any of the WHEN conditions referenced any column at all, so

pgsql: Update PQparameterStatus and ParameterStatus docs

2024-02-07 Thread Alvaro Herrera
Update PQparameterStatus and ParameterStatus docs Cover scram_iterations, which was added in commit b577743000cd. While at it, turn the list into a with 2 columns, which is much nicer to read. In master, remove mentions of antediluvian versions before which some parameters were not reported.

pgsql: Update PQparameterStatus and ParameterStatus docs

2024-02-07 Thread Alvaro Herrera
Update PQparameterStatus and ParameterStatus docs Cover scram_iterations, which was added in commit b577743000cd. While at it, turn the list into a with 2 columns, which is much nicer to read. In master, remove mentions of antediluvian versions before which some parameters were not reported.

pgsql: Change initial use of pg_atomic_write_u64 to init

2024-02-06 Thread Alvaro Herrera
Change initial use of pg_atomic_write_u64 to init This only matters when using atomics emulation with semaphores. Per buildfarm member rorqual. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e4b27b53552c19c50b3ca00b697a1f745c247d0d Modified Files --

Re: pgsql: Use atomic access for SlruShared->latest_page_number

2024-02-06 Thread Alvaro Herrera
On 2024-Feb-06, Alvaro Herrera wrote: > Use atomic access for SlruShared->latest_page_number rorqual failed (--disable-atomics --disable-spinlocks). Looking into it ... -- Álvaro HerreraBreisgau, Deutschland — https://www.EnterpriseDB.com/ "Nunca se desea ardientemente

pgsql: Use atomic access for SlruShared->latest_page_number

2024-02-06 Thread Alvaro Herrera
Use atomic access for SlruShared->latest_page_number The new concurrency model proposed for slru.c to improve performance does not include any single lock that would coordinate processes doing concurrent reads/writes on SlruShared->latest_page_number. We can instead use atomic reads and writes

pgsql: libpq: Change some static functions to extern

2024-02-04 Thread Alvaro Herrera
libpq: Change some static functions to extern This is in preparation of a follow up commit that starts using these functions from fe-cancel.c. Author: Jelte Fennema-Nio Discussion: https://postgr.es/m/am5pr83mb0178d3b31ca1b6ec4a8ecc42f7...@am5pr83mb0178.eurprd83.prod.outlook.com Branch --

pgsql: libpq: Add pqReleaseConnHosts function

2024-02-04 Thread Alvaro Herrera
libpq: Add pqReleaseConnHosts function In a follow up commit we'll need to free this connhost field in a function defined in fe-cancel.c, so here we extract the logic to a dedicated extern function. Author: Jelte Fennema-Nio Discussion:

pgsql: Fix copy typo in comment

2024-01-31 Thread Alvaro Herrera
Fix copy typo in comment Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/402388946fb3ac54f0fd5944d7e177ef7737eab2 Modified Files -- src/backend/storage/lmgr/lwlock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

pgsql: Update pg_walsummary copyright notices to 2024

2024-01-31 Thread Alvaro Herrera
Update pg_walsummary copyright notices to 2024 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f0106b6d2dc28660d9ecba3de77cee14de921c94 Modified Files -- src/bin/pg_walsummary/Makefile| 2 +- src/bin/pg_walsummary/meson.build | 2 +-

pgsql: Split use of SerialSLRULock, creating SerialControlLock

2024-01-30 Thread Alvaro Herrera
Split use of SerialSLRULock, creating SerialControlLock predicate.c has been using SerialSLRULock (the control lock for its SLRU structure) to coordinate access to SerialControlData, another of its numerous shared memory structures; this is unnecessary and confuses further SLRU scalability work.

pgsql: Add EXPLAIN (MEMORY) to report planner memory consumption

2024-01-29 Thread Alvaro Herrera
Add EXPLAIN (MEMORY) to report planner memory consumption This adds a new "Memory:" line under the "Planning:" group (which currently only has "Buffers:") when the MEMORY option is specified. In order to make the reporting reasonably accurate, we create a separate memory context for planner

pgsql: libpq: Move cancellation related functions to fe-cancel.c

2024-01-29 Thread Alvaro Herrera
libpq: Move cancellation related functions to fe-cancel.c In follow up commits we'll add more functions related to query cancellations. This groups those all together instead of mixing them with the other functions in fe-connect.c. The formerly static parse_int_param() function had to be

pgsql: Make spelling of cancelled/cancellation consistent

2024-01-26 Thread Alvaro Herrera
Make spelling of cancelled/cancellation consistent This fixes places where words derived from cancel were not using their common en-US ugly^H^H^H^Hspelling. Author: Jelte Fennema-Nio Reported-by: Thomas Munro Discussion:

pgsql: Remove dummy_spinlock

2024-01-25 Thread Alvaro Herrera
Remove dummy_spinlock It's been unused since 1b468a131bd2 (2015). Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/55627ba2d334ce98e1f5916354c46472d414bda6 Modified Files -- src/backend/main/main.c | 6 -- src/backend/storage/lmgr/s_lock.c

pgsql: Fix s_lock_test compile

2024-01-25 Thread Alvaro Herrera
Fix s_lock_test compile This is a mostly unused tool, but I discovered while nosing around the Makefile that it hasn't been kept in line with other changes. Fix it. Backpatching doesn't appear to be necessary. Discussion: https://postgr.es/m/202401241114.ied53jcich72@alvherre.pgsql Branch

pgsql: Improve notation of BuiltinTrancheNames

2024-01-24 Thread Alvaro Herrera
Improve notation of BuiltinTrancheNames Use C99 designated initializer syntax for array elements, instead of writing the position in a comment. This is less verbose and much more readable. Akin to cc150596341e. One disadvantage is that the BuiltinTrancheNames array now has a hole of 51 NULLs

pgsql: Abort pgbench if script end is reached with an open pipeline

2024-01-22 Thread Alvaro Herrera
Abort pgbench if script end is reached with an open pipeline When a pipeline is opened with \startpipeline and not closed, pgbench will either error on the next transaction with a "already in pipeline mode" error or successfully end if this was the last transaction -- despite not sending anything

pgsql: Abort pgbench if script end is reached with an open pipeline

2024-01-22 Thread Alvaro Herrera
Abort pgbench if script end is reached with an open pipeline When a pipeline is opened with \startpipeline and not closed, pgbench will either error on the next transaction with a "already in pipeline mode" error or successfully end if this was the last transaction -- despite not sending anything

pgsql: Abort pgbench if script end is reached with an open pipeline

2024-01-22 Thread Alvaro Herrera
Abort pgbench if script end is reached with an open pipeline When a pipeline is opened with \startpipeline and not closed, pgbench will either error on the next transaction with a "already in pipeline mode" error or successfully end if this was the last transaction -- despite not sending anything

pgsql: Abort pgbench if script end is reached with an open pipeline

2024-01-22 Thread Alvaro Herrera
Abort pgbench if script end is reached with an open pipeline When a pipeline is opened with \startpipeline and not closed, pgbench will either error on the next transaction with a "already in pipeline mode" error or successfully end if this was the last transaction -- despite not sending anything

pgsql: Test EXPLAIN (FORMAT JSON) ... XMLTABLE

2024-01-22 Thread Alvaro Herrera
Test EXPLAIN (FORMAT JSON) ... XMLTABLE Also, add an alias to the XMLTABLE expression in an existing test. This covers some code in explain.c that wasn't previously covered. I patched xml_2.out blindly :-( Discussion: https://postgr.es/m/202401181146.fuoeskfzriq7@alvherre.pgsql Branch --

pgsql: Rework text in replication slots documentation

2024-01-18 Thread Alvaro Herrera
Rework text in replication slots documentation This is cosmetic, so no backpatch. Reviewed-by: Bharath Rupireddy Discussion: https://postgr.es/m/20230413111838.e7yxke2dtwrxw3qy@alvherre.pgsql Discussion: https://postgr.es/m/202401151537.ryhysqfncs6d@alvherre.pgsql Branch -- master Details

pgsql: struct XmlTableRoutine: use C99 designated initializers

2024-01-16 Thread Alvaro Herrera
struct XmlTableRoutine: use C99 designated initializers As in c27f8621eed et al. Not as critical as other cases we've handled, but I figure if we're going to add JsonbTableRoutine using TableFuncRoutine, this makes it easier to jump around the code. Branch -- master Details ---

pgsql: Don't test already-referenced pointer for nullness

2024-01-16 Thread Alvaro Herrera
Don't test already-referenced pointer for nullness Commit b8ba7344e9eb added in PQgetResult a derefence to a pointer returned by pqPrepareAsyncResult(), before some other code that was already testing that pointer for nullness. But since commit 618c16707a6d (in Postgres 15),

pgsql: Don't test already-referenced pointer for nullness

2024-01-16 Thread Alvaro Herrera
Don't test already-referenced pointer for nullness Commit b8ba7344e9eb added in PQgetResult a derefence to a pointer returned by pqPrepareAsyncResult(), before some other code that was already testing that pointer for nullness. But since commit 618c16707a6d (in Postgres 15),

pgsql: Don't test already-referenced pointer for nullness

2024-01-16 Thread Alvaro Herrera
Don't test already-referenced pointer for nullness Commit b8ba7344e9eb added in PQgetResult a derefence to a pointer returned by pqPrepareAsyncResult(), before some other code that was already testing that pointer for nullness. But since commit 618c16707a6d (in Postgres 15),

pgsql: Don't test already-referenced pointer for nullness

2024-01-16 Thread Alvaro Herrera
Don't test already-referenced pointer for nullness Commit b8ba7344e9eb added in PQgetResult a derefence to a pointer returned by pqPrepareAsyncResult(), before some other code that was already testing that pointer for nullness. But since commit 618c16707a6d (in Postgres 15),

pgsql: Avoid useless ReplicationOriginExitCleanup locking

2024-01-15 Thread Alvaro Herrera
Avoid useless ReplicationOriginExitCleanup locking When session_replication_state is NULL, we can know there's nothing to do with no lock acquisition. Do that. Author: Bharath Rupireddy Discussion: https://postgr.es/m/calj2acx+yaeru5xjqr4c7klsto_f7dbrnf8wgehvjzcktnu...@mail.gmail.com Branch

pgsql: Add empty placeholder LINGUAS file for pg_walsummary

2024-01-12 Thread Alvaro Herrera
Add empty placeholder LINGUAS file for pg_walsummary Like bbf1f1340800. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2f696d5a290229a95fd80e351e4e6ecf8d4a Modified Files -- src/bin/pg_walsummary/po/LINGUAS | 0 1 file changed, 0 insertions(+), 0

pgsql: Added literal tag for RETURNING

2024-01-12 Thread Alvaro Herrera
Added literal tag for RETURNING This is an old mistake (92e38182d7c8); backpatch all the way back. Author: Atsushi Torikoshi Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/c0aa00b60a16c0ea2a4c5123b013a...@oss.nttdata.com Branch -- REL_12_STABLE Details ---

pgsql: Added literal tag for RETURNING

2024-01-12 Thread Alvaro Herrera
Added literal tag for RETURNING This is an old mistake (92e38182d7c8); backpatch all the way back. Author: Atsushi Torikoshi Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/c0aa00b60a16c0ea2a4c5123b013a...@oss.nttdata.com Branch -- REL_16_STABLE Details ---

pgsql: Added literal tag for RETURNING

2024-01-12 Thread Alvaro Herrera
Added literal tag for RETURNING This is an old mistake (92e38182d7c8); backpatch all the way back. Author: Atsushi Torikoshi Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/c0aa00b60a16c0ea2a4c5123b013a...@oss.nttdata.com Branch -- REL_14_STABLE Details ---

pgsql: Added literal tag for RETURNING

2024-01-12 Thread Alvaro Herrera
Added literal tag for RETURNING This is an old mistake (92e38182d7c8); backpatch all the way back. Author: Atsushi Torikoshi Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/c0aa00b60a16c0ea2a4c5123b013a...@oss.nttdata.com Branch -- REL_13_STABLE Details ---

pgsql: Added literal tag for RETURNING

2024-01-12 Thread Alvaro Herrera
Added literal tag for RETURNING This is an old mistake (92e38182d7c8); backpatch all the way back. Author: Atsushi Torikoshi Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/c0aa00b60a16c0ea2a4c5123b013a...@oss.nttdata.com Branch -- REL_15_STABLE Details ---

pgsql: Added literal tag for RETURNING

2024-01-12 Thread Alvaro Herrera
Added literal tag for RETURNING This is an old mistake (92e38182d7c8); backpatch all the way back. Author: Atsushi Torikoshi Reviewed-by: Ashutosh Bapat Discussion: https://postgr.es/m/c0aa00b60a16c0ea2a4c5123b013a...@oss.nttdata.com Branch -- master Details ---

pgsql: Remove useless LIMIT_OPTION_DEFAULT value from LimitOption

2023-12-16 Thread Alvaro Herrera
Remove useless LIMIT_OPTION_DEFAULT value from LimitOption During the development that led to commit 357889eb17bb, for a time we had the value LIMIT_OPTION_DEFAULT, which was mostly but not completely removed later on, before commit. Complete the removal now. Author: Zhang Mingli Discussion:

  1   2   3   4   5   6   7   8   9   10   >