Allowing user-specified timezone in pg_regress sessions

2025-08-28 Thread Sri Keerthi
Hi Team, I have tried writing regression tests for a PostgreSQL extension and encountered a limitation with pg_regress regarding session timezones. The issue is as follows: pg_regress internally calls putenv("PGTZ=PST8PDT") and putenv("PGDATESTYLE=Postgres, MDY") for each test session. This ensu

Re: [BUG] temporary file usage report with extended protocol and unnamed portals

2025-08-28 Thread Frédéric Yhuel
On 8/21/25 14:02, Frédéric Yhuel wrote: This v6 patch includes the TAP test that I sent in my previous email, with some enhancements. The meson test system was overlooked by this patch, and the attached v7 fixes that.From 554e8e62675574cbde0fd35b0a10f6ae56e5f0d6 Mon Sep 17 00:00:00 2001 From

Re: index prefetching

2025-08-28 Thread Tomas Vondra
On 8/26/25 17:06, Tomas Vondra wrote: > > > On 8/26/25 01:48, Andres Freund wrote: >> Hi, >> >> On 2025-08-25 15:00:39 +0200, Tomas Vondra wrote: >>> >>> ... >>> >>> I'm not sure what's causing this, but almost all regressions my script >>> is finding look like this - always io_method=worker, wi

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-28 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > Thanks, pushed like that. I changed "a database object" to "an SQL > object", because that's a term we have a definition for. > (I also wrote "PostgreSQL" where you had "Postgres". I think it might > be okay now to change the product name in various plac

Re: [PATCH] Generate random dates/times in a specified range

2025-08-28 Thread Greg Sabino Mullane
Patch looks good

Re: index prefetching

2025-08-28 Thread Andres Freund
Hi, On 2025-08-28 19:08:40 +0200, Tomas Vondra wrote: > On 8/28/25 18:16, Andres Freund wrote: > >> So I think the IPC overhead with "worker" can be quite significant, > >> especially for cases with distance=1. I don't think it's a major issue > >> for PG18, because seq/bitmap scans are unlikely t

make LWLockCounter a global variable

