Re: Issue with logical replication slot during switchover

2025-08-29 Thread Shlok Kyal
On Fri, 29 Aug 2025 at 19:28, Fabrice Chapuis wrote: > > Thanks Shveta for your procedure to follow, here is the version 1 of the patch > > Regards, > > Fabrice > > On Fri, Aug 29, 2025 at 5:34 AM shveta malik wrote: >> >> On Thu, Aug 28, 2025 at 9:11 PM Fabrice Chapuis >> wrote: >> > >> > What

Fix an unnecessary cast calling elog in ExecHashJoinImpl

2025-08-29 Thread Tender Wang
Hi, While debugging the HashJoin codes, I noticed below codes in ExecHashJoinImpl(): elog(ERROR, "unrecognized hashjoin state: %d", (int) node->hj_JoinState); The type of hj_JoinState is already int, so the cast seems unnecessary. So I remove it in the attached patch. -- Thanks, Tender Wang Fr

Re: Parallel Apply

2025-08-29 Thread Nisha Moond
Hi, I ran tests to compare the performance of logical synchronous replication with parallel-apply against physical synchronous replication. Highlights === On pgHead:(current behavior) - With synchronous physical replication set to remote_apply, the Primary’s TPS drops by ~60% (≈2.5x

Re: Conflict detection for update_deleted in logical replication

2025-08-29 Thread Nisha Moond
On Fri, Aug 29, 2025 at 11:49 AM Zhijie Hou (Fujitsu) wrote: > > Here is the new version patch set which also addressed Shveta's comments[1]. > Thanks for the patches here, I tested the v68-001 patch alone, please find review comments - 1) If a sub is created with retain_dead_tuples=on but disab

Re: aio/README.md comments

2025-08-29 Thread Xuneng Zhou
Hi, On Sat, Aug 30, 2025 at 6:24 AM Jeff Davis wrote: > > On Fri, 2025-08-29 at 12:32 -0400, Andres Freund wrote: > > I don't really see an advantage of sync in those cases either. > > It seems a bit early to say that it's just there for debugging. But > it's just in a README, so I won't argue th

Re: Improve LWLock tranche name visibility across backends

2025-08-29 Thread Nathan Bossart
I've committed the DSM registry changes. I apologize for the lackluster commit message. My attempts at including all the details ended up being super wordy and hard to read, so I decided to keep it terse and leave out some of the context. I've also attached a rebased patch that addresses all the

Re: SQL:2023 JSON simplified accessor support

2025-08-29 Thread Alexandra Wang
Hi Chao, Thanks for reviewing! On Thu, Aug 28, 2025 at 8:29 PM Chao Li wrote: > > 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": {

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

2025-08-29 Thread Tomas Vondra
On 8/29/25 21:03, Peter Geoghegan wrote: > On Fri, Aug 29, 2025 at 9:10 AM Tomas Vondra wrote: >> Peter, any thoughts on this. Do you think it's reasonable / feasible to >> push the fix? > > I don't feel comfortable pushing that fix today. > Understood. > Honestly, I'm still not sure what to d

Incorrect logic in XLogNeedsFlush()

2025-08-29 Thread Melanie Plageman
Hi, If you call XLogNeedsFlush() immediately after calling XLogFlush() in FlushBuffer(), it can return true. With this diff: diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 350cc0402aa..91c3fe99d6e 100644 --- a/src/backend/storage/buffer/bufmgr.c +++

Re: aio/README.md comments

2025-08-29 Thread Jeff Davis
On Fri, 2025-08-29 at 12:32 -0400, Andres Freund wrote: > I don't really see an advantage of sync in those cases either. It seems a bit early to say that it's just there for debugging. But it's just in a README, so I won't argue the point. I attached some proposed changes based on my understandin

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread David G. Johnston
On Fri, Aug 29, 2025 at 1:02 PM Joel Jacobson wrote: > On Fri, Aug 29, 2025, at 19:27, Pavel Stehule wrote: > > pá 29. 8. 2025 v 18:51 odesílatel Joel Jacobson > napsal: > >> In the meantime, maybe we want to add a catalog function > >> nonnull(anyelement) -> anyelement that throws an error if t

Re: Incremental View Maintenance, take 2

2025-08-29 Thread Yugo Nagata
Hello, I apologize for the long silence. I would like to resume working on this now. Thank you, Kirill Reshke, for your many comments and suggestions. Here are my (admittedly) late responses: > 1) `Add-relisivm-column-to-pg_class-system-catalog` commit message > should be fixed, there is "isimmv

