Re: Tighten up range checks for pg_resetwal arguments

2025-12-03 Thread Chao Li
Hi Heikki, This patch looks like a straightforward change, but I see a correctness issue and a few small comments. > On Dec 4, 2025, at 03:07, Heikki Linnakangas wrote: > > While working on the 64-bit multixid offsets patch and commit 94939c5f3a, I > got a little annoyed by how lax pg_resetwa

Re: Cleanup shadows variable warnings, round 1

2025-12-03 Thread Peter Smith
FWIW... A few more review comments for v3. // Patch v3-0001. // == src/backend/access/gist/gistbuild.c 2.1. OK, but should you take it 1 step further? BEFORE foreach(lc, splitinfo) { GISTPageSplitInfo *si = lfirst(lc); AFTER foreach_ptr(GISTPageSplitInfo, si, splitinfo) {

Re: Cleanup shadows variable warnings, round 1

2025-12-03 Thread Michael Paquier
On Fri, Nov 28, 2025 at 11:11:04AM +0200, Heikki Linnakangas wrote: > I don't know if we've agreed on a goal of getting rid of all shadowing, it's > a lot of code churn. I agree shadowing is often confusing and error-prone, > so maybe it's worth it. (Providing my own context with more information

Re:Re: Extended Statistics set/restore/clear functions.

2025-12-03 Thread WangYu
Hi Corey I was reviewing the recent patch v19-0003-Include-Extended-Statistics-in-pg_dump.patch and noticed a couple of small typo issues in the explanatory comments — nothing that affects the functionality. Here are the two minor fixes I’d suggest: 1. “ndistintinct” should be “ndistinct”. 2.

Re: oid2name : add objects file path

2025-12-03 Thread Michael Paquier
On Tue, Dec 02, 2025 at 11:36:39AM +0100, David Bidoc wrote: > I attached the rebased patch. > Any feedback would be appreciated. Your patch still fails to apply on HEAD for all the changes of contrib/oid2name/oid2name.c. Please see the following: https://commitfest.postgresql.org/patch/6111/ It

Re: explain plans for foreign servers

2025-12-03 Thread Sami Imseih
I forgot to mention this point earlier. I noticed GENERIC_PLAN is hard-coded to 1 (true). Is that an oversight, or is it required? ``` + GENERIC_PLAN 1, \ ``` -- Sami Imseih Amazon Web Services (AWS)

Re: Add mode column to pg_stat_progress_vacuum

2025-12-03 Thread Masahiko Sawada
On Mon, Nov 24, 2025 at 6:06 PM Shinya Kato wrote: > > On Tue, Nov 25, 2025 at 8:13 AM Masahiko Sawada wrote: > > > What about “started_by” ? it’s unambiguous and consistent with other > > > columns > > > like “query_start” in pg_stat_activity. > > > > "started_by" sounds reasonable to me. > > T

Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

2025-12-03 Thread Zsolt Parragi
> I ran into this when I was > working on GetNamedDSA() and GetNamedDSHash() Thanks for mentioning these, I didn't notice them when I rebased on the master branch. One of my use cases was this, I implemented something similar to GetNamedDSHash - it's a generic wrapper for dshash in C++, and I ran

Re: Serverside SNI support in libpq

2025-12-03 Thread Daniel Gustafsson
> On 3 Dec 2025, at 22:27, Jelte Fennema-Nio wrote: > > On Wed, 3 Dec 2025 at 17:57, Heikki Linnakangas wrote: >>> I really want to make it possible for anyone who don't want SNI to keep >>> using >>> postgresql.conf and get the exact behavior they've always had. Do you agree >>> with that des

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

2025-12-03 Thread Melanie Plageman
On Mon, Nov 24, 2025 at 3:08 AM Chao Li wrote: > > > On Nov 21, 2025, at 09:09, Chao Li wrote: > > > > I’d stop here today, and continue reviewing rest commits in next week. > > I continue reviewing today. I incorporated all your feedback in my recently posted v23. Thanks for the review! - Mela

Re: Cleanup shadows variable warnings, round 1

2025-12-03 Thread Chao Li
> On Dec 4, 2025, at 05:00, Peter Smith wrote: > > On Thu, Dec 4, 2025 at 1:36 AM Álvaro Herrera wrote: >> >> On 2025-Dec-03, Chao Li wrote: >> >>> Unfortunately that doesn’t work for my compiler (clang on MacOS), >>> that’s why I renamed “I" to “u”. >> >> I think you're missing his point.

Re: [PATCH] Add error hints for invalid COPY options

2025-12-03 Thread Masahiko Sawada
On Tue, Dec 2, 2025 at 3:42 AM Sugamoto Shinya wrote: > > > > On Sat, Nov 29, 2025 at 9:36 PM Sugamoto Shinya wrote: >> >> >> >> On Fri, Nov 28, 2025 at 2:59 AM Kirill Reshke wrote: >>> >>> On Wed, 26 Nov 2025 at 11:55, Sugamoto Shinya wrote: >>> > >>> > >>> > >>> > 2025年11月25日(火) 6:50 Nathan B

Re: explain plans for foreign servers

2025-12-03 Thread Sami Imseih
> I have refactored the commit on the latest version of PG and added a few more > tests. Thanks for the update! > To simplify the roll out of this feature, I decided to work on analyze=false > use case first. I did not go through the entire patch yet, but a few things stood out from my first p

Re: Serverside SNI support in libpq

2025-12-03 Thread Jelte Fennema-Nio
On Wed, 3 Dec 2025 at 17:57, Heikki Linnakangas wrote: > > I really want to make it possible for anyone who don't want SNI to keep > > using > > postgresql.conf and get the exact behavior they've always had. Do you agree > > with that design goal? > > Yeah, that's fair. What if we make it so th

Re: Removing BTScanPosUnpinIfPinned idiom from nbtree, simplifying mark/restore support

2025-12-03 Thread Peter Geoghegan
On Wed, Jun 11, 2025 at 1:29 PM Peter Geoghegan wrote: > Removing BTScanPosUnpinIfPinned allows me to significantly simplify > the management of buffer pins with mark/restore. The patch also gets > rid of all of the calls to IncrBufferRefCount made from > nbtree, since it's no longer necessary to

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

2025-12-03 Thread Masahiko Sawada
On Tue, Dec 2, 2025 at 2:39 PM Peter Smith wrote: > > On Mon, Dec 1, 2025 at 4:50 PM Masahiko Sawada wrote: > > > > On Thu, Nov 27, 2025 at 12:33 AM Peter Smith wrote: > > > > > > Hi Sawada-San. > > > > > > Some review comments for v30-0001. > > > > Thank you for the comments! > > > > > == >

Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

2025-12-03 Thread Nathan Bossart
On Wed, Dec 03, 2025 at 02:59:16PM -0600, Sami Imseih wrote: > Yes, that's true. It will be hard to find other good use-cases that > can't be solved with a global variable, but we can also say this is > a low-cost change, so why not just do it. Well, for one, it requires all existing extensions th

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Tom Lane
Nathan Bossart writes: > On Wed, Dec 03, 2025 at 11:35:07AM -0800, Jacob Champion wrote: >> Could initdb be made to instead give you a user with the power to >> manage almost all of the database (i.e. pg_maintain/pg_monitor), but >> without the power to touch anything outside it or execute arbitra

Re: Cleanup shadows variable warnings, round 1

2025-12-03 Thread Peter Smith
On Thu, Dec 4, 2025 at 1:36 AM Álvaro Herrera wrote: > > On 2025-Dec-03, Chao Li wrote: > > > Unfortunately that doesn’t work for my compiler (clang on MacOS), > > that’s why I renamed “I" to “u”. > > I think you're missing his point. He's suggesting to change not only > this variable, but also t

Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

2025-12-03 Thread Sami Imseih
> On Wed, Dec 03, 2025 at 02:27:29PM -0600, Sami Imseih wrote: > > There are probably other good reasons to allow a generic argument > > to the init callback. Besides the lwlock name, I can see someone > > wanting to pass some other initialization info that may vary > > depending on extension GUCs,

Re: Inval reliability, especially for inplace updates

2025-12-03 Thread Paul A Jungwirth
Surya Poondla (cc'd) and I took another look at this as part of the November Patch Review Workshop. We think it looks good. But I couldn't get the latest patch to apply on top of REL_17_STABLE until I did this: ``` git am inplace160-inval-durability-inplace-v7.patch_v17 git revert bc6bad8857 # re

Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

2025-12-03 Thread Nathan Bossart
On Wed, Dec 03, 2025 at 02:27:29PM -0600, Sami Imseih wrote: > There are probably other good reasons to allow a generic argument > to the init callback. Besides the lwlock name, I can see someone > wanting to pass some other initialization info that may vary > depending on extension GUCs, etc. The

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Nathan Bossart
On Wed, Dec 03, 2025 at 11:35:07AM -0800, Jacob Champion wrote: > Yeah, these conversations tend to get stuck right at this point. > Restricting superuser so that it's somehow not superuser is a huge > (intractable?) undertaking. Doing it a piece at a time doesn't make a > lot of sense if we're not

Re: Newly created replication slot may be invalidated by checkpoint

2025-12-03 Thread Masahiko Sawada
On Tue, Dec 2, 2025 at 10:15 PM Zhijie Hou (Fujitsu) wrote: > > On Wednesday, December 3, 2025 12:26 AM Masahiko Sawada > wrote: > > > > On Mon, Dec 1, 2025 at 10:19 PM Zhijie Hou (Fujitsu) > > wrote: > > > > > > On Tuesday, December 2, 2025 1:03 AM Masahiko Sawada > > wrote: > > > > > > > > O

Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

2025-12-03 Thread Sami Imseih
> My gut feeling is that this is an obscure enough use-case that this > workaround is probably sufficient, but I am interested to hear more... There are probably other good reasons to allow a generic argument to the init callback. Besides the lwlock name, I can see someone wanting to pass some oth

Re: Client-only Meson Build From Sources

2025-12-03 Thread Benjamin Leff
Building only a subset of libraries / binaries would be sufficient for our use case (and even only building a subset of the tree would get us most of the way there). A configure-time switch to only build client binaries would be ideal but perhaps that could be a long term goal. In our fork we tri

Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

2025-12-03 Thread Nathan Bossart
On Wed, Dec 03, 2025 at 12:47:46PM -0600, Sami Imseih wrote: > Can you provide more details on the use-case? I think the main use-case is creating multiple DSM segments in the registry that use the same initialization callback. I ran into this when I was working on GetNamedDSA() and GetNamedDSHas

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Ignat Remizov
Hi Kirill, These are great examples, thanks. I wasn't aware it was that easy to chain config overwrite and crash/restart from plain SQL. Taken together, that makes it clear this GUC buys less than I'd hoped, and is probably not worth the extra complexity on its own. Please consider this patch wi

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Jacob Champion
On Wed, Dec 3, 2025 at 9:03 AM Nathan Bossart wrote: > See also this recent discussion about a --with-copy-program compile flag: > > > https://postgr.es/m/flat/CAGRrpza_WUY_jaN4P-xkN%3DTdqfxH%2BeJJazZAo5gg%3DkQoEaQnVw%40mail.gmail.com Yeah, these conversations tend to get stuck right at

Re: increased duration of stats_ext tests with -DCLOBBER_CACHE_ALWAYS

2025-12-03 Thread Tomas Vondra
On 12/3/25 19:33, Tom Lane wrote: > I wrote: >> Yeah, I can imagine that constantly flushing the cached plan for >> that plpgsql function would be bad. Let me see if I can reformulate >> that test without using a plpgsql function --- right offhand, it's >> not obvious why a built-in function wo

Re: POC: make mxidoff 64 bits

2025-12-03 Thread Heikki Linnakangas
On 01/12/2025 14:35, Ashutosh Bapat wrote: On Mon, Dec 1, 2025 at 2:23 PM Maxim Orlov wrote: On Fri, 28 Nov 2025 at 16:17, Ashutosh Bapat wrote: An UPDATE waits for FOR SHARE query to finish, and vice versa. In my experiments I didn't see an UPDATE creating a multi-xact. Why do we have UPDAT

Re: Consistently use palloc_object() and palloc_array()

2025-12-03 Thread Peter Eisentraut
On 27.11.25 03:53, Thomas Munro wrote: I wondered about this in the context of special alignment requirements[1]. palloc() aligns to MAXALIGN, which we artificially constrain for various reasons that we can't easily change (at least not without splitting on-disk MAXALIGN from allocation MAXALIGN

Tighten up range checks for pg_resetwal arguments

2025-12-03 Thread Heikki Linnakangas
While working on the 64-bit multixid offsets patch and commit 94939c5f3a, I got a little annoyed by how lax pg_resetwal is about out-of-range values. These are currently accepted, for example: # Negative XID pg_resetwal -D data -x -1000 # XID larger than 2^32 (on some platforms) pg_resetwal

Re: Is there value in having optimizer stats for joins/foreignkeys?

2025-12-03 Thread Alexandra Wang
Hi there, Thanks for raising this topic! I am currently working on a POC patch that adds extended statistics for joins. I am polishing the patch now and will post it soon with performance numbers, since there are interests! On Mon, Dec 1, 2025 at 7:16 PM Corey Huinker wrote: > On Mon, Dec 1, 20

Domains on ranges should create a multirange

2025-12-03 Thread Paul A Jungwirth
Hi Hackers, While reviewing https://www.postgresql.org/message-id/CACJufxGoAmN_0iJ%3DhjTG0vGpOSOyy-vYyfE%2B-q0AWxrq2_p5XQ%40mail.gmail.com, I noticed that when you create a domain on a rangetype, you don't get a corresponding multirange. For instance: ``` [v19devel:5432][481380] mr=# create domai

Re: Proposal: Add a callback data parameter to GetNamedDSMSegment

2025-12-03 Thread Sami Imseih
Hi, Can you provide more details on the use-case? > For example, the documentation for creating LWLocks after startup [1] > suggests creating locks in this callback. That works fine as long as > the callback only needs to create a hardcoded lock. The callback is called on the first invocation of

Should ranges validate their subtypes' domains after canonicalization?

2025-12-03 Thread Paul A Jungwirth
Hi Hackers, While reviewing https://www.postgresql.org/message-id/CACJufxGoAmN_0iJ%3DhjTG0vGpOSOyy-vYyfE%2B-q0AWxrq2_p5XQ%40mail.gmail.com, I noticed this inconsistency in how ranges enforce domains over their subtypes: ``` [v19devel:5432][426675] postgres=# create type int4_d_range; CREATE TYPE

Re: domain for WITHOUT OVERLAPS

2025-12-03 Thread Paul A Jungwirth
On Tue, Dec 2, 2025 at 11:39 PM jian he wrote: > > While working on domain IS JSON, I found out that > WITHOUT OVERLAPS does not support for domain too. > but it does support user-defined range types (via CREATE TYPE). > > after looking around: > check_exclusion_or_unique_constraint->ExecWithoutOv

Re: increased duration of stats_ext tests with -DCLOBBER_CACHE_ALWAYS

2025-12-03 Thread Tom Lane
I wrote: > Yeah, I can imagine that constantly flushing the cached plan for > that plpgsql function would be bad. Let me see if I can reformulate > that test without using a plpgsql function --- right offhand, it's > not obvious why a built-in function wouldn't serve the purpose > just as well. I

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Kirill Reshke
On Wed, 3 Dec 2025 at 23:17, I wrote: > (I did derive the exact example > when postgresql immediately restarts after some SQL but im 100% there > is such thing ) Shame on me select repeat('a',1024*1024*1023) from generate_series(1, 100); -- Best regards, Kirill Reshke

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Kirill Reshke
On Wed, 3 Dec 2025 at 23:02, Ignat Remizov wrote: > > On Wed, Dec 3, 2025 at 7:23 PM Kirill Reshke wrote: > > HI! As mentioned here and in nearby threads there is no security > > boundary there between pg superuser and os. > > > > Particularly, PGC_POSTMASTER restricts nothing, and > > GUC_DISALL

Re: Support loser tree for k-way merge

2025-12-03 Thread Sami Imseih
Hi, Thanks for raising this. > Now we use 'heap' during the k-way merge, it's O(n log k). The 'loser tree' > is also O(n log k), but > it's usually has fewer comparisons than the 'heap'. When the tuple comparator > is complex, the > 'loser tree' can significantly speed up the k-way merge. I wa

Proposal: Add a callback data parameter to GetNamedDSMSegment

2025-12-03 Thread Zsolt Parragi
Hello hackers, While developing an extension and trying to write some generic code around DSM areas, I noticed a limitation: although GetNamedDSMSegment accepts a callback function, there is no way to pass additional arguments to that callback. For example, the documentation for creating LWLocks

Re: Simplify code building the LR conflict messages

2025-12-03 Thread Mihail Nikalayeu
Hello, everyone! On Wed, Dec 3, 2025 at 3:41 PM Álvaro Herrera wrote: > I think it's odd that conflict resolution depends on log entries. I > think it would be much more valuable if conflict reporting would save > the details of the conflict to some kind of conflict logging table. > How exactly

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Ignat Remizov
On Wed, Dec 3, 2025 at 7:23 PM Kirill Reshke wrote: > HI! As mentioned here and in nearby threads there is no security > boundary there between pg superuser and os. > > Particularly, PGC_POSTMASTER restricts nothing, and > GUC_DISALLOW_IN_AUTO_FILE does not prevent superuser access to > postgresql

Re: IPC/MultixactCreation on the Standby server

2025-12-03 Thread Heikki Linnakangas
On 01/12/2025 14:40, Heikki Linnakangas wrote: On 30/11/2025 14:15, Andrey Borodin wrote: On 29 Nov 2025, at 00:51, Heikki Linnakangas wrote: I moved the wraparound test to a separate test file and commit. More test coverage is good, but it's quite separate from the bugfix and the wraparound r

Re: Returning nbtree posting list TIDs in DESC order during backwards scans

2025-12-03 Thread Peter Geoghegan
On Wed, Dec 3, 2025 at 7:32 AM Chao Li wrote: > The old code only sets so->numKilled to 0 and reuse memory of > so->killedItems[], now the new code always bms_free(so->killedItems) and > re-alloc memory when next time adding a member to bms. > > I am think that, if there were bms_clear(), then w

Re: pgindent versus struct members and typedefs

2025-12-03 Thread Álvaro Herrera
On 2025-Dec-03, Andrew Dunstan wrote: > +1. One of the things I find particularly un-aesthetic is having some > branches of an if statement with braces and some without. We have lots of > cases of that, but I try to avoid it. I actually prefer that style: when there are only two branches, and the

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Kirill Reshke
On Wed, 3 Dec 2025 at 21:45, Ignat Remizov wrote: > > Thanks for the feedback Euler. > > On Wed, Dec 3, 2025 at 5:59 PM Euler Taveira wrote: > > You are blocking one of the various ways to run malicious code using the > > postgres user. If it doesn't work the attacker will try another method. If

Re: SQL Property Graph Queries (SQL/PGQ)

2025-12-03 Thread Ashutosh Bapat
On Tue, Dec 2, 2025 at 3:30 PM Ashutosh Bapat wrote: > > On Tue, Nov 25, 2025 at 7:22 PM Peter Eisentraut wrote: > > > > > - I'm not so sure about the semantics chosen in the patch "Access > > permissions on property graph". I think according to the SQL standard, > > once you have access to the

Re: IPC/MultixactCreation on the Standby server

2025-12-03 Thread Heikki Linnakangas
On 03/12/2025 16:19, Dmitry Yurichev wrote: On 12/2/25 16:48, Heikki Linnakangas wrote: Thanks! Agreed, v14-16 were the same. v17 and v18 might be worth testing separately, to make sure I didn't e.g. screw up the locking differences. I tested on the REL_18_1 tag (with applying v15-pg18-0001-S

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Nathan Bossart
On Wed, Dec 03, 2025 at 10:02:44AM -0500, Tom Lane wrote: > This argument is nonsense, because if you've got superuser you can > just change the GUC's setting again. Not to mention all the *other* > ways that a superuser can break out to the OS level. I don't think > this proposal adds anything e

Re: Serverside SNI support in libpq

2025-12-03 Thread Heikki Linnakangas
On 03/12/2025 18:52, Daniel Gustafsson wrote: On 3 Dec 2025, at 10:57, Heikki Linnakangas wrote: Do we need the GUC? It feels a little confusing that a GUC affects how the settings in the pg_hosts.conf are interepreted. It'd be nice if you could open pg_hosts.conf in an editor, and see at one

Re: Use func(void) for functions with no parameters

2025-12-03 Thread Nathan Bossart
Committed. -- nathan

Re: Serverside SNI support in libpq

2025-12-03 Thread Daniel Gustafsson
> On 3 Dec 2025, at 10:57, Heikki Linnakangas wrote: > > Sorry for jumping in so late. Not at all, thanks for looking! > Do we need the GUC? It feels a little confusing that a GUC affects how the > settings in the pg_hosts.conf are interepreted. It'd be nice if you could > open pg_hosts.conf

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Ignat Remizov
Thanks for the feedback Euler. On Wed, Dec 3, 2025 at 5:59 PM Euler Taveira wrote: > You are blocking one of the various ways to run malicious code using the > postgres user. If it doesn't work the attacker will try another method. If you > want to prevent the majority of attacks, you need to for

Re: Use func(void) for functions with no parameters

2025-12-03 Thread Nathan Bossart
On Wed, Dec 03, 2025 at 03:53:37PM +, Bertrand Drouvot wrote: > The buildfarm animal remark makes me think to check with -Wstrict-prototypes > and -Wold-style-definition. I just did that and found two more (added in v2 > attached) that the coccinelle script missed... > > Those new two (run_app

Re: Buffer locking is special (hints, checksums, AIO writes)

2025-12-03 Thread Andres Freund
Hi, On 2025-12-02 19:47:35 -0500, Andres Freund wrote: > On 2025-11-25 11:54:00 -0500, Andres Freund wrote: > > Thanks a lot for that detailed review! A few questions and comments, > > before I > > try to address the comments in the next version. > > Here's that new new version, with the follow

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Euler Taveira
On Wed, Dec 3, 2025, at 7:37 AM, Ignat Remizov wrote: > In practice, COPY ... PROGRAM is a common code execution vector in > PostgreSQL-based attacks. It is: > > - Simple to use (single SQL statement) > - Requires no additional extensions or setup > - Frequently targeted by automated botnets

Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY

2025-12-03 Thread Álvaro Herrera
On 2025-Dec-03, Mihail Nikalayeu wrote: > Oh, my bad, sorry. > Attached patch with output variant for > RELCACHE_FORCE_RELEASE\CATCACHE_FORCE_RELEASE case. I have pushed this, thanks. > But for CLOBBER_CACHE_ALWAYS - it is just a mess, too many different > kinds of wakeup loops need to be done.

Re: Remove useless pointer advance in StatsShmemInit()

2025-12-03 Thread Bertrand Drouvot
Hi, On Wed, Dec 03, 2025 at 10:13:55AM -0500, Andres Freund wrote: > On 2025-12-03 08:14:41 +, Bertrand Drouvot wrote: > > So, what about documenting them all? > > I'm -0.1 on that. I think it's just as likely that those code comments will > not be moved when another chunk of memory is needed

Re: Use func(void) for functions with no parameters

2025-12-03 Thread Bertrand Drouvot
Hi, On Wed, Dec 03, 2025 at 10:15:41AM -0500, Tom Lane wrote: > Matthias van de Meent writes: > > I noticed the only changes here are for `static` definitions. Are we > > just more careful with normal functions, or does the compiler complain > > more easily about such "incomplete" definitions whe

Re: Minor LLVM cleanups

2025-12-03 Thread Andres Freund
Hi, On 2025-11-28 16:41:46 +1300, Thomas Munro wrote: > 0001: These days we handle LLVM API evolution with LLVM_VERSION_MAJOR > guards. These GDB and Perf support probes escaped recent garbage > collection cycles by not being phrased like that. Function probes are > generally better for cross-

Re: pgindent versus struct members and typedefs

2025-12-03 Thread Andrew Dunstan
On 2025-12-02 Tu 6:31 PM, Chao Li wrote: On Dec 3, 2025, at 07:13, Tom Lane wrote: Chao Li writes: On Dec 3, 2025, at 06:51, Tom Lane wrote: In this case, I think pgindent is indirectly enforcing good style. I do not like omitting braces around anything that's more than one line; readers hav

Re: Segmentation fault on proc exit after dshash_find_or_insert

2025-12-03 Thread Andres Freund
Hi, On 2025-12-02 13:10:29 +0900, Amit Langote wrote: > On Fri, Nov 21, 2025 at 8:45 PM Rahila Syed wrote: > > > > Hi, > > > > If a process encounters a FATAL error after acquiring a dshash lock but > > before releasing it, > > and it is not within a transaction, it can lead to a segmentation fa

Re: increased duration of stats_ext tests with -DCLOBBER_CACHE_ALWAYS

2025-12-03 Thread Tom Lane
Tomas Vondra writes: > On 12/2/25 17:05, Tomas Vondra wrote: >> So it was ~19h for a while (started at ~14h about 4y back). And then >> between September 14 and 22 it jumped to ~32h. Which seems like a lot. > After bisecting this, it seems to have changed in this commit: > commit 1eccb93150707ac

Re: Returning nbtree posting list TIDs in DESC order during backwards scans

2025-12-03 Thread Mircea Cadariu
Hi, On 03/12/2025 03:08, Peter Geoghegan wrote: Coming back to this patch now, after several months of work on index prefetching. Nice, welcome back! It would be great to wrap this up. Tomas Vondra suggested that I keep killedItems as a separate allocation (as it is on master), while using a

Re: Returning nbtree posting list TIDs in DESC order during backwards scans

2025-12-03 Thread Victor Yegorov
ср, 3 дек. 2025 г. в 06:09, Peter Geoghegan : > Coming back to this patch now, after several months of work on index > prefetching. > > I decided that it wasn't such a great idea to reuse/steal an unused > "itemDead" bit from the BTScanPosItem.itemOffset field after all. That > forces _bt_killitem

Re: Cleanup shadows variable warnings, round 1

2025-12-03 Thread Andres Freund
Hi, On 2025-12-03 10:28:36 +0800, Chao Li wrote: > I know -Wshadow=compatible-local is not supported by all compilers, some > compilers may fallback to -Wshadow and some may just ignore it. This patch > set has cleaned up all shadow-variable warnings, once the cleanup is done, > in theory, we shou

Re: Use func(void) for functions with no parameters

2025-12-03 Thread Tom Lane
Matthias van de Meent writes: > I noticed the only changes here are for `static` definitions. Are we > just more careful with normal functions, or does the compiler complain > more easily about such "incomplete" definitions when they're in > headers or need to be linked against? Some years ago we

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Ignat Remizov
Ashutosh Bapat writes: > Adding a feature which allows a system to run with compromisable > superuser credentials doesn't seem like something the community > usually accepts. Ashutosh, I think there’s a misunderstanding. This doesn’t "allow" running with weak superuser creds; it’s a hardening to

Re: Remove useless pointer advance in StatsShmemInit()

2025-12-03 Thread Andres Freund
Hi, On 2025-12-03 08:14:41 +, Bertrand Drouvot wrote: > On Tue, Dec 02, 2025 at 03:00:39PM -0500, Andres Freund wrote: > > On 2025-12-02 07:40:44 +, Bertrand Drouvot wrote: > > > From 2fefb69f1462ce1057bb5c3d07ed70c769ec961a Mon Sep 17 00:00:00 2001 > > > From: Bertrand Drouvot > > > Date

Re: Use func(void) for functions with no parameters

2025-12-03 Thread Matthias van de Meent
On Wed, 3 Dec 2025 at 15:51, Bertrand Drouvot wrote: > > Hi hackers, > > In C standards till C17, func() means "unspecified parameters" while > func(void) > means "no parameters". The former disables compile time type checking and was > marked obsolescent in C99 ([1]). > > This patch replaces emp

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Tom Lane
Ignat Remizov writes: > pg_execute_server_program is sufficient for non‑superusers, but superusers > always bypass it. In the incident that prompted this, the attacker obtained > superuser via weak/default creds on an exposed instance (common in shared > dev > or staging setups). From there, COPY

Use func(void) for functions with no parameters

2025-12-03 Thread Bertrand Drouvot
Hi hackers, In C standards till C17, func() means "unspecified parameters" while func(void) means "no parameters". The former disables compile time type checking and was marked obsolescent in C99 ([1]). This patch replaces empty parameter lists with explicit void to enable proper type checking an

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Ashutosh Bapat
On Wed, Dec 3, 2025 at 6:07 PM Ignat Remizov wrote: > > Thanks for looking, Ashutosh. > > pg_execute_server_program is sufficient for non‑superusers, but superusers > always bypass it. In the incident that prompted this, the attacker obtained > superuser via weak/default creds on an exposed instan

Re: Simplify code building the LR conflict messages

2025-12-03 Thread Álvaro Herrera
On 2025-Dec-01, Amit Kapila wrote: > The reason for displaying in this style is that, in conflicts, users > may want to define their custom resolution strategies based on > conflict_type. Sometimes they need to resolve conflicts manually as > well. To make an informed decision on which version of

Re: Cleanup shadows variable warnings, round 1

2025-12-03 Thread Álvaro Herrera
On 2025-Dec-03, Chao Li wrote: > Unfortunately that doesn’t work for my compiler (clang on MacOS), > that’s why I renamed “I" to “u”. I think you're missing his point. He's suggesting to change not only this variable, but also the other uses of "i" in this function. I'd also change "unsigned" t

Re: increased duration of stats_ext tests with -DCLOBBER_CACHE_ALWAYS

2025-12-03 Thread Tomas Vondra
On 12/2/25 17:05, Tomas Vondra wrote: > ... > > So it was ~19h for a while (started at ~14h about 4y back). And then > between September 14 and 22 it jumped to ~32h. Which seems like a lot. > > And that seems to be due to stats_ext changing from > > ok 157 + stats_ext

Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY

2025-12-03 Thread Álvaro Herrera
On 2025-Dec-03, Mihail Nikalayeu wrote: > Oh, my bad, sorry. > Attached patch with output variant for > RELCACHE_FORCE_RELEASE\CATCACHE_FORCE_RELEASE case. Thanks. > But for CLOBBER_CACHE_ALWAYS - it is just a mess, too many different > kinds of wakeup loops need to be done. Hmm, maybe we can d

Re: IPC/MultixactCreation on the Standby server

2025-12-03 Thread Dmitry Yurichev
On 12/2/25 16:48, Heikki Linnakangas wrote: Thanks! Agreed, v14-16 were the same. v17 and v18 might be worth testing separately, to make sure I didn't e.g. screw up the locking differences. I tested on the REL_18_1 tag (with applying v15-pg18-0001-Set-next-multixid-s-offset-when-creating-a-.pa

Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?

2025-12-03 Thread Robert Haas
On Wed, Dec 3, 2025 at 6:03 AM David Geier wrote: > I'm wondering how to best do a GUC for something that is potentially > unavailable on the system. In that case the GUC would be superfluous. > Maybe a boolean "enable_try_fast_clocksource" GUC or a "clocksource" > enum GUC which can be "default"

Re: Resetting recovery target parameters in pg_createsubscriber

2025-12-03 Thread Robert Haas
On Wed, Dec 3, 2025 at 12:11 AM Michael Paquier wrote: > Robert, does this line of arguments address the concerns you had > upthread? Or do you still see a reason why not cleaning up these > recovery parameters would not be a good idea? > > I don't see a strong need for a backpatch here as the ap

Re: apply_scanjoin_target_to_paths and partitionwise join

2025-12-03 Thread Robert Haas
On Mon, Dec 1, 2025 at 9:15 PM Richard Guo wrote: > I kind of wonder whether having these two distinct Append paths for > partitioned join relations could lead to the problems described in the > code comments: redundant path generation work, and cross-platform plan > variations. It's a reasonable

Re: proposal: schema variables

2025-12-03 Thread Jim Jones
Hi Pavel On 03/12/2025 05:27, Pavel Stehule wrote: > Hi > > fresh rebase after a87987cafca683e9076c424f99bae117211a83a4 I'm going through the patch again and have a few initial comments. == Memory Management == DROP VARIABLE seems to be leaking memory: postgres=# CREATE TEMPORARY VARIABLE va

Re: Support loser tree for k-way merge

2025-12-03 Thread cca5507
> So on specific data, the heap may be better than the loser tree. But I think  > the possibility > is very small. For example, a column contains all the same values, so the heap can always early return when replacing top. -- Regards, ChangAo Chen

Re: Support loser tree for k-way merge

2025-12-03 Thread cca5507
Hi Heikki, > What is the worst case scenario for the loser tree, where the heap is  > faster? How big is the difference? In tuplesort_heap_replace_top(), it has 2 comparisons each level, but it can early return if the parent less than both child. In tuplesort_loser_tree_adjust(), it has 1 compa

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Ignat Remizov
Thanks for looking, Ashutosh. pg_execute_server_program is sufficient for non‑superusers, but superusers always bypass it. In the incident that prompted this, the attacker obtained superuser via weak/default creds on an exposed instance (common in shared dev or staging setups). From there, COPY PR

Re: Returning nbtree posting list TIDs in DESC order during backwards scans

2025-12-03 Thread Chao Li
Hi Peter, The patch v4 looks carefully written and technically solid, and the core logic (switching killedItems[] to Bitmapset and reworking backwards posting list scans) is coherent. I just got a few comments/questions: > On Dec 3, 2025, at 11:08, Peter Geoghegan wrote: > > Attached is v4,

RE: Using MyDatabaseId in SET_LOCKTAG_APPLY_TRANSACTION

2025-12-03 Thread Hayato Kuroda (Fujitsu)
Dear Maxim, I recalled my post [1]. The database id is helpful when we output lock information by DescribeLockTag(). Since it would be called when the system might be under the deadlock, any locks should not be acquired even AccessShare. It can be done if catcache is missed. [1]: https://www.pos

Re: Support loser tree for k-way merge

2025-12-03 Thread Heikki Linnakangas
On 03/12/2025 13:48, cca5507 wrote: With the WIP patch(v1-0001), I got a 3% ~ 13%(different work_mem) speed up in the following test case: Nice speedup! 1) Now I add a GUC 'enable_loser_tree' to control the use of loser tree, maybe we should decide whether to use the 'loser tree' based on t

Re: POC: make mxidoff 64 bits

2025-12-03 Thread Heikki Linnakangas
On 03/12/2025 11:54, Maxim Orlov wrote: The biggest problem with compression, in my opinion, is that losing even one byte causes the loss of the entire compressed block in the worst case scenario. After all, we still don't have checksums for the SLRU's, which is a shame by itself. Again, I'm not

Support loser tree for k-way merge

2025-12-03 Thread cca5507
Hi hackers, Background == Now we use 'heap' during the k-way merge, it's O(n log k). The 'loser tree' is also O(n log k), but it's usually has fewer comparisons than the 'heap'. When the tuple comparator is complex, the 'loser tree' can significantly speed up the k-way merge. Test

Re: [PATCH] Add enable_copy_program GUC to control COPY PROGRAM

2025-12-03 Thread Ashutosh Bapat
On Wed, Dec 3, 2025 at 4:08 PM Ignat Remizov wrote: > > Hi Postgres hackers, > > Attached is a patch that introduces a new server-level configuration > parameter, "enable_copy_program", that allows administrators to disable > COPY ... PROGRAM functionality at the PostgreSQL server level. > > > MOT

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

2025-12-03 Thread Amit Kapila
On Wed, Dec 3, 2025 at 8:51 AM Ajin Cherian wrote: > > Attaching patch v28 addressing these comments. > Can we extract the part of the patch that handles SIGUSR1 signal separately as a first patch and the remaining as a second patch? Please do mention the reason in the commit message as to why we

Re: Safer hash table initialization macro

2025-12-03 Thread Bertrand Drouvot
Hi, On Mon, Dec 01, 2025 at 03:44:41PM +0100, Jelte Fennema-Nio wrote: > On Mon, 1 Dec 2025 at 14:45, Bertrand Drouvot > wrote: > > Thoughts? > > I think the hashtable creation API in postgres is so terrible that it > actively discourages usage. Thanks for sharing your thoughts! > So I'm defin

Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?

2025-12-03 Thread David Geier
On 19.11.2025 20:36, Robert Haas wrote: > On Wed, Nov 19, 2025 at 11:55 AM Lukas Fittl wrote: >> Overall, I'm still thinking a GUC might be the way to go, but I don't think >> anyone else was enthusiastic about that idea :) > > Reliable feature auto-detection is the best option, but if that's no

RE: Fix START_REPLICATION failure with publication names containing backslashes

2025-12-03 Thread Zhijie Hou (Fujitsu)
On Wednesday, December 3, 2025 5:51 PM vignesh C wrote: > > Hi, > > While reviewing another patch, I noticed that START_REPLICATION fails > to parse publication names that contain backslash characters (e.g. \0, > \n), even though such names are perfectly valid when used with CREATE > PUBLICATION

Re: List TAP test files in makefiles

2025-12-03 Thread Peter Eisentraut
On 01.09.25 07:09, Peter Eisentraut wrote: On 23.08.25 08:09, Peter Eisentraut wrote: meson.build files have to list TAP test files explicitly.  Makefiles have been relying on a t/*.pl wildcard.  As a consequence, it is traditional now that many developers who are primarily using make forget t

Re: Using MyDatabaseId in SET_LOCKTAG_APPLY_TRANSACTION

2025-12-03 Thread Maxim Orlov
On Wed, 3 Dec 2025 at 12:38, Heikki Linnakangas wrote: > > Even with 64-bit XIDs, you can't have transactions older than 2^31 still > running, right? So AFAICS you can continue using 32-bit XID in LOCKTAG. > > Actually, I can, and some brave people do just that. Although it is bad for a number of

  1   2   >