pg_stat_statements: faster search by queryid

2025-09-20 Thread Karina Litskevich
Hi hackers, Aleksandra Bondar and I are proposing the following patch for pg_stat_statements. The idea. - Currently, to get statistics on a specific query, you should execute SELECT * FROM pg_stat_statements WHERE queryid = specific_queryid; This takes a long time because the pg_stat_

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

2025-09-20 Thread Ajin Cherian
On Thu, Sep 4, 2025 at 4:35 PM shveta malik wrote: > > On Wed, Sep 3, 2025 at 3:19 PM Ajin Cherian wrote: > > Thanks for the patch. Please find a few comments: > > 1) > /* Clean up slot_names if allocated in TopMemoryContext */ > if (slot_names) > { > oldcontext = MemoryContextSwitchTo(TopMemoryC

Re: Use WALReadFromBuffers in more places

2025-09-20 Thread Rahila Syed
Hi Bharath, Hi, > > Commit 91f2cae7a4e that introduced WALReadFromBuffers only used it for > physical walsenders. It can also be used in more places benefitting > logical walsenders, backends running pg_walinspect and logical > decoding functions if the WAL is available in WAL buffers. I'm > atta

Re: A performance regression issue with Memoize

2025-09-20 Thread Robert Haas
On Tue, Jul 29, 2025 at 12:57 AM Tom Lane wrote: > David Rowley writes: > > For the record, I 100% agree that there will always be cases where > > statistics are just unable to represent what is discovered at > > run-time, so having some sort of ability to adapt at run-time seems > > like a natur

Re: Proposal for enabling auto-vectorization for checksum calculations

2025-09-20 Thread root
Hi John, Thanks for the feedback. This is v5 of the patchset, updated following your comments: - Moved the function pointer definitions out of common headers and into src/port, consistent with existing practice. Thanks again for the guidance. Best regards, Kim Andrew

Re: [BUG?] check_exclusion_or_unique_constraint false negative

2025-09-20 Thread Mihail Nikalayeu
Rebased. Also, separate thread with some additional explanation is here: https://www.postgresql.org/message-id/flat/cadzflwxzvmbo11tfs_g2i+6tffvwhu4vuuseoqb+8uqfuoj...@mail.gmail.com v12-0002-Fix-logical-replication-conflict-detection-durin.patch Description: Binary data v12-0001-This-patch-i

Re: [PATCH] Accept connections post recovery without waiting for RemoveOldXlogFiles

2025-09-20 Thread Dilip Kumar
On Tue, Sep 9, 2025 at 12:28 PM Amit Kapila wrote: > > On Mon, Sep 8, 2025 at 3:03 PM Nitin Motiani wrote: > > > > I'd like to propose a patch to allow accepting connections post recovery > > without waiting for the removal of old xlog files. > > > > Why : We have seen instances where the crash

Re: encode/decode support for base64url

2025-09-20 Thread Daniel Gustafsson
> On 19 Sep 2025, at 23:04, Daniel Gustafsson wrote: > >> On 18 Sep 2025, at 21:19, Daniel Gustafsson wrote: > >> .. else I'll take care of it tomorrow. > > FWIW since there were new reviews and comments I wanted to allow some more > time > for additional comments, so will do this over the we

Re: psql: Count all table footer lines in pager setup

2025-09-20 Thread Erik Wienhold
On 2025-08-19 03:52 +0200, Erik Wienhold wrote: > On 2025-08-17 17:19 +0200, Tom Lane wrote: > > This appears to fix the problem it sets out to fix, but it looks > > to me like there are adjacent problems of the same ilk; do you > > feel like looking at those? > > > > Specifically, I wondered whet

Re: allow benign typedef redefinitions (C11)

2025-09-20 Thread Tom Lane
=?utf-8?Q?=C3=81lvaro?= Herrera writes: > Here's a proposed fix. I didn't test this, but it passes an eyeball sanity check and looks like an improvement overall. regards, tom lane

Re: BF mamba failure

2025-09-20 Thread Michael Paquier
On Tue, Sep 09, 2025 at 04:07:45PM +0300, Kouber Saparev wrote: > Yet again one of our replicas died. Should I file a bug report or > something, what should we do in order to prevent it? Restart the database > every month/week or so?... I don't think we need another bug to report the same problem.

Re: PostgreSQL 18 GA press release draft

2025-09-20 Thread Jonathan S. Katz
On 9/9/25 11:13 PM, Jonathan S. Katz wrote: Hi, Attached is a draft of the PostgreSQL 18 GA press release. A few comments before the ask for reviewing: * I still need to write up the theme and the quote, which I'll provide tomorrow after hearing the first round of feedback * The release is a

stray references to SubscriptRef type

2025-09-20 Thread Peter Eisentraut
There are several mentions in code comments of a SubscriptRef type, but that type does not exist and AFAICT never existed. (Perhaps it existed in in-development code at some point.) I think in several of those cases this clearly meant the type SubscriptingRef instead. But the mentions in sr

Re: Use merge-based matching for MCVs in eqjoinsel

2025-09-20 Thread David Geier
Hi Ilia! On 05.09.2025 16:03, David Geier wrote: >>> I propose an optimization: when the column datatype supports >>> ordering(i.e., has < and >), we can sort both MCV lists and apply >>> mege-style algorithm to detect matches. This reduces runtime from >>> O(N^2) to O(NlogN), where N is the numbe

Re: Making type Datum be 8 bytes everywhere

2025-09-20 Thread Robert Haas
On Thu, Jul 17, 2025 at 8:10 PM Tom Lane wrote: > In a discussion on Discord (in the PG #core-hacking channel, > which unfortunately is inaccessible to non-members), Andres > and Robert complained about the development/maintenance costs > of continuing to support 32-bit platforms. Here is a modes

Re: OAuth client code doesn't work with Google OAuth

2025-09-20 Thread Jacob Champion
On Tue, Sep 9, 2025 at 1:16 AM Zsolt Parragi wrote: > You still can't add custom scopes to google. But in the most basic use > case for this if you have an organization setup, you can restrict > authentication to that organization. After that there still has to be > a postgres user, and possibly a

RE: Conflict detection for update_deleted in logical replication

2025-09-20 Thread Zhijie Hou (Fujitsu)
On Monday, September 8, 2025 7:21 PM Zhijie Hou (Fujitsu) wrote: > > On Monday, September 8, 2025 3:13 PM Amit Kapila > wrote: > > > > On Fri, Sep 5, 2025 at 5:03 PM Zhijie Hou (Fujitsu) > > > > wrote: > > > > > > Here are v2 patches which addressed above comments. > > > > > > > I have pushed

Re: Unexpected changes of CurrentResourceOwner and CurrentMemoryContext

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

Re: Fix missing EvalPlanQual recheck for TID scans

2025-09-20 Thread David Rowley
On Tue, 16 Sept 2025 at 05:42, Sophie Alpert wrote: > Thanks, this seems sensible given the reality that rescan happens once per > tuple. The `if (node->tss_TidList == NULL)` check you kept from me seems > likewise pointless in v3-0001 but not particularly intrusive (though of > course you use

Re: Improving the names generated for indexes on expressions

2025-09-20 Thread Pavel Stehule
Hi út 16. 9. 2025 v 3:57 odesílatel Tom Lane napsal: > In the wake of the discussion around bug #18959 [1], here is > a modest proposal for improving the names we pick for expression > indexes. The commit message explains the details, but this > example should give the flavor: > > postgres=# cr

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

2025-09-20 Thread Amit Kapila
On Mon, Sep 8, 2025 at 11:14 PM Masahiko Sawada wrote: > > On Fri, Sep 5, 2025 at 8:50 PM Amit Kapila wrote: > > > > On Thu, Sep 4, 2025 at 1:24 AM Masahiko Sawada > > wrote: > > > > > > > > 2. > > > > - /* > > > > - * Invalidate logical slots if we are in hot standby and the primary > > > > -

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

2025-09-20 Thread Sami Imseih
>> This makes me wonder then if all it takes is just adding this to PortalDrop >> (proposed earlier in the thread by Frédéric): > One thing I did not like about that approach is that we will need to > save the current debug_query_string inside PortalDrop before > temporarily setting it to the one

Re: Proposal: Conflict log history table for Logical Replication

2025-09-20 Thread Dilip Kumar
On Thu, Sep 11, 2025 at 8:43 AM Amit Kapila wrote: > > On Thu, Sep 11, 2025 at 12:53 AM Bharath Rupireddy > wrote: > > > > On Tue, Aug 5, 2025 at 5:24 AM Dilip Kumar wrote: > > > > > > Currently we log conflicts to the server's log file and updates, this > > > approach has limitations, 1) Diffic

Re: Having postgresql.org link to cgit instead of gitweb

2025-09-20 Thread Álvaro Herrera
On 2025-Sep-19, Peter Eisentraut wrote: > On 19.09.25 03:12, Jonathan S. Katz wrote: > > * Moves any web links to git.postgresql.org repos to use the cgit > > interface instead of gitweb (e.g. [1]) > > * Update the commit search[2] to use cgit instead of gitweb > > If we're doing that -- which se

Re: Suggestion to add --continue-client-on-abort option to pgbench

2025-09-20 Thread Rintaro Ikeda
Thank you for reviewing the patches. On 2025/09/19 20:56, Yugo Nagata wrote: A client's run is aborted in case of a serious error; for example, the connection with the database server was lost or the end of script was reached without completing the last transaction. The clien

Re: Incorrect logic in XLogNeedsFlush()

2025-09-20 Thread Dilip Kumar
On Fri, Sep 12, 2025 at 10:02 PM Jeff Davis wrote: > > On Fri, 2025-09-12 at 14:04 +0900, Michael Paquier wrote: > > On Fri, Sep 12, 2025 at 10:21:27AM +0530, Dilip Kumar wrote: > > > Yeah, asserting it at the end makes sense, as we can ensure that > > > XLogFlush() and XLogNeedsFlush() agree on t

Re: Having postgresql.org link to cgit instead of gitweb

2025-09-20 Thread Jonathan S. Katz
On 9/19/25 12:17 PM, Tom Lane wrote: Peter Geoghegan writes: cgit messes up indentation by showing 8 space tabs (not 4 space tabs) -- that's certainly not ideal. To me that seems like a complete blocker for this proposal, if we can't find a fix. On a quick read, I believe this is easily set

StatisticsObjIsVisibleExt lacks "do not look in temp namespace"

2025-09-20 Thread Noah Misch
StatisticsObjIsVisibleExt() lacks the "do not look in temp namespace" code of the rest of the non-relation, non-type namespace searches. Patch attached. See its log messages for the consequences. Incidentally, stats on temp tables do default to a permanent schema. That seems fine, though: set s

Re: PgStat_HashKey padding issue when passed by reference

2025-09-20 Thread Ranier Vilela
Em qua., 10 de set. de 2025 às 23:53, Michael Paquier escreveu: > On Mon, Sep 08, 2025 at 09:36:52PM -0500, Sami Imseih wrote: > > But my concern is the flexibility of this approach. If someone is to add > an > > OID field next, they will not be able to as that will be introducing > > padding. O

Re: Update Windows CI Task Names: Server 2022 + VS 2022 Upgrade

2025-09-20 Thread Nazir Bilal Yavuz
Hi, On Mon, 8 Sept 2025 at 11:25, Nazir Bilal Yavuz wrote: > > Example CI task after the PR is merged and 0002 is committed: > https://cirrus-ci.com/build/5976334188412928 (I manually triggered the > VS 2019 task, it will not be run automatically after the 0002 is > committed). I forgot to updat

Re: Extension security improvement: Add support for extensions with an owned schema

2025-09-20 Thread Robert Haas
On Thu, Sep 11, 2025 at 9:29 AM Jelte Fennema-Nio wrote: > You recall incorrectly ;) It only does that when you do: > DROP EXTENSION ... CASCADE > > Otherwise you get errors like this: > > DROP EXTENSION test_ext_owned_schema; > ERROR: cannot drop extension test_ext_owned_schema because other >

Re: Eager aggregation, take 3

2025-09-20 Thread Robert Haas
On Tue, Sep 9, 2025 at 5:20 AM Richard Guo wrote: > Yeah, ideally we should tell whether an aggregate's transition state > may grow unbounded just by looking at system catalogs. Unfortunately, > after trying for a while, it seems to me that the current catalog > doesn't provide enough information

Re: Suggestion to add --continue-client-on-abort option to pgbench

2025-09-20 Thread Yugo Nagata
On Thu, 18 Sep 2025 14:37:29 +0900 Fujii Masao wrote: > On Thu, Sep 18, 2025 at 10:22 AM Yugo Nagata wrote: > > That makes sense. How about rewriting this like: > > > > However, if the --continue-on-error option is specified and the error > > occurs in > > an SQL command, the client does not

Re: AIX support

2025-09-20 Thread Alvaro Herrera
On 2025-Sep-03, Srirama Kucherlapati wrote: > As part of our ongoing efforts to enhance AIX platform compatibility, > we’ve been running the code across all stable PostgreSQL release > branches using the build farm infrastructure. All test suites, > including TAP tests, are passing consistently, i

Re: allow benign typedef redefinitions (C11)

2025-09-20 Thread Álvaro Herrera
On 2025-Sep-19, Tom Lane wrote: > Sooner or later we need to work out a subsystem hierarchy that > can define which headers should be allowed to include which > other ones. I have no clear ideas about what that should look > like, but I think the need for it gets ever more urgent. I agree, we sh

Re: access numeric data in module

2025-09-20 Thread Ed Behn
Good morning- It looks like the proposed change associated with this thread has languished (https://commitfest.postgresql.org/patch/5623/). Is there anything I can do to get it rolling again? -Ed On Sat, Mar 1, 2025 at 5:25 PM Ed Behn wrote: > Tom- > I understand that

Re: Proposal: Conflict log history table for Logical Replication

2025-09-20 Thread Amit Kapila
On Thu, Sep 18, 2025 at 11:46 PM Masahiko Sawada wrote: > > On Thu, Sep 18, 2025 at 1:33 AM Amit Kapila wrote: > > > > If we compare conflict_history_table with the slot that gets created > > with subscription, one can say the same thing about slots. Users can > > drop the slots and whole replica

Re: Use WALReadFromBuffers in more places

2025-09-20 Thread Jingtang Zhang
Hi~ > Thanks for looking at this. Yes, the WAL writers can zero out flushed > buffers before WALReadFromBuffers gets to them. However, > WALReadFromBuffers was intentionally designed as an opportunistic > optimization - it's a "try this first, quickly" approach before > falling back to reading fro

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

2025-09-20 Thread Ashutosh Bapat
On Fri, Sep 12, 2025 at 2:26 PM Ashutosh Bapat wrote: > > On Fri, Sep 12, 2025 at 9:38 AM Amit Kapila wrote: > > > > > > One thing related to this which needs a discussion is after this > > change, it is possible that part of the transaction contains > > additional logical_wal_info. I couldn't th

Re: Introduce XID age based replication slot invalidation

2025-09-20 Thread John H
Hi Hayato, Thank you for taking a look. > > The patch currently attempts to invalidate once-per-autovacuum worker. > > We're wondering if it should attempt invalidation on a per-relation > > basis within the vacuum call itself. That would account for scenarios > > where the cost_delay or naptime