Re: Logical Replication of sequences

2025-09-07 Thread Chao Li
> On Sep 8, 2025, at 14:00, vignesh C wrote: >> >> >> 1 - 0001 >> ``` >> diff --git a/src/test/regress/sql/sequence.sql >> b/src/test/regress/sql/sequence.sql >> index 2c220b60749..c8adddbfa31 100644 >> --- a/src/test/regress/sql/sequence.sql >> +++ b/src/test/regress/sql/sequence.sql >> @@ -

Re: Proposal: Conflict log history table for Logical Replication

2025-09-07 Thread Dilip Kumar
On Sun, Sep 7, 2025 at 1:42 PM Alastair Turner wrote: > > Hi Dilip > > Thanks for working on this, I think it will make conflict detection a lot > more useful. Thanks for the suggestions, please find my reply inline. > On Sat, 6 Sept 2025, 10:38 Dilip Kumar, wrote: >> >> While working on the p

Re: plan shape work

2025-09-07 Thread Dilip Kumar
On Wed, May 21, 2025 at 7:29 PM Robert Haas wrote: > > On Tue, May 20, 2025 at 2:45 PM Tomas Vondra wrote: > I have a sense - possibly an incorrect one - that the core of the > problem here is that the planner considers lots of very similar > alternatives. A hypothetical feature that showed the

Re: Resetting recovery target parameters in pg_createsubscriber

2025-09-07 Thread Alyona Vinter
Sorry, wrong patches again. Here are the correct ones. Best regards, Alyona Vinter From baed4d6390737c4274cd4dc1c21d7bf488c673d4 Mon Sep 17 00:00:00 2001 From: Alena Vinter Date: Tue, 2 Sep 2025 18:15:13 +0700 Subject: [PATCH 2/2] Implements helper function in recovery_gen These functions suppor

Re: Fix missing EvalPlanQual recheck for TID scans

2025-09-07 Thread David Rowley
On Mon, 8 Sept 2025 at 10:31, Sophie Alpert wrote: > I learned that the TID Scan node does not properly implement EvalPlanQual > recheck, which has already been noted in comment added in 2002 (commit > 6799a6ca21). This does seem to have the potential to manifest in observable > and surprising

[BUG] PostgreSQL crashes with ThreadSanitizer during early initialization

2025-09-07 Thread Emmanuel Sibi
Hi hackers, I've found a bug that causes PostgreSQL to crash during startup when built with ThreadSanitizer (-fsanitize=thread). My environment Ubuntu 24.04.1 LTS (kernel 6.14.0-29-generic) clang 18 PostgreSQL 17.2 Build Configuration: ./configure --enable-debug --enable-cassert CFLAGS="-fsaniti

Re: Improve pg_sync_replication_slots() to wait for primary to advance

2025-09-07 Thread Ashutosh Sharma
Hi, Sharing some of my review comments, please look if these make sense to you. On Wed, Sep 3, 2025 at 3:20 PM Ajin Cherian wrote: > > On Wed, Sep 3, 2025 at 6:47 PM shveta malik wrote: > > > > On Wed, Sep 3, 2025 at 11:58 AM Ajin Cherian wrote: > > > > > > Attaching v10 with the above changes

Re: Improve pg_sync_replication_slots() to wait for primary to advance

2025-09-07 Thread shveta malik
On Fri, Sep 5, 2025 at 6:51 PM Ashutosh Bapat wrote: > > On Wed, Sep 3, 2025 at 11:58 AM Ajin Cherian wrote: > > > > > > On Fri, Aug 29, 2025 at 6:50 PM Ashutosh Bapat > > wrote: > > > > > > On Fri, Aug 29, 2025 at 11:42 AM Ajin Cherian wrote: > > > > > +/* > > > + * Flag used by pg_sync_replic

Re: Improve pg_sync_replication_slots() to wait for primary to advance

2025-09-07 Thread Ashutosh Sharma
On Mon, Sep 8, 2025 at 9:51 AM Ashutosh Bapat wrote: > > On Sat, Sep 6, 2025 at 9:14 AM Amit Kapila wrote: > > > > On Fri, Sep 5, 2025 at 11:39 PM Ashutosh Sharma > > wrote: > > > If the remote slot is inactive since long and lagging behind the > > > standby, this function (pg_sync_replication_

Re: How can end users know the cause of LR slot sync delays?

2025-09-07 Thread Ashutosh Sharma
Hi Amit, On Sat, Sep 6, 2025 at 10:46 AM Amit Kapila wrote: > > On Fri, Sep 5, 2025 at 12:50 PM Ashutosh Sharma wrote: > > > > Good to hear that you’re also interested in working on this task. > > > > On Thu, Sep 4, 2025 at 8:26 PM Shlok Kyal wrote: > >> > >> Hi Ashutosh, > >> > >> I am also in

Re: Improve pg_sync_replication_slots() to wait for primary to advance

2025-09-07 Thread Ashutosh Bapat
On Sat, Sep 6, 2025 at 9:14 AM Amit Kapila wrote: > > On Fri, Sep 5, 2025 at 11:39 PM Ashutosh Sharma wrote: > > If the remote slot is inactive since long and lagging behind the > > standby, this function (pg_sync_replication_slots) could end up > > waiting indefinitely. While it can certainly be

Re: Improve pg_sync_replication_slots() to wait for primary to advance

2025-09-07 Thread Ashutosh Bapat
On Sat, Sep 6, 2025 at 12:05 AM Ashutosh Sharma wrote: > > On Fri, Sep 5, 2025 at 6:52 PM Ashutosh Bapat > wrote: > > > > On Wed, Sep 3, 2025 at 11:58 AM Ajin Cherian wrote: > > > > > > I've tested this and I see that interrupts are being handled by > > > sending SIGQUIT and SIGINT to the backen

Re: Resetting recovery target parameters in pg_createsubscriber

2025-09-07 Thread Alyona Vinter
Hi, CFbot indicated some issues with the patch. I've attached rebased versions of the patches, so hopefully everything will be ok this time. Best regards, Alyona Vinter On Fri, 5 Sept 2025 at 12:51, Alyona Vinter wrote: > Dear Hayato, > > Thank you for the review! My apologies for the error in

Re: Adding skip scan (including MDAM style range skip scan) to nbtree

2025-09-07 Thread BharatDB
Dear Team, With reference to the conversation ongoing in message ID : c562dc2a-6e36-46f3-a5ea-cd42eebd7118, I am writing to express my interest in contributing to the ongoing work on fixing the bug related to Adding skip scan (including MDAM style range skip scan) to nbtree. I have been following

let ALTER TABLE DROP COLUMN drop whole-row referenced object

2025-09-07 Thread jian he
hi. CREATE TABLE ts (a int, c int, b int constraint cc check((ts = ROW(1,1,1))), constraint cc1 check((ts.a = 1))); CREATE INDEX tsi on ts (a) where a = 1; CREATE INDEX tsi2 on ts ((a is null)); CREATE INDEX tsi3 on ts ((ts is null)); CREATE INDEX tsi4 on ts (b) where ts is not null; in t

Re: Allow logical replication in the same cluster

2025-09-07 Thread Chao Li
Hi Amit, Thanks for your info. > On Sep 6, 2025, at 12:32, Amit Kapila wrote: > > You can avoid this problem by creating a slot first on publisher with > something like: > postgres=# select pg_create_logical_replication_slot('s1', 'pgoutput', > false, true); > pg_create_logical_replication_slot

Re: Should io_method=worker remain the default?

2025-09-07 Thread Thomas Munro
On Mon, Sep 8, 2025 at 2:39 PM Thomas Munro wrote: > You might also be interested in the phenomenon discussed in the index > prefetching thread, where concurrent reads of the *same* block from > different backs currently force a wait, which can be avoided with a > patch he posted. In that thread

Re: Should io_method=worker remain the default?

2025-09-07 Thread Thomas Munro
On Sat, Sep 6, 2025 at 8:26 AM Jeff Davis wrote: > On Wed, 2025-09-03 at 11:55 -0400, Andres Freund wrote: > > I think the regression is not due to anything inherent to worker, but > > due to > > pressure on AioWorkerSubmissionQueueLock - at least that's what I'm > > seeing on > > a older two sock

Re: Set log_lock_waits=on by default

2025-09-07 Thread Chao Li
> On Sep 8, 2025, at 05:46, Laurenz Albe wrote: > > On Thu, 2025-09-04 at 14:12 +0900, Shinya Kato wrote: >> Due to 635998965 [0], you need to change guc_parameters.dat instead of >> guc_tables.c. > > Thanks for pointing that out to me! > Here is an updated patch. > > Yours, > Laurenz Albe >

Re: [PATCH] Update parser README to include parse_jsontable.c

2025-09-07 Thread Michael Paquier
On Sat, Sep 06, 2025 at 10:38:35AM +0900, Michael Paquier wrote: > That looks wrong since de3600452b61. Will fix, thanks for the report! Applied as 43eb2c541941 and friends. -- Michael signature.asc Description: PGP signature

Re: PgStat_HashKey padding issue when passed by reference

2025-09-07 Thread Michael Paquier
On Sat, Sep 06, 2025 at 10:35:58AM +0900, Michael Paquier wrote: > One idea would be, for example, that keys used with simplehash should > never have any padding at all, and we could force a check in the shape > of a static assertion to force a failure when attempting to compile > code that attempt

Re: Reduce "Var IS [NOT] NULL" quals during constant folding

2025-09-07 Thread Tender Wang
Junwang Zhao 于2025年9月7日周日 19:12写道: > Hi, > > On Thu, Aug 21, 2025 at 9:07 AM Richard Guo > wrote: > > > > On Wed, Aug 20, 2025 at 11:11 PM Nathan Bossart > > wrote: > > > On Wed, Aug 20, 2025 at 10:29:03AM +0900, Richard Guo wrote: > > > > On Wed, Aug 20, 2025 at 2:38 AM Nathan Bossart < > nath

Fix missing EvalPlanQual recheck for TID scans

2025-09-07 Thread Sophie Alpert
Hi all, I learned that the TID Scan node does not properly implement EvalPlanQual recheck, which has already been noted in comment added in 2002 (commit 6799a6ca21). This does seem to have the potential to manifest in observable and surprising ways when queries are filtering on `ctid`, like for

Query Performance Degradation Due to Partition Scan Order – PostgreSQL v17.6

2025-09-07 Thread Vivek Gadge
Hi Team, We are currently experiencing performance issues related to partition scanning on a heavily used table in our PostgreSQL v17.6 database. The table is partitioned monthly (e.g., transactions_jan25, transactions_feb25, …, transactions_sept25). We’ve observed that PostgreSQL scans these par

Re: Set log_lock_waits=on by default

2025-09-07 Thread Laurenz Albe
On Thu, 2025-09-04 at 14:12 +0900, Shinya Kato wrote: > Due to 635998965 [0], you need to change guc_parameters.dat instead of > guc_tables.c. Thanks for pointing that out to me! Here is an updated patch. Yours, Laurenz Albe From aa04f6cf6e7c89f1107ffc6eb661da65082459fe Mon Sep 17 00:00:00 2001 F

Re: Conflict detection for update_deleted in logical replication

2025-09-07 Thread Tom Lane
Coverity is not happy with commit a850be2fe: /srv/coverity/git/pgsql-git/postgresql/src/backend/replication/logical/worker.c: 3276 in FindDeletedTupleInLocalRel() 3270 * maybe_advance_nonremovable_xid() for details). 3271 */ 3272

OAuth client code doesn't work with Google OAuth

2025-09-07 Thread Zsolt Parragi
Hello Hackers, While working on an OAuth validator for PG18 I noticed that currently the client code doesn't work when using Google as the OAuth provider. It requires two small changes: * The device code request only includes the OAuth Client ID in the request body if the user doesn't specify a

Appetite for syntactic sugar to match result set columns to UDT fields?

2025-09-07 Thread Philip Warner
I could not see anything on this subject but would like to know if there would be any appetite for this kind of feature. I am happy to flesh out more details if they were likely to be deemed worth implementing. The Problem Currently, if one has: Create Type FOO( VALUE1 Int, VALUE2 In

Re: [Proposal] Expose internal MultiXact member count function for efficient monitoring

2025-09-07 Thread Ashutosh Bapat
On Thu, Sep 4, 2025 at 2:41 AM Naga Appani wrote: > > On Fri, Aug 22, 2025 at 6:45 AM Ashutosh Bapat > wrote: > > > > On Fri, Aug 22, 2025 at 7:37 AM torikoshia > > wrote: > > > > Updated docs to include both counts and approximate storage. > This one is remaining. + up to approximately 2^32 e

Re: Solaris compiler status

2025-09-07 Thread Peter Eisentraut
On 03.09.25 07:47, Peter Eisentraut wrote: So, can we declare that we don't support this compiler anymore? Ok, looks like we're calling it. Here is a patch set to remove what turns out to be a significant amount of code and documentation to support this compiler. I also added in one tiny co

Re: MergeAppend could consider sorting cheapest child path

2025-09-07 Thread Andrei Lepikhov
On 1/9/2025 22:26, Alexander Korotkov wrote: On Thu, Jul 31, 2025 at 5:20 PM Andrei Lepikhov wrote: See this minor correction in the attachment. postgres_fdw tests are stable now. I have another idea. What if we allow MergeAppend paths only when at least one subpath is preordered. This tric

Re: [PATCH] Add tests for Bitmapset

2025-09-07 Thread Nathan Bossart
On Fri, Sep 05, 2025 at 10:48:21AM -0400, Burd, Greg wrote: > I looked at both radix tree and binary heap and how they use random sets when > testing. Binary heap uses it to create different random sets of numbers to > use across multiple tests while radix tree has a single function that focuses >

Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext

2025-09-07 Thread Mihail Nikalayeu
Hello, Antonin! if (using_subtxn) { RollbackAndReleaseCurrentSubTransaction(); MemoryContextSwitchTo(ccxt); CurrentResourceOwner = cowner; } IIUC memory context is already switched above: MemoryContext ecxt = MemoryContextSwitchTo(ccxt); Best regards, Mikhai

Re: [PG19-3 PATCH] Don't ignore passfile

2025-09-07 Thread Umar Hayat
Hi, I haven't reviewed your patch, Not sure what would be expected behaviour but the current one is documented in PostgreSQL documentation [1], so there should not be any surprises for users. "On Unix systems, the permissions on a password file must disallow any access to world or group; achieve th

Re: index prefetching

2025-09-07 Thread Peter Geoghegan
On Wed, Sep 3, 2025 at 4:06 PM Andres Freund wrote: > The issue to me is that this kind of query actually *can* substantially > benefit from prefetching, no? As far as I can tell, not really, no. > Afaict the performance without prefetching is > rather atrocious as soon as a) storage has a tad h

issue with synchronized_standby_slots

2025-09-07 Thread Fabrice Chapuis
Hi, With PG 17.5 and using logical replication failover slots. When trying to change the value of synchronized_standby_slots, node2 was not running then the error * invalid value for parameter "synchronized_standby_slots": "node1,node2" *was generated. The problem is that statement were affected b

Re: Inconsistent update in the MERGE command

2025-09-07 Thread Dean Rasheed
On Thu, 28 Aug 2025 at 15:10, Yugo Nagata wrote: > > Thank you for your suggestion and the test patch. The test looks good > to me, so I’ve attached an updated patch including it. Thanks, that mostly looks good to me. There's one other place in ExecMergeMatched() that's using TM_FailureData.ctid

Re: 回复: Fix segfault while accessing half-initialized hash table in pgstat_shmem.c

2025-09-07 Thread Steven Niu
___ From: Michael Paquier Sent: Thursday, September 04, 2025 14:30 To: Steven Niu Cc: Mikhail Kot; pgsql-hackers@lists.postgresql.org; t...@myrrc.dev Subject: Re: 回复: Fix segfault while accessing half-initialized hash table in pgstat_shmem.c On Thu, Sep 04, 202

Re: Cannot find a working 64-bit integer type on Illumos

2025-09-07 Thread Thomas Munro
On Thu, Sep 4, 2025 at 3:04 AM Peter Eisentraut wrote: > This change in commit 3c86223c998 is problematic. > > commit 3c86223c998 > Author: Thomas Munro > Date: Tue Mar 25 08:17:53 2025 > > libpq: Deprecate pg_int64. > > ... > > Keep a typedef marked deprecated for backward compa

Re: plan shape work

2025-09-07 Thread Robert Haas
On Thu, Sep 4, 2025 at 4:21 AM Richard Guo wrote: > I found some issues with 0003 though. It seems get_scanned_rtindexes > is intended to return RTI sets with outer join relids excluded. For > some node types, such as Append and MergeAppend, it fails to do so, > which can cause the assertion in

Re: issue with synchronized_standby_slots

2025-09-07 Thread Fabrice Chapuis
Thanks for your reply Zhijie, I understand that the error invalid value for parameter will be diplayed in case of bad value for the GUC synchronized_standby_slots or if a standby node configured is not up and running. But the problem I noticed is that statements could not execute normally and err

Re: Raw parse tree is not dumped to log

2025-09-07 Thread Tatsuo Ishii
Hi, > Hi Tatsuo san, > > I just rebased the commit for the GUC change. > > On Sep 3, 2025, at 09:57, Tatsuo Ishii wrote: > > That's 0.3% difference, definitely noise-level. Ok, I withdraw my > claim and commit the patch without unlikely(). > > I also removed unlikely() in v7. v7 patch looks

Re: [PATCH] Perform check for oversized WAL record before calculating record CRC

2025-09-07 Thread Sergey Fukanchik
It seems to me reasonable to move size check above CRC computation. However, it seems suspicious to me to run a test that allocates 1Gb in `make check`. Maybe, there are places that are not exercised too often. Perhaps recovery tests or something like that. Hi Andrey, I share your concern ab

Re: pull-up subquery if JOIN-ON contains refs to upper-query

2025-09-07 Thread Alena Rybakina
Hi, I rebased the patch and fixed earlier problem. On 03.09.2025 00:20, Alena Rybakina wrote: I'll look at this. I need some time to consider it. I'm working on this approach right now. I introduced mutator and made the transformation if it is possible there but I need to fix some bugs. From

[PATCH] Referenced generic plan mode

2025-09-07 Thread Vlada Pogozhelskaya
Hi all, I’d like to propose a patch that introduces a*referenced generic plan*mode. The patch adds: * new EXPLAIN option|REF_GENERIC_PLAN|(not allowed with ANALYZE); * new|plan_cache_mode|values|ref_auto|and|force_ref_generic_plan|; * a flag to prevent constant folding of Param

Fix race condition in SSI when reading PredXact->SxactGlobalXmin

2025-09-07 Thread Josh Curtis
DropAllPredicateLocksFromTable, PredicateLockPageSplit, and CheckTableForSerializableConflictIn all assume that if PredXact->SxactGlobalXmin is invalid there are no active serializable transactions and that they can return early as there's no work to do. They don't acquire a LWLock on SerializableX

Re: MergeAppend could consider sorting cheapest child path

2025-09-07 Thread Alexander Korotkov
On Fri, Sep 5, 2025 at 11:45 AM Andrei Lepikhov wrote: > > On 1/9/2025 22:26, Alexander Korotkov wrote: > > On Thu, Jul 31, 2025 at 5:20 PM Andrei Lepikhov wrote: > >> See this minor correction in the attachment. postgres_fdw tests are > >> stable now. > > > > I have another idea. What if we all

Re: Reduce "Var IS [NOT] NULL" quals during constant folding

2025-09-07 Thread Junwang Zhao
Hi, On Thu, Aug 21, 2025 at 9:07 AM Richard Guo wrote: > > On Wed, Aug 20, 2025 at 11:11 PM Nathan Bossart > wrote: > > On Wed, Aug 20, 2025 at 10:29:03AM +0900, Richard Guo wrote: > > > On Wed, Aug 20, 2025 at 2:38 AM Nathan Bossart > > > wrote: > > >> There is still an open item for this one

Re: Proposal: Conflict log history table for Logical Replication

2025-09-07 Thread Alastair Turner
Hi Dilip Thanks for working on this, I think it will make conflict detection a lot more useful. On Sat, 6 Sept 2025, 10:38 Dilip Kumar, wrote: > While working on the patch, I see there are some open questions > > 1. We decided to pass the conflict history table name during > subscription creati

Re: Issue with logical replication slot during switchover

2025-09-07 Thread Fabrice Chapuis
Hi, Here the version 1 of the patch with the modifications. I do a git diff --check until there are no more errors. In a next version of the patch, I think I have make change to call ReplicationSlotCreate() function with the value of the flag allow_overwrite be consistent and modify the interface