2025-08-28 Thread Nathan Bossart
In lwlock.c, uses of LWLockCounter must first calculate its address in shared memory with something like this: LWLockCounter = (int *) ((char *) MainLWLockArray - sizeof(int)); This appears to have been started by commit 82e861f in order to fix EXEC_BACKEND builds, but it could also be fi

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-28 Thread Álvaro Herrera
On 2025-Aug-21, jian he wrote: > case T_CreateStatsStmt: > { > Oidrelid; > CreateStatsStmt *stmt = (CreateStatsStmt *) parsetree; > RangeVar *rel = (RangeVar *) linitial(stmt->relations); > >

Re: Adding REPACK [concurrently]

2025-08-28 Thread Alvaro Herrera
On 2025-Aug-21, Mihail Nikalayeu wrote: > Alvaro Herrera : > > I proposed to leave this part out initially, which is why it hasn't been > > reposted. We can review and discuss after the initial patches are in. > > I think it is worth pushing it at least in the same release cycle. If others are

Re: LISTEN/NOTIFY bug: VACUUM sets frozenxid past a xid in async queue

2025-08-28 Thread Matheus Alcantara
On Thu Aug 21, 2025 at 8:14 PM -03, Matheus Alcantara wrote: > I'll work on this considering the initial Daniil comments at [1] > > [1] > https://www.postgresql.org/message-id/CAJDiXgg1ArRB1-6wLtXfVVnQ38P9Y%2BCDfEc9M2TXiOf_4kfBMg%40mail.gmail.com > I've been working on this on the last few days, p

Re: Improve LWLock tranche name visibility across backends

2025-08-28 Thread Sami Imseih
> * I modified the array of tranche names to be a char ** to simplify > lookups. I also changed how it is first initialized in CreateLWLocks() a > bit. That works also. > * I've left out the tests for now. Those are great for the development > phase, but I'm not completely sold on committ

Re: index prefetching

2025-08-28 Thread Tomas Vondra
On 8/28/25 23:50, Thomas Munro wrote: > On Fri, Aug 29, 2025 at 7:52 AM Andres Freund wrote: >> On 2025-08-28 19:08:40 +0200, Tomas Vondra wrote: >>> From the 2x regression (compared to master) it might seem like that, but >>> even with the increased distance it's still slower than master (by 2

Re: make LWLockCounter a global variable

2025-08-28 Thread Tom Lane
Nathan Bossart writes: > In lwlock.c, uses of LWLockCounter must first calculate its address in > shared memory with something like this: > LWLockCounter = (int *) ((char *) MainLWLockArray - sizeof(int)); > This appears to have been started by commit 82e861f in order to fix > EXEC_BACKEND

Re: index prefetching

2025-08-28 Thread Thomas Munro
On Fri, Aug 29, 2025 at 7:52 AM Andres Freund wrote: > On 2025-08-28 19:08:40 +0200, Tomas Vondra wrote: > > From the 2x regression (compared to master) it might seem like that, but > > even with the increased distance it's still slower than master (by 25%). So > > maybe the "error" is to use AIO

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-28 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > I propose to use this report: > ERROR: cannot create statistics on specified relation > DETAIL: CREATE STATISTICS only supports tables, materialized views, foreign > tables, and partitioned tables. WFM, although I think you could shorten it to "tables

Re: index prefetching

2025-08-28 Thread Peter Geoghegan
On Thu, Aug 28, 2025 at 7:01 PM Tomas Vondra wrote: > I'm not sure how to determine what concurrency it "wants". All I know is > that for "warm" runs [1], the basic index prefetch patch uses distance > ~2.0 on average, and is ~2x slower than master. And with the patches the > distance is ~270, and

Re: index prefetching

2025-08-28 Thread Andres Freund
Hi, On 2025-08-29 01:00:58 +0200, Tomas Vondra wrote: > I'm not sure how to determine what concurrency it "wants". All I know is > that for "warm" runs [1], the basic index prefetch patch uses distance > ~2.0 on average, and is ~2x slower than master. And with the patches the > distance is ~270, a

Re: index prefetching

2025-08-28 Thread Peter Geoghegan
On Thu, Aug 28, 2025 at 7:52 PM Tomas Vondra wrote: > Use this branch: > > https://github.com/tvondra/postgres/commits/index-prefetch-master/ > > and then Thomas' patch that increases the prefetch distance: > > > https://www.postgresql.org/message-id/CA%2BhUKGL2PhFyDoqrHefqasOnaXhSg48t1phs3VM8BA

Re: index prefetching

2025-08-28 Thread Tomas Vondra
On 8/28/25 21:52, Andres Freund wrote: > Hi, > > On 2025-08-28 19:08:40 +0200, Tomas Vondra wrote: >> On 8/28/25 18:16, Andres Freund wrote: So I think the IPC overhead with "worker" can be quite significant, especially for cases with distance=1. I don't think it's a major issue

Re: doc patch: missing tags in protocol.sgml

2025-08-28 Thread Masahiko Sawada
On Wed, Aug 27, 2025 at 11:49 PM Hayato Kuroda (Fujitsu) wrote: > > Dear hackers, > > I found that in protocol.sgml, the parameter "streaming" is mentioned twice > [1] but > both are not tagged. IIUC, "streaming" can be and "parallel" can be > . > Also, the first "streaming" can have a link to

Re: index prefetching

2025-08-28 Thread Tomas Vondra
On 8/29/25 01:27, Andres Freund wrote: > Hi, > > On 2025-08-29 01:00:58 +0200, Tomas Vondra wrote: >> I'm not sure how to determine what concurrency it "wants". All I know is >> that for "warm" runs [1], the basic index prefetch patch uses distance >> ~2.0 on average, and is ~2x slower than master

Re: Adding REPACK [concurrently]

2025-08-28 Thread Mihail Nikalayeu
Hello, Álvaro! > If others are motivated enough to certify it, maybe we can consider it. > But I don't think I'm going to have time to get this part reviewed and > committed in time for 19, so you might need another committer. I don't think it is realistic to involve another committer - it is jus

Re: index prefetching

2025-08-28 Thread Tomas Vondra
On 8/29/25 01:57, Peter Geoghegan wrote: > On Thu, Aug 28, 2025 at 7:52 PM Tomas Vondra wrote: >> Use this branch: >> >> https://github.com/tvondra/postgres/commits/index-prefetch-master/ >> >> and then Thomas' patch that increases the prefetch distance: >> >> >> https://www.postgresql.org/mes

Re: index prefetching

2025-08-28 Thread Andres Freund
Hi, On 2025-08-28 19:57:17 -0400, Peter Geoghegan wrote: > On Thu, Aug 28, 2025 at 7:52 PM Tomas Vondra wrote: > > Use this branch: > > > > https://github.com/tvondra/postgres/commits/index-prefetch-master/ > > > > and then Thomas' patch that increases the prefetch distance: > > > > > > https:/

Re: [BUG] Remove self joins causes 'variable not found in subplan target lists' error

2025-08-28 Thread Tom Lane
Richard Guo writes: > On Fri, Aug 29, 2025 at 2:26 AM Tom Lane wrote: >> With one eye on the fast-approaching release freeze for 18rc1, >> I plan to go ahead and push these. Please do review if you >> have time, but I think getting some buildfarm cycles on these >> is time-critical now. > I rev

Re: index prefetching

2025-08-28 Thread Peter Geoghegan
On Thu, Aug 28, 2025 at 9:10 PM Andres Freund wrote: > Same. Tomas, could you share what you applied? Tomas posted a self-contained patch to the list about an hour ago? > > I'm not sure that Thomas'/your patch to ameliorate the problem on the > > read stream side is essential here. Perhaps Andr

Re: [BUG] Remove self joins causes 'variable not found in subplan target lists' error

2025-08-28 Thread Richard Guo
On Fri, Aug 29, 2025 at 2:26 AM Tom Lane wrote: > Attached are a finished version of my v3 patch for HEAD, and the > promised adaptation of it for v18. The only surprise I ran into > was that I had to adopt the same sort of copy-from-the-parent > logic as you have in HEAD in create_unique_paths,

Re: GRANT/REVOKE locking semantics in get_object_address()

2025-08-28 Thread BharatDB
Dear Team, With reference to the conversation ongioing in message ID: d2d96fe4-6b1c-4bd3-813b-c2cfcb4a79f4, I am writing to express my interest in contributing to the ongoing work on fixing the bug related to Proper object locking for GRANT/REVOKE. I have been following the discussion around the

Re: pgsql: Move SQL-callable code related to multixacts into its own file

2025-08-28 Thread Álvaro Herrera
On 2025-Aug-19, Bertrand Drouvot wrote: > That makes sense to me. On 2025-Aug-20, Michael Paquier wrote: > Indeed, that's a nice located cleanup. Thanks for looking! I have pushed it now. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "I'm always right, but s

Re: Inconsistent update in the MERGE command

2025-08-28 Thread Yugo Nagata
On Wed, 27 Aug 2025 14:44:55 +0100 Dean Rasheed wrote: > On Sun, 24 Aug 2025 at 18:34, Yugo Nagata wrote: > > > > I confirmed this issue by executing the following query concurrently > > in three transactions. (With only two transactions, the issue does not > > occur.) > > Yes, I think 3 trans

Re: Improve LWLock tranche name visibility across backends

2025-08-28 Thread Sami Imseih
> The check has to be done before the strlen() call, if not it segfault: I don't know what I was thinking there :( silly mistake. It was also missed in RequestNamedLWLockTranche. > Most of the places where NAMEDATALEN is mentioned in sgml files also mention > it's 64 bytes. Should we do the same

Re: Issue with logical replication slot during switchover

2025-08-28 Thread Fabrice Chapuis
What is the procedure to create this patch. Thank you for your help. On Thu, Aug 28, 2025 at 12:04 PM shveta malik wrote: > On Wed, Aug 27, 2025 at 7:55 PM Fabrice Chapuis > wrote: > > > > For the first step (a), the pg_create_logical_replication_slot interface > is extended. > > The slot on th

Re: Conflict detection for update_deleted in logical replication

2025-08-28 Thread Nisha Moond
Hi, As per the test results in [1], the TPS drop observed on the subscriber with update_deleted enabled was mainly because only a single apply worker was handling the replication workload from multiple concurrent publisher clients. The following performance benchmarks were conducted to evaluate th

Re: Non-reproducible AIO failure

2025-08-28 Thread Konstantin Knizhnik
On 28/08/2025 3:08 AM, Thomas Munro wrote: On Thu, Aug 28, 2025 at 11:08 AM Andres Freund wrote: On 2025-08-26 16:59:54 +0300, Konstantin Knizhnik wrote: Still it is not quite clear to me how bitfields can cause this issue. Same. Here's what I speculated after reading the generated asm[1]:

Re: Adding pg_dump flag for parallel export to pipes

2025-08-28 Thread Andrew Jackson
Hi, Very interesting patch. One question: is it possible with this patch to pipe pg_dump directory output directly into pg_restore with this patch? Looking at the code I don't believe that is the case but figured I would ask. Thanks, Andrew Jackson

Re: Generate GUC tables from .dat file

2025-08-28 Thread Daniel Gustafsson
> On 28 Aug 2025, at 08:53, Peter Eisentraut wrote: > I addressed all those, and did another cleanup pass over the script. (The > formatting is from pgperltidy.) A tiny nitpick is that all the other generator scripts (that I looked at) in the tree use GetOptions() with named parameter rather t

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

2025-08-28 Thread BharatDB
*Subject:* Contribution Interest – Bug Fix on Reducing "Var IS [NOT] NULL" Quals During Constant Folding Dear Team, I hope this message finds you well. With reference to the conversation ongioing in message ID: (CAMbWs487wxHq0fUu+Cew7Y+n+wpY_B--PT-61syXrE40uZqErw

Re: index prefetching

2025-08-28 Thread Tomas Vondra
On 8/28/25 18:16, Andres Freund wrote: > Hi, > > On 2025-08-28 14:45:24 +0200, Tomas Vondra wrote: >> On 8/26/25 17:06, Tomas Vondra wrote: >> I kept thinking about this, and in the end I decided to try to measure >> this IPC overhead. The backend/ioworker communicate by sending signals, >> so I w

Re: [BUG] Remove self joins causes 'variable not found in subplan target lists' error

2025-08-28 Thread Tom Lane
Richard Guo writes: > On Thu, Aug 28, 2025 at 6:42 AM Tom Lane wrote: >> 2. Try to fix up the SJE patch so that it calculates relid changes >> honestly, or at least no less honestly than what happened before >> a3179ab69. > I took a look at #2. I don't have a good understanding of the SJE > pat

Re: plan shape work

2025-08-28 Thread Alexandra Wang
Hi Robert, On Tue, Aug 26, 2025 at 7:59 AM Robert Haas wrote: > On Mon, May 19, 2025 at 2:01 PM Robert Haas wrote: > > A couple of people at pgconf.dev seemed to want to know more about my > > ongoing plan shape work, so here are the patches I have currently. > > Here's an updated patch set. My

Re: Generate GUC tables from .dat file

2025-08-28 Thread David E. Wheeler
On Aug 28, 2025, at 09:29, Daniel Gustafsson wrote: > A tiny nitpick is that all the other generator scripts (that I looked at) in > the tree use GetOptions() with named parameter rather than dereference ARGV > directly: > > +my $input_fname = $ARGV[0]; > +my $output_fname = $ARGV[1]; GetOption

Re: Per backend relation statistics tracking

2025-08-28 Thread Bertrand Drouvot
Hi, On Wed, Aug 27, 2025 at 01:57:13PM +, Bertrand Drouvot wrote: > Hi, > > On Tue, Aug 26, 2025 at 04:55:09PM -0500, Sami Imseih wrote: > > I worry that a single view will grow very wide, and we will have to > > eventually > > split it. So we may as well start thinking about having multiple

Re: Adding per backend commit and rollback counters

2025-08-28 Thread Bertrand Drouvot
Hi, On Sun, Aug 10, 2025 at 07:47:09AM +, Bertrand Drouvot wrote: > To sum up, v3 contains: > > 0001 - > Adding per backend commit and rollback counters > 0002 - > Adding XID generation count per backend > 0003 - > Adding the pg_stat_backend view Following recent conversations in [1], those

Re: index prefetching

2025-08-28 Thread Andres Freund
Hi, On 2025-08-26 17:06:11 +0200, Tomas Vondra wrote: > On 8/26/25 01:48, Andres Freund wrote: > > Hi, > > > > On 2025-08-25 15:00:39 +0200, Tomas Vondra wrote: > >> Thanks. Based on the testing so far, the patch seems to be a substantial > >> improvement. What's needed to make this prototype com

Re: Changing the state of data checksums in a running cluster

2025-08-28 Thread Tomas Vondra
Hi, I spent a bit more time fixing the TAP test. The attached patch makes it "work" for me (or I think it should, in principle). I'm not saying it's the best way to do stuff. With the patch applied, I tried running it, and I got a failure when running pg_checksums. There's a log snippet describin

Re: index prefetching

2025-08-28 Thread Andres Freund
Hi, On 2025-08-28 14:45:24 +0200, Tomas Vondra wrote: > On 8/26/25 17:06, Tomas Vondra wrote: > I kept thinking about this, and in the end I decided to try to measure > this IPC overhead. The backend/ioworker communicate by sending signals, > so I wrote a simple C program that does "signal echo" w

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-28 Thread Álvaro Herrera
On 2025-Aug-22, Tom Lane wrote: > Hmmm ... maybe something like > > Mathematically, a "relation" is a set of tuples; this is the sense > meant in the term "relational database". > > In Postgres, "relation" is commonly used to mean a database object > that has a name and a list of

Re: Improve LWLock tranche name visibility across backends

2025-08-28 Thread Nathan Bossart
I've spent some time getting this prepared for commit, so apologies if I am steamrolling over some of the latest discussion points. The majority of what I've changed amounts to what I'd characterize as relatively minor editorialization, but I'd imagine reasonable people could disagree. The bigger

Re: VM corruption on standby

2025-08-28 Thread Nathan Bossart
On Mon, Aug 25, 2025 at 10:07:26AM -0500, Nathan Bossart wrote: > Now that this is reverted, can the related open item be marked as resolved? Since there has been no further discussion, I will go ahead and resolve the open item. -- nathan

Re: [BUG] Remove self joins causes 'variable not found in subplan target lists' error

2025-08-28 Thread Richard Guo
On Fri, Aug 29, 2025 at 10:39 AM Tom Lane wrote: > Richard Guo writes: > > I plan to push the fix to both v18 and master, if there are no > > objections. > Please do. Done. Thanks Richard

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

2025-08-28 Thread Masahiko Sawada
On Thu, Aug 28, 2025 at 4:29 AM shveta malik wrote: > > On Wed, Aug 27, 2025 at 12:12 PM Masahiko Sawada > wrote: > > > > On Tue, Aug 26, 2025 at 2:32 AM shveta malik wrote: > > > > > > On Tue, Aug 26, 2025 at 12:54 AM Masahiko Sawada > > > wrote: > > > > > > > > I've attached the updated pat

Saving and restoring InterruptHoldoffCount

2025-08-28 Thread Yurii Rashkovskii
Hi there, I want to clarify the comment I found in `errfinish`: ``` Reset InterruptHoldoffCount in case we ereport'd from inside an interrupt holdoff section. (We assume here that no handler will itself be inside a holdoff section. If necessary, such a handler could **save and restore** Interru

Re: index prefetching

2025-08-28 Thread Thomas Munro
On Fri, Aug 29, 2025 at 11:52 AM Tomas Vondra wrote: > True. But one worker did show up in top, using a fair amount of CPU, so > why wouldn't the others (if they process the same stream)? It deliberately concentrates wakeups into the lowest numbered workers that are marked idle in a bitmap. * hi

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-28 Thread jian he
On Fri, Aug 29, 2025 at 5:46 AM Tom Lane wrote: > > =?utf-8?Q?=C3=81lvaro?= Herrera writes: > > I propose to use this report: > > > ERROR: cannot create statistics on specified relation > > DETAIL: CREATE STATISTICS only supports tables, materialized views, > > foreign tables, and partitioned

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

2025-08-28 Thread Masahiko Sawada
On Wed, Aug 27, 2025 at 7:45 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Sawada-san, > > > > Assuming that logical_decoding written in the WAL is false here, and a > > > logical > > > replication slot is created just after that. In my experiments below > > > happened: > > > > > > > Let me clarify

Re: Avoid retaining conflict-related data when no tables are subscribed

2025-08-28 Thread Amit Kapila
On Thu, Aug 28, 2025 at 7:54 AM Zhijie Hou (Fujitsu) wrote: > > Hi, > > My colleague Nisha reported an issue to me off-list: dead tuples can't > be removed when retain_dead_tuples is enabled for a subscription with no > tables. > > This appears to stem from the inability to advance the non-remova

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

2025-08-28 Thread Ajin Cherian
On Fri, Aug 29, 2025 at 3:01 PM shveta malik wrote: > > On Tue, Aug 26, 2025 at 9:58 AM Ajin Cherian wrote: > 4) > In the worker, before each call to synchronize_slots(), we are > starting a new transaction. It aligns with the previous implementation > where StartTransaction was inside synchroniz

RE: doc patch: missing tags in protocol.sgml

2025-08-28 Thread Hayato Kuroda (Fujitsu)
Dear Sawada-san, Thanks for looking the patch. Actually PG16-18 has the same issue as this, but it does not have the page for pgoutput. Attached patch sets a link to create_subscription.sgml instead. Thought? Best regards, Hayato Kuroda FUJITSU LIMITED PG16-18-0001-doc-Add-missing-tags.patch

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

2025-08-28 Thread shveta malik
On Tue, Aug 26, 2025 at 9:58 AM Ajin Cherian wrote: > > On Fri, Aug 22, 2025 at 3:44 PM shveta malik wrote: > > > > On Wed, Aug 20, 2025 at 10:53 AM Ajin Cherian wrote: > > > > > > > > > I've removed them. > > > Attaching patch v8 addressing the above comments. > > > > > > > Thanks for the patch

Re: Remove unneeded cast in heap_xlog_lock.

2025-08-28 Thread Peter Eisentraut
On 28.08.25 10:08, Kirill Reshke wrote: On Sat, 23 Aug 2025 at 19:57, Peter Eisentraut wrote: On 22.08.25 11:59, Álvaro Herrera wrote: On 2025-Aug-22, Kirill Reshke wrote: I am uncertain about the delineation between when we make changes and when we refrain from doing so. I think this is

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

2025-08-28 Thread Amit Kapila
On Thu, Aug 28, 2025 at 3:29 PM Kirill Reshke wrote: > > On Thu, 28 Aug 2025 at 14:56, Amit Kapila wrote: > > > > On Thu, Aug 28, 2025 at 11:07 AM Ashutosh Sharma > > wrote: > > > > > > We have seen cases where slot synchronization gets delayed, for example > > > when the slot is behind the fa

Re: make LWLockCounter a global variable

2025-08-28 Thread Bertrand Drouvot
Hi, On Thu, Aug 28, 2025 at 05:56:07PM -0400, Tom Lane wrote: > Nathan Bossart writes: > > In lwlock.c, uses of LWLockCounter must first calculate its address in > > shared memory with something like this: > > > LWLockCounter = (int *) ((char *) MainLWLockArray - sizeof(int)); > > > This ap

Re: Issue with logical replication slot during switchover

2025-08-28 Thread shveta malik
On Thu, Aug 28, 2025 at 9:11 PM Fabrice Chapuis wrote: > > What is the procedure to create this patch. Thank you for your help. > We use 'git format-patch' to generate formatted patches. I have given a few links ([1],[2],[3)] on know-how. I usually use these steps: git add git add git c

Re: SQL:2023 JSON simplified accessor support

2025-08-28 Thread Chao Li
> > Best, > Alex > I am trying to split different topics to different email to keep every issue to be focused. I also have a suggestion. If I do: ``` — s1 select (t.data)['con']['a'][1]['b']['c']['d'] from test_jsonb_types t; —s2 select (t.data).con.a[1].b['c'].d from test_jsonb_types t; `

Re: SQL:2023 JSON simplified accessor support

2025-08-28 Thread Chao Li
>> On Aug 26, 2025, at 11:52, Alexandra Wang >> wrote: >> >> Best, >> Alex >> > > I found a bug. ``` INSERT INTO test_jsonb_types (data) VALUES ('[1, 2, "three"]'), ('{"con": {"a": [{"b": {"c": {"d": 99}}}, {"b": {"c": {"d": 100}}}]}}’); ``` If I use a index following a slice, it doesn’t

Re: Mark ItemPointer parameters as const in tuple/table lock functions

2025-08-28 Thread Peter Eisentraut
On 28.08.25 04:27, Chao Li wrote: On Aug 27, 2025, at 17:24, Peter Eisentraut wrote: This style of having Foo be a type alias for pointer-to-FooData is an ancient Postgres coding convention that does not map well to modern C that has an emphasis on judicious use of qualifiers and attributes,

Re: Mark ItemPointer parameters as const in tuple/table lock functions

2025-08-28 Thread Chao Li
Hi Peter, Thank you so much for your help. > On Aug 29, 2025, at 13:42, Peter Eisentraut wrote: > > This patch still causes a compiler warning: > > ../src/backend/storage/lmgr/lmgr.c: In function 'XactLockTableWait': > ../src/backend/storage/lmgr/lmgr.c:681:27: error: assignment discards 'cons

RE: Conflict detection for update_deleted in logical replication

2025-08-28 Thread Zhijie Hou (Fujitsu)
On Thursday, August 28, 2025 6:07 PM shveta malik wrote: > On Thu, Aug 28, 2025 at 8:02 AM Zhijie Hou (Fujitsu) > wrote: > > > > > > I noticed that Cfbot failed to compile the document due to a typo > > after renaming the subscription option. Here are the updated V67 > > patches to fix that, onl

pg_dump: fix memory leak

2025-08-28 Thread m . korotkov
Hi all, I have found a potential memory leak in src/bin/pg_dump/dumputils.c in the function generate_restrict_key(). Memory is allocated to the ret pointer if pg_strong_random returns false, and this leads to a memory leak. I have replaced the allocation to avoid this leak. --- Best regards, Ko

Re: psql: tab-completion support for COPY ... TO/FROM STDIN, STDOUT, and PROGRAM

2025-08-28 Thread Kirill Reshke
On Thu, 28 Aug 2025 at 12:22, Yugo Nagata wrote: > > > Hi! This tab completion support is indeed very useful. Thanks for > > working on this. > > Thank you for your feedback! > > > I spotted potential improvement here: current v5 does not support COPY > > completion for a pattern I do frequently u

Re: Improve read_local_xlog_page_guts by replacing polling with latch-based waiting

2025-08-28 Thread Xuneng Zhou
Hi, Some changes in v3: 1) Update the note of xlogwait.c to reflect the extending of its use for flush waiting and internal use for both flush and replay waiting. 2) Update the comment above logical_read_xlog_page which describes the prior-change behavior of read_local_xlog_page. Best, Xuneng v

RE: Logical Replication of sequences

2025-08-28 Thread Hayato Kuroda (Fujitsu)
Dear Shveta, > Say we have triggered REFRESH on sub, and when seq-sync worker is in > copy_sequences() where it has retrieved the local sequence using > seqname while it has not locked the sequence-relation yet, if > meanwhile we alter sequence and change its name, seq-sync worker ends > up syncin

[PATCH] Fix ALTER SYSTEM empty string bug for GUC_LIST_QUOTE parameters

2025-08-28 Thread Andrei Klychkov
Hi Hackers, I'm submitting a patch to fix a bug where ALTER SYSTEM SET with empty strings for GUC_LIST_QUOTE parameters (like shared_preload_libraries) results in malformed configuration entries that cause server crashes on restart. Please take a look, Thanks Andrew # Fix for ALTER SYSTEM Empty

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

2025-08-28 Thread Amit Kapila
On Thu, Aug 28, 2025 at 11:07 AM Ashutosh Sharma wrote: > > We have seen cases where slot synchronization gets delayed, for example when > the slot is behind the failover standby or vice versa, and the slot sync > worker has to wait for one to catch up with the other. During this waiting > peri

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

2025-08-28 Thread Kirill Reshke
On Thu, 28 Aug 2025 at 14:56, Amit Kapila wrote: > > On Thu, Aug 28, 2025 at 11:07 AM Ashutosh Sharma > wrote: > > > > We have seen cases where slot synchronization gets delayed, for example > > when the slot is behind the failover standby or vice versa, and the slot > > sync worker has to wai

Re: Issue with logical replication slot during switchover

2025-08-28 Thread shveta malik
On Wed, Aug 27, 2025 at 7:55 PM Fabrice Chapuis wrote: > > For the first step (a), the pg_create_logical_replication_slot interface is > extended. > The slot on the new attached standby will be dropped and recreated if the > flag allow_overwrite is set to true. > I tested the modified source, co

Re: Conflict detection for update_deleted in logical replication

2025-08-28 Thread shveta malik
On Thu, Aug 28, 2025 at 8:02 AM Zhijie Hou (Fujitsu) wrote: > > > I noticed that Cfbot failed to compile the document due to a typo after > renaming > the subscription option. Here are the updated V67 patches to fix that, only > the doc > in 0001 is modified. > Please find a few comments: pat

Re: eliminate xl_heap_visible to reduce WAL (and eventually set VM on-access)

2025-08-28 Thread Kirill Reshke
On Thu, 28 Aug 2025 at 00:02, Melanie Plageman wrote: > > Do we need to pin vmbuffer here? Looks like > > XLogReadBufferForRedoExtended already pins vmbuffer. I verified this > > with CheckBufferIsPinnedOnce(vmbuffer) just before visibilitymap_pin > > and COPY ... WITH (FREEZE true) test. > > I t

Re: psql: tab-completion support for COPY ... TO/FROM STDIN, STDOUT, and PROGRAM

2025-08-28 Thread Yugo Nagata
Hi > > > > > > Currently, tab completion for COPY only suggests filenames after TO > > > > > > or > > > > > > FROM, even though STDIN, STDOUT, and PROGRAM are also valid syntax > > > > > > options. > > > > > > > > > > > > I'd like to propose improving the tab completion behavior as > > > > > >

Re: Improve LWLock tranche name visibility across backends

2025-08-28 Thread Bertrand Drouvot
Hi, On Wed, Aug 27, 2025 at 02:13:39PM -0500, Sami Imseih wrote: > Thanks for reviewing! > > > === 1 > > > > We need to check if tranche_name is NULL and report an error if that's the > > case. > > If not, strlen() would segfault. > > Added an error. Good call. The error message follows previou

Re: Avoid retaining conflict-related data when no tables are subscribed

2025-08-28 Thread Nisha Moond
On Thu, Aug 28, 2025 at 7:54 AM Zhijie Hou (Fujitsu) wrote: > > Hi, > > My colleague Nisha reported an issue to me off-list: dead tuples can't > be removed when retain_dead_tuples is enabled for a subscription with no > tables. > > This appears to stem from the inability to advance the non-remova

Re: Remove unneeded cast in heap_xlog_lock.

2025-08-28 Thread Kirill Reshke
On Sat, 23 Aug 2025 at 19:57, Peter Eisentraut wrote: > > On 22.08.25 11:59, Álvaro Herrera wrote: > > On 2025-Aug-22, Kirill Reshke wrote: > > > >> I am uncertain about the delineation between when we make changes and > >> when we refrain from doing so. > > > > I think this is natural work after

Re: Conflict detection for update_deleted in logical replication

2025-08-28 Thread Amit Kapila
On Thu, Aug 28, 2025 at 8:02 AM Zhijie Hou (Fujitsu) wrote: > > I noticed that Cfbot failed to compile the document due to a typo after > renaming > the subscription option. Here are the updated V67 patches to fix that, only > the doc > in 0001 is modified. > I have made a number of cosmetic an

Re: Conflict detection for update_deleted in logical replication

2025-08-28 Thread Amit Kapila
On Thu, Aug 28, 2025 at 4:39 PM Amit Kapila wrote: > > On Thu, Aug 28, 2025 at 8:02 AM Zhijie Hou (Fujitsu) > wrote: > > > > I noticed that Cfbot failed to compile the document due to a typo after > > renaming > > the subscription option. Here are the updated V67 patches to fix that, only > > t

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

2025-08-28 Thread shveta malik
On Wed, Aug 27, 2025 at 12:12 PM Masahiko Sawada wrote: > > On Tue, Aug 26, 2025 at 2:32 AM shveta malik wrote: > > > > On Tue, Aug 26, 2025 at 12:54 AM Masahiko Sawada > > wrote: > > > > > > I've attached the updated patch that incorporated the comments and is > > > rebased to the current HEAD

RE: Logical Replication of sequences

2025-08-28 Thread Hayato Kuroda (Fujitsu)
Dear Vignesh, Thanks for updating the patch. Below are my comments. 01. ``` /* Relation is either a sequence or a table */ relkind = get_rel_relkind(subrel->srrelid); if (relkind != RELKIND_SEQUENCE) continue; ``` Can you up