Re: Making jsonb_agg() faster

2025-08-29 Thread Tom Lane
Chao Li writes: > A few more suggestions for pushJsonValue(): > ... > To push WJB_BEGIN_OBJECT and WJB_END_OBJECT, we can directly call > pushJsonValueScalar(), because once entering pushJsonbValue, they will meet > the check of (seq != WJB_ELEM && seq != WJB_VALUE). Directly calling > pushJso

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Joel Jacobson
On Fri, Aug 29, 2025, at 19:27, Pavel Stehule wrote: > pá 29. 8. 2025 v 18:51 odesílatel Joel Jacobson napsal: >> In the meantime, maybe we want to add a catalog function >> nonnull(anyelement) -> anyelement that throws an error if the input is >> NULL? Seems like a function that could be useful i

Re: Adding some error context for lock wait failures

2025-08-29 Thread Tom Lane
Dilip Kumar writes: > On Fri, Jul 11, 2025 at 9:34 AM Zhang Mingli wrote: >> May be confused if there were tables with same names under different schemas. > If that's the only issue we can print schema qualified name, but I > think the problem is in error callback we just have lock tag > informa

Re: Use LW_SHARED in WakeupWalSummarizer() for WALSummarizerLock lock

2025-08-29 Thread Masahiko Sawada
On Mon, Aug 25, 2025 at 5:48 PM Masahiko Sawada wrote: > > On Mon, Aug 25, 2025 at 5:08 PM Nathan Bossart > wrote: > > > > On Mon, Aug 25, 2025 at 03:38:13PM -0700, Masahiko Sawada wrote: > > > While reading walsummarizer.c code, I noticed that in > > > WakeupWalSummarizer() we acquire the WALSu

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Merlin Moncure
On Fri, Aug 29, 2025 at 12:07 PM Tom Lane wrote: > Merlin Moncure writes: > > How does that work in practice? for current SQL (not pl/pgsql) > functions, > > this will fail: > > > create function f() returns int as $$ create temp table i(i int); select > * > > from i; $$ language sql; > > ERROR

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

2025-08-29 Thread Peter Geoghegan
On Fri, Aug 29, 2025 at 9:10 AM Tomas Vondra wrote: > Peter, any thoughts on this. Do you think it's reasonable / feasible to > push the fix? I don't feel comfortable pushing that fix today. Honestly, I'm still not sure what to do. My proposal was to just remove the totally unused options suppor

Re: doc patch: missing tags in protocol.sgml

2025-08-29 Thread Masahiko Sawada
On Thu, Aug 28, 2025 at 6:53 PM Hayato Kuroda (Fujitsu) wrote: > > 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? I guess th

Re: No error checking when reading from file using zstd in pg_dump

2025-08-29 Thread Daniel Gustafsson
> On 24 Aug 2025, at 23:23, Daniel Gustafsson wrote: > I'll work on getting it in at the start of the week. While not exactly the start of the week, this is now done. -- Daniel Gustafsson

Re: Avoid overwiriting cache entry (src/backend/utils/cache/relcache.c)

2025-08-29 Thread Ranier Vilela
Em sex., 29 de ago. de 2025 às 07:58, Álvaro Herrera escreveu: > On 2025-Aug-26, Ranier Vilela wrote: > > > In function *CheckNNConstraintFetch* the array index is > > incremented only when "null combin" is not found. > > > > IMO the last cache entry can be overwriting if the next tuple is null,

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

2025-08-29 Thread Masahiko Sawada
On Fri, Aug 29, 2025 at 2:46 AM Shlok Kyal wrote: > > Hi Sawada-san, > > Thanks for the updated patch. > > I have a doubt. When we create publication (when wal_level is set to > replica) we get a warning: > WARNING: logical decoding needs to be enabled to publish logical changes > HINT: Before c

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

2025-08-29 Thread Sami Imseih
> 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. This version needs another rebase, but I don't think this is a p

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

