Re: Conflict detection for update_deleted in logical replication

2025-01-07 Thread Nisha Moond
On Tue, Jan 7, 2025 at 6:04 PM Zhijie Hou (Fujitsu) wrote: > > > Attached the V19 patch which addressed comments in [1][2][3][4][5][6][7]. > Here are a couple of initial review comments on v19 patch set: 1) The subscription option 'retain_conflict_info' remains set to "true" for a subscription e

Re: POC: enable logical decoding when wal_level = 'replica' without a server restart

2025-01-07 Thread Peter Smith
Hi Sawada-San. FWIW, I also thought it was a good idea suggested by Bertrand [1] to "hide" everything behind the slot create/delete, and thereby eliminate the need for user intervention using those new pg_activate/deactivate_logical_decoding functions. But, one concern doing it this way is how to

Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row

2025-01-07 Thread Kirill Reshke
Thank you for your update. On Fri, 13 Dec 2024 at 08:15, jian he wrote: > > + /* > + * Here we end processing of current COPY row. > + * Update copy state counter for number of erroneous rows. > + */ > + cstate->num_errors++; > + cstate->escontext->error_occurred = true; > + > + /* Only print thi

Re: Conflict detection for update_deleted in logical replication

2025-01-07 Thread vignesh C
On Tue, 7 Jan 2025 at 18:04, Zhijie Hou (Fujitsu) wrote: > > On Friday, January 3, 2025 1:53 PM Amit Kapila > wrote: > > > > On Wed, Dec 25, 2024 at 8:13 AM Zhijie Hou (Fujitsu) > > wrote: > > > > > > Attach the new version patch set which addressed all other comments. > > > > > > > Some more m

Re: PoC: history of recent vacuum/checkpoint runs (using new hooks)

2025-01-07 Thread Bertrand Drouvot
Hi, On Tue, Jan 07, 2025 at 10:19:36PM +0100, Tomas Vondra wrote: > On 1/7/25 21:42, Robert Treat wrote: > > On Tue, Jan 7, 2025 at 10:44 AM Bertrand Drouvot > > wrote: > >> > >> ... > >> > >> Another idea regarding the storage of those metrics: I think that one would > >> want to see "precise" d

Re: per backend WAL statistics

2025-01-07 Thread Michael Paquier
On Tue, Jan 07, 2025 at 08:48:51AM +, Bertrand Drouvot wrote: > Now that commit 9aea73fc61 added backend-level statistics to pgstats (and > per backend IO statistics), we can more easily add per backend statistics. > > Please find attached a patch to implement $SUBJECT. I've looked at v1-0002

Re: Adding OLD/NEW support to RETURNING

2025-01-07 Thread jian he
hi. two minor issues. if (qry->returningList == NIL) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("RETURNING must have at least one column"), parser_errposition(pstate, exprLocation(linitial(returningClause->exprs); we ca

Re: Unsafe access BufferDescriptors array in BufferGetLSNAtomic()

2025-01-07 Thread Xuneng Zhou
Hi Tender, I’ve looked through the patch, and I believe there is a potential issue. The default size for BufferDescriptors appears to be 16,384. Passing and casting a negative buffer ID to a large unsigned integer in GetBufferDescriptor, and then using it as an array subscript, could potentiall

Re: Add “FOR UPDATE NOWAIT” lock details to the log.

2025-01-07 Thread Fujii Masao
On 2024/12/19 17:21, Yuki Seino wrote: [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=3c0fd64fec8ed6fa3987c33f076fcffbc3f268c3 Rebased and added new GUC log_lock_failure and minor fixes. Currently only NOWAIT errors are supported. Thanks for updating the patch! +

Re: Bug in v13 due to "Fix corruption when relation truncation fails."

2025-01-07 Thread Thomas Munro
On Wed, Jan 8, 2025 at 4:31 PM Michael Paquier wrote: > On Thu, Dec 26, 2024 at 01:10:59PM +0300, Yura Sokolov wrote: > > Commit "Fix corruption when relation truncation fails." [0] makes > > smgrtruncate be called in a critical section. Unfortunately in version 13 it > > leads to occasional call

Re: NOT ENFORCED constraint feature

2025-01-07 Thread Triveni N
Hi, I have tested different scenarios involving CHECK constraint with NOT ENFORCED specification on Inherited and Partitioned tables. Additionally, I explored various situations with foreign key constraints. I have also examined how pg_dump, pg_dumpall, pg_basebackup, and pg_upgrade handle NOT ENFO

Re: Converting contrib SQL functions to new style

2025-01-07 Thread Michael Paquier
On Tue, Jan 07, 2025 at 06:52:33PM -0800, Noah Misch wrote: > It's more optimal to write '0'::bigint. That generates a CONST node, whereas > 0::bigint generates a FUNCEXPR calling the cast function. No other concerns. Makes sense, done this way. -- Michael signature.asc Description: PGP signat

Re: Bug in v13 due to "Fix corruption when relation truncation fails."

2025-01-07 Thread Michael Paquier
On Thu, Dec 26, 2024 at 01:10:59PM +0300, Yura Sokolov wrote: > Commit "Fix corruption when relation truncation fails." [0] makes > smgrtruncate be called in a critical section. Unfortunately in version 13 it > leads to occasional call to palloc0 inside of critical section, which > triggers Assert

Re: Converting contrib SQL functions to new style

2025-01-07 Thread Noah Misch
On Wed, Jan 08, 2025 at 11:32:00AM +0900, Michael Paquier wrote: > On Mon, Jan 06, 2025 at 11:04:28AM -0800, Noah Misch wrote: > > Per postgr.es/m/3489827.1618411...@sss.pgh.pa.us and > > postgr.es/m/1471865.1734212...@sss.pgh.pa.us one requirement for migrating > > to > > SQL-standard function bo

Re: Psql meta-command conninfo+

2025-01-07 Thread Sami Imseih
>> I think "Connection Encryption" seems unnecessary here as >> well and it could be added to "Connection Information". > > > Yes, we can do that, but we’d be left with two tables: > "Connection Information" and "Server Parameter Settings". Does that work? After looking at this ever more today, I

Re: Converting contrib SQL functions to new style

2025-01-07 Thread Michael Paquier
On Mon, Jan 06, 2025 at 11:04:28AM -0800, Noah Misch wrote: > Per postgr.es/m/3489827.1618411...@sss.pgh.pa.us and > postgr.es/m/1471865.1734212...@sss.pgh.pa.us one requirement for migrating to > SQL-standard function bodies is removing these inexact-match function and > operator calls. Here, one

Reorder shutdown sequence, to flush pgstats later

2025-01-07 Thread Andres Freund
Hi, In the AIO patchset I just hit a corner case in which IO workers can emit stats ([1]). That in turn can trigger an assertion failure, because by the time the IO workers are shut down, checkpointer already has exited and written out the stats. In this case the relevant IO has completed, but not

Re: Proposal: Progressive explain

2025-01-07 Thread Tomas Vondra
Hi Rafael, This sounds like a great feature, thanks for working on it and sharing the patch. Let me share some comments / questions after a quick review. On 12/30/24 02:18, Rafael Thofehrn Castro wrote: > Hello community, > > CONTEXT: > > Back in October I presented the talk "Debugging active q

Sort functions with specialized comparators

2025-01-07 Thread John Naylor
On Tue, Jan 7, 2025 at 12:59 PM Andrey M. Borodin wrote: > > I'm worried about another case that we cannot measure: PREPAREARR(a) on empty array will return new array. In theory, yes, but it doesn't happen in our regression tests, so it might be worth looking into making that happen before worryi

Re: per backend I/O statistics

2025-01-07 Thread Michael Paquier
On Tue, Jan 07, 2025 at 08:54:59AM +, Bertrand Drouvot wrote: > A dedicated thread and a patch have been created, see [1]. > > [1]: > https://www.postgresql.org/message-id/flat/Z3zqc4o09dM/Ezyz%40ip-10-97-1-34.eu-west-3.compute.internal Hmm. I can see that you have some refactoring pieces i

Re: Memory leak in pg_logical_slot_{get,peek}_changes

2025-01-07 Thread Michael Paquier
On Mon, Dec 30, 2024 at 10:31:20PM +0530, vignesh C wrote: > The attached v3 version has the changes for the same. I have verified > the patch in PG14 and PG13 by attaching to the debugger and calling > "call MemoryContextStats(CacheMemoryContext)" to see there are no > leaks. Sorry for the delay

Re: Switching XLog source from archive to streaming when primary available

2025-01-07 Thread Michael Paquier
On Thu, Jan 02, 2025 at 11:12:37PM +0500, Andrey M. Borodin wrote: > In my observation restore from archive is many orders of magnitude > faster than streaming replication. Advanced archive tools employ > compression (x6 to speed), download parallelism (x4), are not > constrained be primary's netwo

Re: Reduce TupleHashEntryData struct size by half

2025-01-07 Thread Jeff Davis
On Thu, 2024-11-21 at 12:37 -0800, Jeff Davis wrote: > > New patch series attached. I committed the earlier cleanup patches and rebased the rest. Attached. 0001 is not quite as clean as I'd like it to be; suggestions welcome. It does save a pointer per entry, though, which is substantial. Regar

Re: New GUC autovacuum_max_threshold ?

2025-01-07 Thread Nathan Bossart
Here is a rebased patch for cfbot. AFAICT we are still pretty far from consensus on which approach to take, unfortunately. -- nathan >From df17b1f8b18300bc8426c06ab4e4d2d1c9169d85 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Wed, 7 Aug 2024 16:22:37 -0500 Subject: [PATCH v3 1/1] autovacu

Re: Proposal: Progressive explain

2025-01-07 Thread Rafael Thofehrn Castro
Sending rebased version to fix cfbot tests. v3-0001-Proposal-for-progressive-explains.patch Description: Binary data

Re: [PoC] Federated Authn/z with OAUTHBEARER

2025-01-07 Thread Jacob Champion
On Thu, Jan 2, 2025 at 2:11 AM Peter Eisentraut wrote: > There is a mix of using "URL" and "URI" throughout the patch. I tried > to look up in the source material (RFCs) what the correct use would > be, but even they are mixing it in nonobvious ways. Maybe this is > just hopelessly confused, or

Re: [PoC] Federated Authn/z with OAUTHBEARER

2025-01-07 Thread Jacob Champion
On Fri, Dec 20, 2024 at 2:21 PM Daniel Gustafsson wrote: > > > On 20 Dec 2024, at 02:00, Jacob Champion > > wrote: > > Thanks for the new version, I was doing a v39 review but I'll roll that over > into a v40 review now. (Sorry for the rug pull!) > As I was reading I was trying to identify par

Re: Sample rate added to pg_stat_statements

2025-01-07 Thread Ilia Evdokimov
On 07.01.2025 22:29, Sami Imseih wrote: You are right. This is absolutely unexpected for users. Thank you for the review. To fix this, I suggest storing a random number in the [0, 1) range in a separate variable, which will be used for comparisons in any place. We will compare 'sample_rate' an

Re: Recovering from detoast-related catcache invalidations

2025-01-07 Thread Noah Misch
On Tue, Dec 24, 2024 at 12:18:09AM +0200, Heikki Linnakangas wrote: > On 14/12/2024 02:06, Heikki Linnakangas wrote: > > Ok, I missed that. It does not handle the 2nd scenario though: If a new > > catalog tuple is concurrently inserted that should be part of the list, > > it is missed. > > Attache

Re: Small patch to use pqMsg_Query instead of `Q`

2025-01-07 Thread Nathan Bossart
Committed. -- nathan

Re: PoC: history of recent vacuum/checkpoint runs (using new hooks)

2025-01-07 Thread Tomas Vondra
On 1/7/25 21:42, Robert Treat wrote: > On Tue, Jan 7, 2025 at 10:44 AM Bertrand Drouvot > wrote: >> >> ... >> >> Another idea regarding the storage of those metrics: I think that one would >> want to see "precise" data for recent metrics but would probably be fine >> with some >> level of aggrega

Re: Parametrization minimum password lenght

2025-01-07 Thread Nathan Bossart
Committed. -- nathan

Re: Eagerly scan all-visible pages to amortize aggressive vacuum

2025-01-07 Thread Melanie Plageman
On Mon, Dec 23, 2024 at 12:50 PM Melanie Plageman wrote: > > The other "worst case" is just that you always scan and fail to freeze > an extra 3% of the relation while vacuuming the table. This one is > much easier to achieve. As such, it seems worthwhile to add a GUC and > table option to tune th

Re: allow changing autovacuum_max_workers without restarting

2025-01-07 Thread Nathan Bossart
On Tue, Jan 07, 2025 at 02:22:42PM -0500, Tom Lane wrote: > This one WFM. Thanks! Committed, thanks for the report/review. -- nathan

Re: PoC: history of recent vacuum/checkpoint runs (using new hooks)

2025-01-07 Thread Robert Treat
On Tue, Jan 7, 2025 at 10:44 AM Bertrand Drouvot wrote: > > Hi, > > On Wed, Dec 25, 2024 at 06:25:50PM +0100, Tomas Vondra wrote: > > Hi, > > > > On 12/23/24 07:35, wenhui qiu wrote: > > > Hi Tomas > > > This is a great feature. > > > + /* > > > + * Define (or redefine) custom GUC variables.

Re: strangely worded message

2025-01-07 Thread Alvaro Herrera
Hi Amit, On 2024-Dec-16, Amit Langote wrote: > > ERROR: cannot use type %s in RETURNING clause of %s > > DETAIL: Only types json and jsonb are allowed in the RETURNING clause. > I think I'd go with the one you chose. Actually I noticed that the one in JSON_SERIALIZE() already has a different

Re: Coccinelle for PostgreSQL development [2/N]: autoconf support [RESEND]

2025-01-07 Thread Mats Kindahl
On Tue, Jan 7, 2025 at 8:56 PM Daniel Gustafsson wrote: > On 7 Jan 2025, at 20:54, Mats Kindahl wrote: > > On Tue, Jan 7, 2025 at 8:51 PM Daniel Gustafsson wrote: > >> > On 7 Jan 2025, at 20:47, Mats Kindahl wrote: >> >> > This second patch adds support for coccicheck >> >> Forgive me if I'm d

Re: Moving the vacuum GUCs' docs out of the Client Connection Defaults section

2025-01-07 Thread Tom Lane
Nathan Bossart writes: > I haven't reviewed the patch in depth, but I think it's worth considering > whether this change will break any links that work in one version but break > if you change the version number. I believe appendix-obsolete.sgml is > designed to help with that a bit, but I've had

Re: Statistics Import and Export

2025-01-07 Thread Jeff Davis
On Tue, 2025-01-07 at 01:18 -0500, Corey Huinker wrote: > Attached is the latest (and probably last) unified patchset before > parts get spun off into their own threads. In this thread I'm only looking at 0001. Please start a new thread for vacuumdb and extended stats changes. > 0001 - This is th

Re: AIO v2.2

2025-01-07 Thread Heikki Linnakangas
On 07/01/2025 18:11, Andres Freund wrote: The difference between a handle and a reference is useful right now, to have some separation between the functions that can be called by anyone (taking a PgAioHandleRef) and only by the issuer (PgAioHandle). That might better be solved by having a PgAioHa

Re: AIO v2.2

2025-01-07 Thread Robert Haas
On Tue, Jan 7, 2025 at 11:11 AM Andres Freund wrote: > The difference between a handle and a reference is useful right now, to have > some separation between the functions that can be called by anyone (taking a > PgAioHandleRef) and only by the issuer (PgAioHandle). That might better be > solved b

Re: Coccinelle for PostgreSQL development [2/N]: autoconf support [RESEND]

2025-01-07 Thread Daniel Gustafsson
> On 7 Jan 2025, at 20:54, Mats Kindahl wrote: > > On Tue, Jan 7, 2025 at 8:51 PM Daniel Gustafsson > wrote: >> > On 7 Jan 2025, at 20:47, Mats Kindahl > > > wrote: >> >> > This second patch adds support for coccicheck >> >> Forgive me if I'm

Re: Coccinelle for PostgreSQL development [2/N]: autoconf support [RESEND]

2025-01-07 Thread Mats Kindahl
On Tue, Jan 7, 2025 at 8:51 PM Daniel Gustafsson wrote: > > On 7 Jan 2025, at 20:47, Mats Kindahl wrote: > > > This second patch adds support for coccicheck > > Forgive me if I'm daft, but I feel there is a slight lack of context here. > What is coccicheck, what would it do and why would it bene

Re: Coccinelle for PostgreSQL development [2/N]: autoconf support [RESEND]

2025-01-07 Thread Daniel Gustafsson
> On 7 Jan 2025, at 20:47, Mats Kindahl wrote: > This second patch adds support for coccicheck Forgive me if I'm daft, but I feel there is a slight lack of context here. What is coccicheck, what would it do and why would it benefit us to have it? -- Daniel Gustafsson

Coccinelle for PostgreSQL development [4/N]: correcting palloc() use

2025-01-07 Thread Mats Kindahl
This is the first example semantic patch and shows how to capture and fix a common problem. If you use an palloc() to allocate memory for an object (or an array of objects) and by mistake type something like: StringInfoData *info = palloc(sizeof(StringInfoData*)); You will not allocate enoug

Coccinelle for PostgreSQL development [3/N]: meson support

2025-01-07 Thread Mats Kindahl
The third patch adds support to Meson by adding a coccicheck target. Since ninja (which is used in the chapter "Building and Installation with Meson"[1]) does not support variables in the same way as make does, it is currently necessary to use: MODE=patch ninja coccicheck An alternative is to

Coccinelle for PostgreSQL development [2/N]: autoconf support [RESEND]

2025-01-07 Thread Mats Kindahl
Missed the patch in the previous mail. Please ignore. This second patch adds support for coccicheck to configure.ac and related files (in particular Makefile.global.in). At this point, I have deliberately not added support for pgxs so extensions cannot use coccicheck through the PostgreSQL install

Coccinelle for PostgreSQL development [2/N]: autoconf support

2025-01-07 Thread Mats Kindahl
This second patch adds support for coccicheck to configure.ac and related files (in particular Makefile.global.in). At this point, I have deliberately not added support for pgxs so extensions cannot use coccicheck through the PostgreSQL installation. The semantic patches are expected to live in co

Coccinelle for PostgreSQL development [1/N]: coccicheck.py

2025-01-07 Thread Mats Kindahl
I got some time over during the holidays, so I spent some of it doing something I've been thinking about for a while. For those of you that are not aware of it: Coccinelle is a tool for pattern matching and text transformation for C code and can be used for detection of problematic programming pat

Re: Sample rate added to pg_stat_statements

2025-01-07 Thread Sami Imseih
>> You are right. This is absolutely unexpected for users. Thank you for >> the review. >> >> To fix this, I suggest storing a random number in the [0, 1) range in a >> separate variable, which will be used for comparisons in any place. We >> will compare 'sample_rate' and random value not only in

Re: allow changing autovacuum_max_workers without restarting

2025-01-07 Thread Tom Lane
Nathan Bossart writes: > Here's a new version of the patch with some small cosmetic changes > (including more commentary about the formula) and the constant changed to > 6. I'll go commit this shortly. This one WFM. Thanks! regards, tom lane

Re: Moving the vacuum GUCs' docs out of the Client Connection Defaults section

2025-01-07 Thread Tom Lane
Melanie Plageman writes: >> This is my first docs patch that introduces new sections and such, so >> I'm not sure I got the indentation 100% correct (I, of course, tried >> to follow conventions). There really isn't much convention there :-(. The amount of indentation used varies wildly across d

Re: AIO v2.2

2025-01-07 Thread Noah Misch
On Mon, Jan 06, 2025 at 04:40:26PM -0500, Andres Freund wrote: > On 2025-01-06 10:52:20 -0800, Noah Misch wrote: > > On Tue, Dec 31, 2024 at 11:03:33PM -0500, Andres Freund wrote: > - We have pretty no testing for IO errors. Yes, that's remained a gap. I've wondered how much to address this via

Re: Non-text mode for pg_dumpall

2025-01-07 Thread Mahendra Singh Thalor
On Mon, 6 Jan 2025 at 23:05, Nathan Bossart wrote: > > On Thu, Jan 02, 2025 at 02:05:13AM +0530, Mahendra Singh Thalor wrote: > > Here, I am attaching an updated patch. I fixed some bugs of v01 patch and > > did some code cleanup also. > > Thank you for picking this up! I started to review it, bu

Re: Meson bug in detection of 64 atomics

2025-01-07 Thread Thomas Munro
On Wed, Jan 8, 2025 at 2:40 AM Yura Sokolov wrote: > I see: Thomas Munro just missed this place in commit on 2024.12.04 > > Use and for c.h integers. > > https://github.com/postgres/postgres/commit/962da900ac8f0927f1af2fd811ca67fa163c873a > > Вт, 7 янв. 2025 г. в 01:29, Юрий Соколов : >> I found

Re: Modern SHA2- based password hashes for pgcrypto

2025-01-07 Thread Bernd Helmle
Am Samstag, dem 04.01.2025 um 08:19 +0800 schrieb Japin Li: > (gdb) bt > #0  __pthread_kill_implementation (no_tid=0, signo=6, > threadid=) at ./nptl/pthread_kill.c:44 > #1  __pthread_kill_internal (signo=6, threadid=) at > ./nptl/pthread_kill.c:78 > #2  __GI___pthread_kill (threadid=, > signo=sign

Re: Incorrect result of bitmap heap scan.

2025-01-07 Thread Matthias van de Meent
Hi, I've rebased my earlier patch to fix some minor conflicts with the work done on bitmaps in December last year. I've also included Andres' cursor-based isolation test as 0002; which now passes. This should take care of cfbot's misidentification of which patch to test, and thus get CFBot to suc

Re: allow changing autovacuum_max_workers without restarting

2025-01-07 Thread Nathan Bossart
On Mon, Jan 06, 2025 at 10:29:07PM -0500, Tom Lane wrote: > +1 for simplicity ... but on reflection, what do you think about > using max_connections / 6? That would keep autovacuum_worker_slots > at 100 / 6 = 16 for the vast majority of systems. For the worst case > *BSD machines, we'd select 25

Re: Moving the vacuum GUCs' docs out of the Client Connection Defaults section

2025-01-07 Thread Nathan Bossart
On Tue, Jan 07, 2025 at 12:15:17PM -0500, Melanie Plageman wrote: > This is my first docs patch that introduces new sections and such, so > I'm not sure I got the indentation 100% correct (I, of course, tried > to follow conventions). I haven't reviewed the patch in depth, but I think it's worth c

Re: Moving the vacuum GUCs' docs out of the Client Connection Defaults section

2025-01-07 Thread Melanie Plageman
On Tue, Jan 7, 2025 at 12:15 PM Melanie Plageman wrote: > > Cool, I've attached a patch to do this. I left a few of the GUCs under > Resource Consumption (like autovacuum_work_mem and > vacuum_buffer_usage_limit) where they are because it seemed > appropriate. > > This is my first docs patch that

Re: Moving the vacuum GUCs' docs out of the Client Connection Defaults section

2025-01-07 Thread Melanie Plageman
On Mon, Jan 6, 2025 at 8:26 PM Tom Lane wrote: > > Melanie Plageman writes: > > I was reviewing all the vacuum related GUCs, and I noticed that they > > fall into three main subsections of Chapter 19 (Server Configuration) > > in the docs [1]: Automatic Vacuuming [2], Resource Consumption [3], >

Re: Small patch to use pqMsg_Query instead of `Q`

2025-01-07 Thread Nathan Bossart
On Tue, Jan 07, 2025 at 01:25:31PM -0300, Fabrízio de Royes Mello wrote: > On Tue, Jan 7, 2025 at 12:42 PM Dave Cramer wrote: >> Previously we have replaced the use of literal characters with pqMsg*. Not >> sure how this one escaped detection. It's not the first to escape detection, and it probab

Re: AIO v2.2

2025-01-07 Thread Andres Freund
Hi, On 2025-01-07 18:08:51 +0200, Heikki Linnakangas wrote: > On LWLockDisown(): > > > +/* > > + * Stop treating lock as held by current backend. > > + * > > + * After calling this function it's the callers responsibility to ensure > > that > > + * the lock gets released, even in case of an erro

Re: Small patch to use pqMsg_Query instead of `Q`

2025-01-07 Thread Fabrízio de Royes Mello
On Tue, Jan 7, 2025 at 12:42 PM Dave Cramer wrote: > Greetings, > > Previously we have replaced the use of literal characters with pqMsg*. Not > sure how this one escaped detection. > > Patch attached. > > LGTM... looks like a leftover from f4b54e1e. Regards, -- Fabrízio de Royes Mello

Re: AIO v2.2

2025-01-07 Thread Andres Freund
Hi, On 2025-01-07 17:09:58 +0200, Heikki Linnakangas wrote: > On 01/01/2025 06:03, Andres Freund wrote: > > Hi, > > > > Attached is a new version of the AIO patchset. > > I haven't gone through it all yet, but some comments below. Thanks! > > The biggest changes are: > > > > - The README has

Re: AIO v2.2

2025-01-07 Thread Heikki Linnakangas
On LWLockDisown(): +/* + * Stop treating lock as held by current backend. + * + * After calling this function it's the callers responsibility to ensure that + * the lock gets released, even in case of an error. This only is desirable if + * the lock is going to be released in a different process

Re: not null constraints, again

2025-01-07 Thread Alvaro Herrera
On 2024-Dec-12, jian he wrote: > patch attached. > > also change comments of heap_create_with_catalog, > StoreConstraints, MergeAttributes. > so we can clear idea what's kind of constraints we are dealing with > in these functions. Great catch! The patch looks good, I have pushed it. Thank you

Re: PoC: history of recent vacuum/checkpoint runs (using new hooks)

2025-01-07 Thread Bertrand Drouvot
Hi, On Wed, Dec 25, 2024 at 06:25:50PM +0100, Tomas Vondra wrote: > Hi, > > On 12/23/24 07:35, wenhui qiu wrote: > > Hi Tomas  > >      This is a great feature.   > > + /* > > + * Define (or redefine) custom GUC variables. > > + */ > > + DefineCustomIntVariable("stats_history.size", > > + "Sets t

Small patch to use pqMsg_Query instead of `Q`

2025-01-07 Thread Dave Cramer
Greetings, Previously we have replaced the use of literal characters with pqMsg*. Not sure how this one escaped detection. Patch attached. Dave Cramer 0001-use-pqMsg_Query-instead-of-Q.patch Description: Binary data

Re: More reliable nbtree detection of unsatisfiable RowCompare quals involving a leading NULL key/element

2025-01-07 Thread Peter Geoghegan
On Tue, Jan 7, 2025 at 7:58 AM Matthias van de Meent wrote: > This doesn't really clarify _why_ we'd never get this far, so I'd word that as > > + * Cannot be a NULL in the first row member: _bt_preprocess_keys > + * would've marked the qual as unsatisfyable, preventing us

Re: Further _bt_first simplifications for parallel index scans

2025-01-07 Thread Peter Geoghegan
On Tue, Jan 7, 2025 at 6:56 AM Matthias van de Meent wrote: > Apart from comments on comment contents and placement, no specific issues: Pushed this just now. Thanks for the review! > > + * > > + * Initialize arrays during first (unscheduled) primitive index scan. > > + */ > > I thin

Re: Temporary Views Cleanup Issue

2025-01-07 Thread Tom Lane
"=?UTF-8?B?6LW15a6H6bmPKOWuh+W9rSk=?=" writes: > We encountered a scenario where orphaned temporary views are preventing DDL > operations on a table, such as "ALTER TABLE xxx ALTER COLUMN xxx TYPE xxx." > The > corresponding error message is "ERROR: cannot alter type of a column used by > a view

Re: AIO v2.2

2025-01-07 Thread Heikki Linnakangas
On 01/01/2025 06:03, Andres Freund wrote: Hi, Attached is a new version of the AIO patchset. I haven't gone through it all yet, but some comments below. The biggest changes are: - The README has been extended with an overview of the API. I think it gives a good overview of how the API fi

Re: Sample rate added to pg_stat_statements

2025-01-07 Thread Andrey M. Borodin
> On 7 Jan 2025, at 16:05, Ilia Evdokimov wrote: > >> 1. This code seems a little different from your patch. It is trying to avoid >> engaging PRNG. I'm not sure it's a good idea, but still. Also, it uses "<=", >> not "<". >> >> xact_is_sampled = log_xact_sample_rate != 0 && >> (log_xac

Re: Sample rate added to pg_stat_statements

2025-01-07 Thread Ilia Evdokimov
I completely forgot about ordering pg_stat_statements in the test, which is why the test failed in [0]. I've added ORDER BY query COLLATE "C" to avoid any non-deterministic ordering in the table. [0]: https://cirrus-ci.com/task/5724458477944832 -- Best regards, Ilia Evdokimov, Tantor Labs LLC.

Re: RFC: Allow EXPLAIN to Output Page Fault Information

2025-01-07 Thread Atsushi Torikoshi
On Mon, Jan 6, 2025 at 6:59 PM Julien Rouhaud wrote: > Hi, > > On Mon, Jan 06, 2025 at 06:49:06PM +0900, torikoshia wrote: > > > > > **However, I think the general direction has merit**: Changing this > > > patch to > > > use `ru_inblock`/`ru_oublock` gives very useful insights. `ru_inblock` > >

Re: Meson bug in detection of 64 atomics

2025-01-07 Thread Yura Sokolov
I see: Thomas Munro just missed this place in commit on 2024.12.04 Use and for c.h integers.https://github.com/postgres/postgres/commit/962da900ac8f0927f1af2fd811ca67fa163c873aВт, 7 янв. 2025 г. в 01:29, Юрий Соколов :Hi. I found meson fails to detect 64 GCC atomics. Looks like check was drafted

Re: More reliable nbtree detection of unsatisfiable RowCompare quals involving a leading NULL key/element

2025-01-07 Thread Matthias van de Meent
On Fri, 27 Dec 2024 at 23:03, Peter Geoghegan wrote: > > On Mon, Dec 23, 2024 at 1:02 PM Peter Geoghegan wrote: > > Attached patch fixes the problem by moving detection of RowCompare > > unsatisfiable-due-to-NULL cases into _bt_fix_scankey_strategy. > > Attached is v2, which adds several new regr

RE: Conflict detection for update_deleted in logical replication

2025-01-07 Thread Zhijie Hou (Fujitsu)
On Thursday, January 2, 2025 2:30 PM Amit Kapila wrote: > > Sounds reasonable but OTOH, all other places that create physical > slots (which we are doing here) don't use this trick. So, don't they > need similar reliability? I have not figured the reason for existing physical slots' handling, b

RE: Conflict detection for update_deleted in logical replication

2025-01-07 Thread Zhijie Hou (Fujitsu)
On Thursday, January 2, 2025 6:34 PM vignesh C wrote: > > Few suggestions: > 1) If we have a subscription with detect_update_deleted option and we > try to upgrade it with default settings(in case dba forgot to set > track_commit_timestamp), the upgrade will fail after doing a lot of > steps like

Re: Further _bt_first simplifications for parallel index scans

2025-01-07 Thread Matthias van de Meent
On Thu, 2 Jan 2025 at 17:38, Peter Geoghegan wrote: > > Attached patch goes a bit further with simplifying _bt_first's > handling of seizing the parallel scan. This continues recent work from > commits 4e6e375b and b5ee4e52. > > Aside from requiring less code, the new structure relieves _bt_first

RE: Conflict detection for update_deleted in logical replication

2025-01-07 Thread Hayato Kuroda (Fujitsu)
Dear Amit, Hou, > BTW, it is not clear how retaining dead tuples will help the detection > update_origin_differs. Will it happen when the tuple is inserted or > updated on the subscriber and then when we try to update the same > tuple due to remote update, the commit_ts information of the xact is

Re: Conflict detection for update_deleted in logical replication

2025-01-07 Thread vignesh C
On Wed, 25 Dec 2024 at 08:13, Zhijie Hou (Fujitsu) wrote: > > On Monday, December 23, 2024 2:15 PM Kuroda, Hayato/黒田 隼人 > wrote: > > > > Dear Hou, > > > > Thanks for updating the patch. Few comments: > > Thanks for the comments! > > > 02. ErrorOnReservedSlotName() > > > > Currently the function

Re: Sample rate added to pg_stat_statements

2025-01-07 Thread Ilia Evdokimov
On 06.01.2025 18:57, Andrey M. Borodin wrote: On 6 Jan 2025, at 15:50, Ilia Evdokimov wrote: Any suggestions for improvements? The patch looks good to me, just a few nits. 0. Perhaps, we could have a test for edge values of 0 and 1. I do not insist, just an idea to think about. I would a

Re: Adding OLD/NEW support to RETURNING

2025-01-07 Thread Dean Rasheed
On Fri, 3 Jan 2025 at 19:39, Robert Treat wrote: > > This is really nice work. I was curious what you think the status of > this patch is at this point and if you are still thinking of > committing it for v18? > Thanks for looking. I think that the patch is in good shape, and it has had a decent

Re: CREATE TABLE NOT VALID for check and foreign key

2025-01-07 Thread Yasuo Honda
Hi, On Mon, Dec 23, 2024 at 10:10 AM Alvaro Herrera wrote: > Maybe it would have been wise to forbid NOT VALID when used with CREATE > TABLE. But we didn't. Should we do that now? Maybe we can just > document that you can specify it but it doesn't do anything. I'd like PostgreSQL to raise er

Re: Conflict detection for update_deleted in logical replication

2025-01-07 Thread Amit Kapila
On Mon, Jan 6, 2025 at 4:52 PM Zhijie Hou (Fujitsu) wrote: > > On Friday, January 3, 2025 2:36 PM Masahiko Sawada > wrote: > > > > > + /* > > +* The changes made by this and later transactions are still > > non-removable > > +* to allow for the detection of update_deleted c

Re: POC: make mxidoff 64 bits

2025-01-07 Thread Maxim Orlov
On Thu, 2 Jan 2025 at 01:12, Heikki Linnakangas wrote: > > It might be best to just refuse the upgrade if oldestOffsetKnown==false. > It's a very ancient corner case. It seems reasonable to require you to > upgrade to a newer minor version and run VACUUM before upgrading. IIRC > that sets oldestO

Re: A few patches to clarify snapshot management

2025-01-07 Thread Heikki Linnakangas
On 07/01/2025 00:00, Andres Freund wrote: On 2024-12-20 19:31:01 +0200, Heikki Linnakangas wrote: While playing around some more with this, I noticed that this code in GetTransactionSnapshot() is never reached, and AFAICS has always been dead code: Snapshot GetTransactionSnapshot(void) {

Re: PoC: history of recent vacuum/checkpoint runs (using new hooks)

2025-01-07 Thread Cédric Villemain
On 31/12/2024 16:06, Tomas Vondra wrote: On 12/31/24 02:06, Michael Paquier wrote: On Sat, Dec 28, 2024 at 02:25:16AM +0100, Tomas Vondra wrote: And the more I think about it the more I'm convinced we don't need to keep the data about past runs in memory, a file should be enough (except maybe

Re: Psql meta-command conninfo+

2025-01-07 Thread Hunaid Sohail
Hi, Thank you for your valuable feedback. 1/ I am having a hard time making sense of the section "Current Status" > None of the values in that section can be changed in the lifetime > of a connection. The description "Current Status" makes it > seem like they can change. > Any suggestions? 2/ C

RE: Conflict detection for update_deleted in logical replication

2025-01-07 Thread Zhijie Hou (Fujitsu)
On Tuesday, January 7, 2025 3:05 PM Masahiko Sawada wrote: Hi, > On Mon, Jan 6, 2025 at 10:40 PM Zhijie Hou (Fujitsu) > wrote: > > > > On Tuesday, January 7, 2025 2:00 PM Masahiko Sawada > wrote: > > > > Hi, > > > > > > > > On Mon, Jan 6, 2025 at 3:22 AM Zhijie Hou (Fujitsu) > > > > wrote: >

Re: Re: proposal: schema variables

2025-01-07 Thread jian he
hi. some minor issues. 'transformMergeStmt also needs "qry->hasSessionVariables = pstate->p_hasSessionVariables;" ? acldefault in doc/src/sgml/func.sgml Need an update for SESSION VARIABLE? Table 9.70. Access Privilege Inquiry Functions sorting order: has_session_variable_privilege should after

Re: per backend I/O statistics

2025-01-07 Thread Bertrand Drouvot
Hi, On Fri, Jan 03, 2025 at 10:48:41AM +, Bertrand Drouvot wrote: > I started to look at it and should be able to share a patch next week. A dedicated thread and a patch have been created, see [1]. [1]: https://www.postgresql.org/message-id/flat/Z3zqc4o09dM/Ezyz%40ip-10-97-1-34.eu-west-3.co

Re: Conflict detection for update_deleted in logical replication

2025-01-07 Thread Amit Kapila
On Fri, Jan 3, 2025 at 11:22 AM Amit Kapila wrote: > > 5. > + > + id="sql-createsubscription-params-with-detect-update-deleted"> > +detect_update_deleted > (boolean) > + > + > + Specifies whether the detection of linkend="conflict-update-deleted"/> > +

per backend WAL statistics

2025-01-07 Thread Bertrand Drouvot
Hi hackers, Now that commit 9aea73fc61 added backend-level statistics to pgstats (and per backend IO statistics), we can more easily add per backend statistics. Please find attached a patch to implement $SUBJECT. It's using the same layer as pg_stat_wal, except that it is now possible to know ho