2025-08-29 Thread Masahiko Sawada
On Fri, Aug 29, 2025 at 5:31 AM Hayato Kuroda (Fujitsu) wrote: > > Dear Sawada-san, > > > My understanding of where the synced slot starts to move was not > > right; it starts from the remote slot's restart_lsn, which could be > > far ahead from the STATUS_CHANGE record that the startup process is

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Tom Lane
Merlin Moncure writes: > How does that work in practice? for current SQL (not pl/pgsql) functions, > this will fail: > create function f() returns int as $$ create temp table i(i int); select * > from i; $$ language sql; > ERROR: relation "i" does not exist Slightly off-topic: that example doe

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
Hi pá 29. 8. 2025 v 16:38 odesílatel Joel Jacobson napsal: > On Fri, Aug 29, 2025, at 16:09, Vik Fearing wrote: > > The implementation is *supposed* to track several things for a query. I > > am not sure PostgreSQL does this accurately or not. > > > > > > The information is available through th

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Merlin Moncure
On Fri, Aug 29, 2025 at 11:45 AM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Fri, Aug 29, 2025 at 10:34 AM Merlin Moncure > wrote: > >> On Fri, Aug 29, 2025 at 1:03 AM Joel Jacobson wrote: >> >>> *) Renaming of database objects seamless, thanks to function body being >>> parsed a

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread David G. Johnston
On Fri, Aug 29, 2025 at 10:34 AM Merlin Moncure wrote: > On Fri, Aug 29, 2025 at 1:03 AM Joel Jacobson wrote: > >> *) Renaming of database objects seamless, thanks to function body being >> parsed at function definition time and stored as expression nodes. > > > How does that work in practice?

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Merlin Moncure
On Fri, Aug 29, 2025 at 1:03 AM Joel Jacobson wrote: > *) Renaming of database objects seamless, thanks to function body being > parsed at function definition time and stored as expression nodes. How does that work in practice? for current SQL (not pl/pgsql) functions, this will fail: create

Re: Support tid range scan in parallel?

2025-08-29 Thread Cary Huang
> The workers are ending their scan early because > heap_getnextslot_tidrange() returns false on the first call from the > parallel worker. Hi David, thank you for the testing! Yes, the previous v9 patch missed setting node->trss_mintid and node->trss_maxtid, causing the parallel workers to ex

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
pá 29. 8. 2025 v 18:51 odesílatel Joel Jacobson napsal: > On Fri, Aug 29, 2025, at 18:17, Pavel Stehule wrote: > >> > >> I am not too serious now, I am just playing (and I remember this > discussion many times). We can "theoretically" introduce new keyword > `EXACT`, that can specify so any DML o

Re: make LWLockCounter a global variable

2025-08-29 Thread Nathan Bossart
On Fri, Aug 29, 2025 at 09:43:26AM -0500, Nathan Bossart wrote: > Good idea. Here's a new version of the patch. If CI is happy with it, > I'll go ahead and commit it. Committed. -- nathan

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Joel Jacobson
On Fri, Aug 29, 2025, at 18:17, Pavel Stehule wrote: >> >> I am not too serious now, I am just playing (and I remember this discussion >> many times). We can "theoretically" introduce new keyword `EXACT`, that can >> specify so any DML or SELECT can process or returns just one row (or with >> o

Re: aio/README.md comments

2025-08-29 Thread Andres Freund
Hi, On 2025-08-29 08:12:36 -0700, Jeff Davis wrote: > aio/README.md: > > * In the section "### IO can be started in critical sections", the > first paragraph seems like it belongs in another section. It explains why we want to eventually want do WAL IO using AIO, which in turn requires AIO to be

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
> > > I am not too serious now, I am just playing (and I remember this > discussion many times). We can "theoretically" introduce new keyword > `EXACT`, that can specify so any DML or SELECT can process or returns just > one row (or with other clause zero rows) > > EXACT ONE SELECT id FROM tab WHER

Re: Unused parameter in ProcessSlotSyncInterrupts()

2025-08-29 Thread Nathan Bossart
Committed. -- nathan

Re: Improve LWLock tranche name visibility across backends

2025-08-29 Thread Nathan Bossart
On Thu, Aug 28, 2025 at 05:53:23PM -0500, Sami Imseih wrote: >> I think this patch set will require reworking the "GetNamedLWLockTranche >> crashes on Windows in normal backend" patch [0], but AFAICT we can easily >> adjust it to scan through NamedLWLockTrancheNames instead. > > Except, we will ne

Re: BUG #18959: Name collisions of expression indexes during parallel Index creations on a pratitioned table.

2025-08-29 Thread Tom Lane
[ moving thread to -hackers for more visibility ] Dilip Kumar writes: > On Fri, Jun 20, 2025 at 2:29 AM Tom Lane wrote: >> Dilip Kumar writes: >>> I haven't reviewed the patch itself, but I like the idea. We're now >>> consistently using the parent index name for partitioned indexes, >>> wheth

aio/README.md comments

2025-08-29 Thread Jeff Davis
aio/README.md: * In the section "### IO can be started in critical sections", the first paragraph seems like it belongs in another section. * The README generally mixes design goals with implemented functionality. For instance, we're only using it on the read path currently, but the README ment

Re: Unused parameter in ProcessSlotSyncInterrupts()

2025-08-29 Thread Nathan Bossart
On Fri, Aug 29, 2025 at 10:40:25PM +0800, cca5507 wrote: > When reading the code about slot sync, I find the $subject, attach a > patch to fix it. LGTM. I looked through the original thread [0] for clues about the origins of this parameter, but it's a very long thread, and ctrl+f didn't help. It

Generate pgstat_count_slru*() functions for slru using macros

2025-08-29 Thread Bertrand Drouvot
Hi hackers, I was looking at pgstat_slru.c (I've in mind to provide some of those metrics per backend), and realized that the same code pattern is repeated 7 times. PFA a patch to $SUBJECT, removing a few lines of originally-duplicated code patterns. In passing, some functions have to be renamed

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

2025-08-29 Thread Tom Lane
Vik Fearing writes: > On 29/08/2025 11:12, Chao Li wrote: >> But a major problem is, I think we should bump CATALOG_VERSION_NO. > Traditionally, the patch committer bumps the catversion, not the patch > author. Yeah. If you include a catversion bump in a submitted patch, you can expect the pa

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Joel Jacobson
On Fri, Aug 29, 2025, at 16:09, Vik Fearing wrote: > The implementation is *supposed* to track several things for a query.  I > am not sure PostgreSQL does this accurately or not. > > > The information is available through the GET DIAGNOSTICS command which > postgres does not support (yet?). > >

Re: headerscheck warnings with late-model gcc

2025-08-29 Thread Tom Lane
Peter Eisentraut writes: > On 07.08.25 16:58, Tom Lane wrote: >> 0004: I prefer the solution I exhibited yesterday, ie add >> externs to those headers. > That solution seems fine, too. Great. > This comment should be clarified: > + # This redundant extern declaration is needed to silence he

Re: make LWLockCounter a global variable

2025-08-29 Thread Nathan Bossart
On Fri, Aug 29, 2025 at 06:52:48AM +, Bertrand Drouvot wrote: > On Thu, Aug 28, 2025 at 05:56:07PM -0400, Tom Lane wrote: >> No objection here. As a small improvement, perhaps you could swap >> around the code in LWLockShmemSize so that the order in which it >> considers size contributions mat

Unused parameter in ProcessSlotSyncInterrupts()

2025-08-29 Thread cca5507
Hi, When reading the code about slot sync, I find the $subject, attach a patch to fix it. -- Regards, ChangAo Chen v1-0001-Remove-unused-parameter-in-ProcessSlotSyncInterru.patch Description: Binary data

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

2025-08-29 Thread Tomas Vondra
On 8/29/25 16:26, Tomas Vondra wrote: > ... > > I've seen these failures after changing checksums in both directions, > both after enabling and disabling. But I've only ever saw this after > immediate shutdown, never after fast shutdown. (It's interesting the > pg_checksums failed only after fast

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

2025-08-29 Thread Tomas Vondra
On 8/27/25 14:42, Tomas Vondra wrote: > On 8/27/25 14:39, Tomas Vondra wrote: >> ... >> >> And this happened on Friday: >> >> commit c13070a27b63d9ce4850d88a63bf889a6fde26f0 >> Author: Alexander Korotkov >> Date: Fri Aug 22 18:44:39 2025 +0300 >> >> Revert "Get rid of WALBufMappingLock" >> >

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

2025-08-29 Thread Vik Fearing
On 29/08/2025 11:12, Chao Li wrote: On Aug 26, 2025, at 22:17, Damien Clochard wrote: Le 25.08.2025 15:33, Greg Sabino Mullane a écrit : Your v3 did not get attached to the previous email. My bad, here it is -- Damien Clochard Code change looks good to me. Maybe we can make check_ra

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Vik Fearing
On 29/08/2025 09:02, Joel Jacobson wrote: Ideas on possible solutions: How about piggy-backing on the CREATE FUNCTION's existing ROWS parameter, and reusing the [ ENFORCED | NOT ENFORCED ] terminology we have for constraints? We would need to lift the current restriction that it is only allowe

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
pá 29. 8. 2025 v 15:47 odesílatel Vik Fearing napsal: > > On 29/08/2025 12:06, Pavel Stehule wrote: > > > I can imagine allowing the NOT NULL flag for functions, and then the >> > result can be checked on NOT NULL value. >> >> I like the idea of a NOT NULL flag for functions. >> What syntax could

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread David G. Johnston
On Friday, August 29, 2025, Joel Jacobson wrote: > > > These were just the two first ideas on the top of my head, please share > yours if you see a better way. > I’d love to just add a new clause to select. Select … Require {exactly|{more|less}than} row_count e.g., exactly 1; more than 0, less

Re: bug: virtual generated column can be partition key

2025-08-29 Thread Ashutosh Bapat
On Tue, May 6, 2025 at 4:19 PM Yura Sokolov wrote: > > you may also see ComputePartitionAttrs. > > I saw it. And I gave links to comments in this function. This comments > clearly state, there is no real reason to forbid GENERATED VIRTUAL columns > (in opposite to STORED). They are forbidden just

Re: Issue with logical replication slot during switchover

2025-08-29 Thread Fabrice Chapuis
Thanks Shveta for your procedure to follow, here is the version 1 of the patch Regards, Fabrice On Fri, Aug 29, 2025 at 5:34 AM shveta malik wrote: > 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. > > > > W

Re: allow benign typedef redefinitions (C11)

2025-08-29 Thread Tom Lane
Peter Eisentraut writes: > Here is the first of several (to come at a later date) patch sets to > take some advantage of C11 features. I haven't checked this line-by-line, but +1 for concept (assuming the build farm is actually happy with it). 0006 and 0007, in particular, clean up some very me

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Vik Fearing
On 29/08/2025 12:06, Pavel Stehule wrote: > I can imagine allowing the NOT NULL flag for functions, and then the > result can be checked on NOT NULL value. I like the idea of a NOT NULL flag for functions. What syntax could we image for that? CREATE OR REPLACE FUNCTION fo

Re: Improve LWLock tranche name visibility across backends

2025-08-29 Thread Sami Imseih
> On Thu, Aug 28, 2025 at 05:53:23PM -0500, Sami Imseih wrote: > > Just a few things that were discussed earlier, that I incorporated now. > > > > 1/ We should be checking that tranche_name is NOT NULL when > > LWLockNewTrancheId or RequestNamedLWLockTranche is called. > > Right, if not strlen() do

Re: Use-after-free in expand_partitioned_rtentry

2025-08-29 Thread Bernd Reiß
Glad I could be of help. I found this through code analysis. I've been working on a custom PG checker, adapting the Clang Static Checker for my bachelor thesis. Always nice to see, when academic work has real world benefits :) Bernd On 8/29/25 3:02 PM, David Rowley wrote: On Fri, 29 Aug 202

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

2025-08-29 Thread Tomas Vondra
On 8/29/25 10:38, Matthias van de Meent wrote: > Hi, > > On Thu, 22 May 2025 at 19:57, Matthias van de Meent > wrote: >> >> On Tue, 20 May 2025, 22:14 Peter Geoghegan, wrote: >>> >>> On Mon, May 12, 2025 at 8:58 AM Peter Geoghegan wrote: I wonder if we can fix this problem by getting rid o

Re: Use-after-free in expand_partitioned_rtentry

2025-08-29 Thread David Rowley
On Fri, 29 Aug 2025 at 23:45, Bernd Reiß wrote: > Thanks for the quick response and the review. Thanks for the report, investigation and patch. I've pushed and backpatched this to 15. v14 doesn't have the RelOptInfo.live_parts field, so it didn't suffer from the issue. Technically, 15 isn't brok

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
pá 29. 8. 2025 v 11:51 odesílatel Joel Jacobson napsal: > On Fri, Aug 29, 2025, at 10:30, Pavel Stehule wrote: > > pá 29. 8. 2025 v 10:16 odesílatel Joel Jacobson > napsal: > >> Can we think of some SQL-standard function way to also prevent against > 0 rows? > >> > > > > I am afraid there is not

Re: pgsql: oauth: Add unit tests for multiplexer handling

2025-08-29 Thread Stefan Kaltenbrunner
On 26.08.25 22:10, Jacob Champion wrote: On Tue, Aug 26, 2025 at 12:48 PM Christoph Berg wrote: This seems to require more linking on Debian bullseye: Bleh. Thanks for the report; looks like none of the bullseye animals in the farm are building with Curl yet. (cc Stefan: guaibasaurus seems l

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

2025-08-29 Thread Hayato Kuroda (Fujitsu)
Dear Sawada-san, > My understanding of where the synced slot starts to move was not > right; it starts from the remote slot's restart_lsn, which could be > far ahead from the STATUS_CHANGE record that the startup process is > applying but where logical decoding should be enabled. It doesn't > happ

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
pá 29. 8. 2025 v 12:22 odesílatel Joel Jacobson napsal: > On Fri, Aug 29, 2025, at 12:12, Pavel Stehule wrote: > > >> Yes, maybe, do you mean something like below? > >> CREATE OR REPLACE FUNCTION fx(_a int) > >> RETURNS bool > >> SET assert_single_row = true > >> BEGIN ATOMIC > >> SELECT id =

Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt

2025-08-29 Thread Álvaro Herrera
On 2025-Aug-29, jian he wrote: > On Fri, Aug 29, 2025 at 5:46 AM Tom Lane wrote: > > WFM, although I think you could shorten it to "tables, materialized > > views, and foreign tables". We generally expect that partitioned > > tables are included when saying "tables", no? I'm not dead set on >

allow benign typedef redefinitions (C11)

2025-08-29 Thread Peter Eisentraut
Here is the first of several (to come at a later date) patch sets to take some advantage of C11 features. This is, I hope, a very gentle start that shouldn't stress even older compilers very much, and should bring some tangible benefits that had already been asked for around here. In C11, ty

Re: Use-after-free in expand_partitioned_rtentry

2025-08-29 Thread Bernd Reiß
Thanks for the quick response and the review. This is admittedly a pretty remote edge case, but still, better safe than sorry. Bernd On 8/29/25 1:29 PM, David Rowley wrote: On Fri, 29 Aug 2025 at 23:16, Bernd Reiß wrote: there seems to be a case of use-after-free in the function expand_par

Re: Use-after-free in expand_partitioned_rtentry

2025-08-29 Thread David Rowley
On Fri, 29 Aug 2025 at 23:16, Bernd Reiß wrote: > there seems to be a case of use-after-free in the function > expand_partitioned_rtentry (src/backend/optimizer/util/inherit.c). In > the NULL-check introduced to handle concurrently detached and dropped > partitions (see [1]), the partition gets re

Use-after-free in expand_partitioned_rtentry

2025-08-29 Thread Bernd Reiß
Hello everyone, there seems to be a case of use-after-free in the function expand_partitioned_rtentry (src/backend/optimizer/util/inherit.c). In the NULL-check introduced to handle concurrently detached and dropped partitions (see [1]), the partition gets removed from the set of live partitio

Re: Trivial fix of code comment

2025-08-29 Thread Daniel Gustafsson
> On 29 Aug 2025, at 13:01, Ashutosh Bapat wrote: > > On Fri, Aug 29, 2025 at 1:45 PM Chao Li wrote: >> >> Hi Hackers, >> >> Simple fix "commits" to "commits" in a test spec file. "make check" passed. > > The patch changes "committs" to "commits" which is what it should do. Agreed, pushed.

Re: Trivial fix of code comment

2025-08-29 Thread Ashutosh Bapat
On Fri, Aug 29, 2025 at 1:45 PM Chao Li wrote: > > Hi Hackers, > > Simple fix "commits" to "commits" in a test spec file. "make check" passed. The patch changes "committs" to "commits" which is what it should do. The change looks good to me. -- Best Wishes, Ashutosh Bapat

Re: Avoid overwiriting cache entry (src/backend/utils/cache/relcache.c)

2025-08-29 Thread Álvaro Herrera
On 2025-Aug-26, Ranier Vilela wrote: > In function *CheckNNConstraintFetch* the array index is > incremented only when "null combin" is not found. > > IMO the last cache entry can be overwriting if the next tuple is null, > because, the fill array fields is not syncronized with array index > incr

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

2025-08-29 Thread Ashutosh Bapat
On Fri, Aug 29, 2025 at 2:37 PM shveta malik wrote: > > On Fri, Aug 29, 2025 at 2:20 PM Ashutosh Bapat > wrote: > > > > @@ -1276,7 +1331,7 @@ wait_for_slot_activity(bool some_slot_updated) > > > > The function is too cute to be useful. The code should be part of > > ReplSlotSyncWorkerMain() just

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-29 Thread jian he
On Tue, Aug 26, 2025 at 4:05 PM Dmitry Koval wrote: > > Hi! > Thanks for the notes and patches! > hi. ORDER BY regclass seems not stable, see https://git.postgresql.org/cgit/postgresql.git/commit/?id=17bcf4f5450430f67b744c225566c9e0e6413e95 some of the SQL tests seem not necessary, so I refactore

Re: Conflict detection for update_deleted in logical replication

2025-08-29 Thread shveta malik
On Fri, Aug 29, 2025 at 11:49 AM Zhijie Hou (Fujitsu) wrote: > > Here is the new version patch set which also addressed Shveta's comments[1]. > Thanks for the patch. On 001 alone, I’m observing a behavior where, if sub1 has stopped retention, and I then create a new subscription sub2, the worker

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Joel Jacobson
On Fri, Aug 29, 2025, at 12:12, Pavel Stehule wrote: >> Yes, maybe, do you mean something like below? >> CREATE OR REPLACE FUNCTION fx(_a int) >> RETURNS bool >> SET assert_single_row = true >> BEGIN ATOMIC >> SELECT id = _a FROM footab WHERE id = _a; END; >> > > maybe, but the question is

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
pá 29. 8. 2025 v 12:05 odesílatel Joel Jacobson napsal: > On Fri, Aug 29, 2025, at 11:52, Pavel Stehule wrote: > >>> Can we think of some SQL-standard function way to also prevent against > 0 rows? > > > > If I remember - in this case, the standard can raise a warning NOT > > FOUND. Against Postg

Re: pg_dump: fix memory leak

2025-08-29 Thread Daniel Gustafsson
> On 29 Aug 2025, at 11:52, Álvaro Herrera wrote: > Hmm, this begs the question -- why do we make generate_restrict_key() > return NULL in that case? Maybe we should redefine its contract to be > that it either returns a valid key, or it calls pg_fatal(). Then > callers don't have to worry abou

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
pá 29. 8. 2025 v 11:51 odesílatel Joel Jacobson napsal: > On Fri, Aug 29, 2025, at 10:30, Pavel Stehule wrote: > > pá 29. 8. 2025 v 10:16 odesílatel Joel Jacobson > napsal: > >> Can we think of some SQL-standard function way to also prevent against > 0 rows? > >> > > > > I am afraid there is not

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Joel Jacobson
On Fri, Aug 29, 2025, at 11:52, Pavel Stehule wrote: >>> Can we think of some SQL-standard function way to also prevent against 0 >>> rows? > > If I remember - in this case, the standard can raise a warning NOT > FOUND. Against Postgres, the warnings can be handled in SQL/PSM - and > you can rai

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
pá 29. 8. 2025 v 10:30 odesílatel Pavel Stehule napsal: > > > pá 29. 8. 2025 v 10:16 odesílatel Joel Jacobson > napsal: > >> On Fri, Aug 29, 2025, at 09:25, Pavel Stehule wrote: >> > pá 29. 8. 2025 v 9:03 odesílatel Joel Jacobson >> napsal: >> ...ideas on syntax... >> >> These were just the two

Re: pg_dump: fix memory leak

2025-08-29 Thread Álvaro Herrera
On 2025-Aug-29, Daniel Gustafsson wrote: > > On 28 Aug 2025, at 16:14, m.korot...@postgrespro.ru wrote: > > > > 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

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Joel Jacobson
On Fri, Aug 29, 2025, at 10:30, Pavel Stehule wrote: > pá 29. 8. 2025 v 10:16 odesílatel Joel Jacobson napsal: >> Can we think of some SQL-standard function way to also prevent against 0 >> rows? >> > > I am afraid there is not nothing. NULL is the correct result in SQL. > SQL allow to check RO

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

2025-08-29 Thread Shlok Kyal
On Fri, 29 Aug 2025 at 09:38, Masahiko Sawada wrote: > > 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 tha

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

2025-08-29 Thread Chao Li
> On Aug 26, 2025, at 22:17, Damien Clochard wrote: > > Le 25.08.2025 15:33, Greg Sabino Mullane a écrit : >> Your v3 did not get attached to the previous email. > > My bad, here it is > > -- > Damien > Clochard Code change looks good to me. Maybe we can make check_range_boundaries() “inl

Re: Qual push down to table AM

2025-08-29 Thread Julien Tachoires
Hi, On Thu, Aug 28, 2025 at 02:57:02AM +0500, Kirill Reshke wrote: > Hi! > I was also always wondering if something like quals pushing can be > implemented in Postgres. It is indeed very beneficial for Column-based > processing in MPP databases, Greenplum and Cloudberry to name a few. I > did my o

Re: pg_dump: fix memory leak

2025-08-29 Thread m . korotkov
Daniel Gustafsson wrote 2025-08-29 10:13: This is not actually a leak since the application will terminate immediately if a restrict key cannot be generated. I agree that the current usage of the function does not present a problem, but there is no certainty that this situation will remain unc

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

2025-08-29 Thread shveta malik
On Fri, Aug 29, 2025 at 2:20 PM Ashutosh Bapat wrote: > > On Fri, Aug 29, 2025 at 11:42 AM Ajin Cherian wrote: > > > > 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 synchroniz

Re: pg_dump: fix memory leak

2025-08-29 Thread Роман Хапов
 This is not actually a leak since the application will terminate immediately ifa restrict key cannot be generated. Seems like this will silence static analyzer and help to find real problems in reduced warning/errors list. --Roman Khapov

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Pavel Stehule
pá 29. 8. 2025 v 10:16 odesílatel Joel Jacobson napsal: > On Fri, Aug 29, 2025, at 09:25, Pavel Stehule wrote: > > pá 29. 8. 2025 v 9:03 odesílatel Joel Jacobson > napsal: > ...ideas on syntax... > >> These were just the two first ideas on the top of my head, please share > >> yours if you see a

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

2025-08-29 Thread Ashutosh Bapat
On Fri, Aug 29, 2025 at 11:42 AM Ajin Cherian wrote: > > 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 pr

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

2025-08-29 Thread shveta malik
On Fri, Aug 29, 2025 at 9:59 AM Masahiko Sawada wrote: > > 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:5

Re: [WiP] B-tree page merge during vacuum to reduce index bloat

2025-08-29 Thread Andrey Borodin
Peter, Matthias, many thanks for your input! > On 28 Aug 2025, at 01:06, Peter Geoghegan wrote: > > Have you benchmarked it? Kind of. Here are bloat charts from random production clusters: Upper green line has an axis on right - it's total index bloat per cluster. Other lines are individual

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

2025-08-29 Thread Matthias van de Meent
Hi, On Thu, 22 May 2025 at 19:57, Matthias van de Meent wrote: > > On Tue, 20 May 2025, 22:14 Peter Geoghegan, wrote: > > > > On Mon, May 12, 2025 at 8:58 AM Peter Geoghegan wrote: > > > I wonder if we can fix this problem by getting rid of the old support > > > routine #5, "options". It curren

Re: Qual push down to table AM

2025-08-29 Thread Julien Tachoires
Hi, On Wed, Aug 27, 2025 at 05:50:01PM -0400, Andres Freund wrote: > On 2025-08-27 22:27:37 +0200, Julien Tachoires wrote: > > Please find attached a patch set proposal intended to implement WHERE > > clauses (qual) push down to the underlying table AM during > > table/sequential scan execution. >

Re: fixing tsearch locale support

2025-08-29 Thread Peter Eisentraut
On 26.08.25 18:52, Heikki Linnakangas wrote: So maybe the release notes should say "now observes the locale provider configured for the database to convert strings to lower case". Is it only used for converting to lower case, or is there any other operations that need to be mentioned? Converti

Re: Assert single row returning SQL-standard functions

2025-08-29 Thread Joel Jacobson
On Fri, Aug 29, 2025, at 09:25, Pavel Stehule wrote: > pá 29. 8. 2025 v 9:03 odesílatel Joel Jacobson napsal: ...ideas on syntax... >> These were just the two first ideas on the top of my head, please share >> yours if you see a better way. >> >> To me, if we can solve this problem, it would mean

Trivial fix of code comment

2025-08-29 Thread Chao Li
Hi Hackers, Simple fix "commits" to "commits" in a test spec file. "make check" passed. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ v1-0001-Update-comments-in-src-test-isolation-specs-eval-.patch Description: Binary data

Re: pg_dump: fix memory leak

2025-08-29 Thread Daniel Gustafsson
> On 29 Aug 2025, at 09:36, m.korot...@postgrespro.ru wrote: > > Daniel Gustafsson wrote 2025-08-29 10:13: >> This is not actually a leak since the application will terminate immediately >> if >> a restrict key cannot be generated. > I agree that the current usage of the function does not present

Re: Adding REPACK [concurrently]

2025-08-29 Thread Antonin Houska
Mihail Nikalayeu wrote: > In case of some incident related to that (in a large well-known > company) the typical takeaway for readers of tech blogs will simply be > "some command in Postgres is broken". For _responsible_ users, the message will rather be that "some tech bloggers do not bother to

  1   2   >