Re: Partitioned tables and [un]loggedness

2024-09-08 Thread Michael Paquier
On Tue, Sep 03, 2024 at 10:33:02AM -0500, Nathan Bossart wrote: > This works correctly for CREATE TABLE, but ALTER TABLE still succeeds. > Interestingly, it doesn't seem to actually change relpersistence for > partitioned tables. I think we might need to adjust > ATPrepChangePersistence(). Adjust

Re: per backend I/O statistics

2024-09-08 Thread Bertrand Drouvot
Hi, On Fri, Sep 06, 2024 at 03:03:17PM +, Bertrand Drouvot wrote: > - If we agree on the current proposal then I'll do some refactoring in > pg_stat_get_backend_io(), pg_stat_get_my_io() and pg_stat_get_io() to avoid > duplicated code (it's not done yet to ease the review). Please find atta

Re: Allow logical failover slots to wait on synchronous replication

2024-09-08 Thread shveta malik
On Fri, Aug 30, 2024 at 12:56 AM John H wrote: > > Hi Shveta, > > Thanks for reviewing it so quickly. > > On Thu, Aug 29, 2024 at 2:35 AM shveta malik wrote: > > > > Thanks for the patch. Few comments and queries: > > > > 1) > > + static XLogRecPtr lsn[NUM_SYNC_REP_WAIT_MODE]; > > > > We sh

Re: Invalid Assert while validating REPLICA IDENTITY?

2024-09-08 Thread Dilip Kumar
On Fri, Sep 6, 2024 at 4:48 PM vignesh C wrote: > > On Mon, 2 Sept 2024 at 18:22, Dilip Kumar wrote: > > > > On Mon, Sep 2, 2024 at 3:32 PM Amit Kapila wrote: > > > > > > On Mon, Sep 2, 2024 at 11:21 AM Dilip Kumar wrote: > > > > > > > > While working on some other code I noticed that in > > >

Re: Commit Timestamp and LSN Inversion issue

2024-09-08 Thread Nisha Moond
On Wed, Sep 4, 2024 at 12:23 PM shveta malik wrote: > > Hello hackers, > (Cc people involved in the earlier discussion) > > I would like to discuss the $Subject. > > While discussing Logical Replication's Conflict Detection and > Resolution (CDR) design in [1] , it came to our notice that the > c

Re: Virtual generated columns

2024-09-08 Thread Peter Eisentraut
On 05.09.24 10:27, jian he wrote: On Wed, Sep 4, 2024 at 4:40 PM Peter Eisentraut wrote: Here is an implementation of this. It's much nicer! It also appears to fix all the additional test cases that have been presented. (I haven't integrated them into the patch set yet.) I left the 0001 p

Re: Virtual generated columns

2024-09-08 Thread Peter Eisentraut
On 04.09.24 12:33, Dean Rasheed wrote: I left the 0001 patch alone for now and put the new rewriting implementation into 0002. (Unfortunately, the diff is kind of useless for visual inspection.) Let me know if this matches what you had in mind, please. Also, is this the right place in fireRIRr

Re: race condition in pg_class

2024-09-08 Thread Nitin Motiani
On Sat, Sep 7, 2024 at 12:25 AM Noah Misch wrote: > > On Fri, Sep 06, 2024 at 03:22:48PM +0530, Nitin Motiani wrote: > > Thanks. I have no other comments. > > https://commitfest.postgresql.org/49/5090/ remains in status="Needs review". > When someone moves it to status="Ready for Committer", I wil

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread shveta malik
On Sun, Sep 8, 2024 at 5:25 PM Bharath Rupireddy wrote: > > > Please find the v45 patch. Addressed above and Shveta's review comments [1]. > Thanks for the patch. Please find my comments: 1) src/sgml/config.sgml: + Synced slots are always considered to be inactive because they don't perform lo

Re: long-standing data loss bug in initial sync of logical replication

2024-09-08 Thread Shlok Kyal
On Mon, 2 Sept 2024 at 10:12, Amit Kapila wrote: > > On Fri, Aug 30, 2024 at 3:06 PM Shlok Kyal wrote: > > > > Next I am planning to test solely on the logical decoding side and > > will share the results. > > > > Thanks, the next set of proposed tests makes sense to me. It will also > be useful

Re: long-standing data loss bug in initial sync of logical replication

2024-09-08 Thread Shlok Kyal
On Mon, 2 Sept 2024 at 10:12, Amit Kapila wrote: > > On Fri, Aug 30, 2024 at 3:06 PM Shlok Kyal wrote: > > > > Next I am planning to test solely on the logical decoding side and > > will share the results. > > > > Thanks, the next set of proposed tests makes sense to me. It will also > be useful

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread shveta malik
On Mon, Sep 9, 2024 at 10:26 AM Bharath Rupireddy wrote: > > Hi, > > On Mon, Sep 9, 2024 at 9:17 AM shveta malik wrote: > > > > > We should not allow the invalid replication slot to be altered > > > irrespective of the reason unless there is any benefit. > > > > Okay, then I think we need to chan

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread Bharath Rupireddy
Hi, On Mon, Sep 9, 2024 at 9:17 AM shveta malik wrote: > > > We should not allow the invalid replication slot to be altered > > irrespective of the reason unless there is any benefit. > > Okay, then I think we need to change the existing behaviour of the > other invalidation causes which still al

Re: Sort functions with specialized comparators

2024-09-08 Thread Andrey M. Borodin
> On 9 Sep 2024, at 02:31, David Rowley wrote: > > Also, unless Andrey is happy for you to tag onto the work he's doing, > I'd suggest another thread for that work. I don't think there's any > good reason for that work to delay Andrey's work. Stepan asked for mentoring project, so I handed hi

Re: On disable_cost

2024-09-08 Thread Richard Guo
On Fri, Sep 6, 2024 at 5:27 PM Richard Guo wrote: > On Fri, Sep 6, 2024 at 5:00 PM Alexander Lakhin wrote: > > static void > > label_sort_with_costsize(PlannerInfo *root, Sort *plan, double limit_tuples) > > { > > ... > > cost_sort(&sort_path, root, NIL, > >lefttree->total_co

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread shveta malik
On Thu, Sep 5, 2024 at 9:30 AM Amit Kapila wrote: > > On Wed, Sep 4, 2024 at 9:17 AM shveta malik wrote: > > > > On Tue, Sep 3, 2024 at 3:01 PM shveta malik wrote: > > > > > > > > > 1) > > > I see that ReplicationSlotAlter() will error out if the slot is > > > invalidated due to timeout. I have

Re: Jargon and acronyms on this mailing list

2024-09-08 Thread Michael Paquier
On Sun, Sep 08, 2024 at 11:35:36PM -0400, Tom Lane wrote: > David Rowley writes: >> I think HEAD is commonly misused to mean master instead of the latest >> commit of the current branch. I see the buildfarm even does that. >> Thanks for getting that right in your blog post. > > IIRC, HEAD *was* t

Re: Jargon and acronyms on this mailing list

2024-09-08 Thread Tom Lane
David Rowley writes: > I think HEAD is commonly misused to mean master instead of the latest > commit of the current branch. I see the buildfarm even does that. > Thanks for getting that right in your blog post. IIRC, HEAD *was* the technically correct term back when we were using CVS. Old habit

Re: Remove emode argument from XLogFileRead/XLogFileReadAnyTLI

2024-09-08 Thread Michael Paquier
On Fri, Sep 06, 2024 at 08:10:43PM +0900, Yugo Nagata wrote: > Since 1bb2558046c, XLogFileRead() doesn't use the emode argument. > Also, since abf5c5c9a4f, XLogFileReadAnyTLI() is called just once > and emode is always DEBUG2. So, I think we can remove the emode > argument from these functions. I'

Re: DOCS - pg_replication_slot . Fix the 'inactive_since' description

2024-09-08 Thread Peter Smith
On Mon, Sep 9, 2024 at 12:20 PM David G. Johnston wrote: > > > > On Sun, Sep 8, 2024, 18:55 Peter Smith wrote: >> >> Saying "The time..." is fine, but the suggestions given seem backwards to me: >> - The time this slot was inactivated >> - The time when the slot became inactive. >> - The time whe

Re: PostgreSQL 17 release announcement draft

2024-09-08 Thread Jonathan S. Katz
On 9/7/24 6:58 PM, David Rowley wrote: On Sun, 8 Sept 2024 at 06:44, Jonathan S. Katz wrote: I've attached the latest copy. Is "This release expands on functionality both for managing data in partitions" still relevant given the MERGE/SPLIT PARTITION was reverted [1]? AFAICT yes, as identit

Re: Add callbacks for fixed-numbered stats flush in pgstats

2024-09-08 Thread Michael Paquier
On Wed, Sep 04, 2024 at 06:27:43AM +, Bertrand Drouvot wrote: > Agree. The idea was to add an additional parameter (say "check_only") to the > flush_fixed_cb. If this parameter is set to true then the flush_fixed_cb would > do nothing (no flush at all) but return a boolean that would indicate i

Re: DOCS - pg_replication_slot . Fix the 'inactive_since' description

2024-09-08 Thread David G. Johnston
On Sun, Sep 8, 2024, 18:55 Peter Smith wrote: > Saying "The time..." is fine, but the suggestions given seem backwards to > me: > - The time this slot was inactivated > - The time when the slot became inactive. > - The time when the slot was deactivated. > > e.g. It is not like light switch. So,

Re: Add callbacks for fixed-numbered stats flush in pgstats

2024-09-08 Thread Michael Paquier
On Wed, Sep 04, 2024 at 06:37:01PM +0900, Kyotaro Horiguchi wrote: > I doubt that overprotection is always better, but in this case, it's > not overprotection at all. The flush callbacks are called > unconditionally once we decide to flush anything. Sorry for the noise. Yes, it's intended to be a

Re: DOCS - pg_replication_slot . Fix the 'inactive_since' description

2024-09-08 Thread Peter Smith
Saying "The time..." is fine, but the suggestions given seem backwards to me: - The time this slot was inactivated - The time when the slot became inactive. - The time when the slot was deactivated. e.g. It is not like light switch. So, there is no moment when the active slot "became inactive" or

Fix possible memory leak in rescanLatestTimeLine()

2024-09-08 Thread Yugo Nagata
In rescanLatestTimeLine(), if a new target timeline is found, expectedTLEs is replaced with newExpectedTLEs that is newly allocated by readTimeLineHistory(), and old expectedTLEs is released using list_free_deep(). However, if the current timeline is not part of the history of the new timeline,

Re: CI, macports, darwin version problems

2024-09-08 Thread Joe Conway
On 9/8/24 16:55, Thomas Munro wrote: On Sat, Aug 3, 2024 at 12:07 AM Joe Conway wrote: I tried making this run like a service using launchctl, but that was giving the permissions errors. I finally gave up trying to figure it out and just accepted that I need to manually start the script wheneve

Re: not null constraints, again

2024-09-08 Thread jian he
On Sat, Aug 31, 2024 at 11:59 AM Alvaro Herrera wrote: > > Hello > > Here I present another attempt at making not-null constraints be > catalogued. This is largely based on the code reverted at 9ce04b50e120, > except that we now have a not-null constraint automatically created for > every column

Re: ANALYZE ONLY

2024-09-08 Thread David Rowley
On Sun, 1 Sept 2024 at 13:32, Michael Harris wrote: > v3 of the patch is attached, and I will submit it to the commitfest. I think this patch is pretty good. I only have a few things I'd point out: 1. The change to ddl.sgml, technically you're removing the caveat, but I think the choice you've

Re: Jargon and acronyms on this mailing list

2024-09-08 Thread Tatsuo Ishii
> I normally wouldn't mention my blog entries here, but this one was about > the hackers mailing list, so wanted to let people know about it in case you > don't follow Planet Postgres. I scanned the last year's worth of posts and > gathered the most used acronyms and jargon. The most commonly used

Re: Jargon and acronyms on this mailing list

2024-09-08 Thread David Rowley
On Sat, 31 Aug 2024 at 04:02, Greg Sabino Mullane wrote: > I normally wouldn't mention my blog entries here, but this one was about the > hackers mailing list, so wanted to let people know about it in case you don't > follow Planet Postgres. I scanned the last year's worth of posts and gathered

Re: PATCH: Issue with set_indexsafe_procflags in ReindexRelationConcurrently

2024-09-08 Thread Michael Paquier
On Fri, Sep 06, 2024 at 01:27:12PM +0200, Michail Nikolaev wrote: > While working on [1], I have found a small issue with correctness > of set_indexsafe_procflags usage in ReindexRelationConcurrently introduced > in [2]. > > > idx->safe = (indexRel->rd_indexprs == NIL && indexRel->rd_indpred == NI

Re: Test improvements and minor code fixes for formatting.c.

2024-09-08 Thread Tom Lane
I wrote: > [ v1-formatting-test-improvements.patch ] Meh ... cfbot points out I did the float-to-int conversions wrong. v2 attached. regards, tom lane diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 461fc3f437..e2d45989d8 100644 --- a/doc/src/sgml/func.

Re: [PATCH] Add roman support for to_number function

2024-09-08 Thread Tom Lane
I wrote: > * Further to Aleksander's point about lack of test coverage for > the to_char direction, I see from > https://coverage.postgresql.org/src/backend/utils/adt/formatting.c.gcov.html > that almost none of the existing roman-number code paths are covered > today. While it's not strictly with

Test improvements and minor code fixes for formatting.c.

2024-09-08 Thread Tom Lane
Over in the thread about teaching to_number() to handle Roman numerals [1], it was noted that we currently have precisely zero test coverage for to_char()'s existing Roman-numeral code, except in the timestamp code path which shares nothing with the numeric code path. In looking at this, I found t

Re: Sort functions with specialized comparators

2024-09-08 Thread David Rowley
On Mon, 9 Sept 2024 at 01:00, Stepan Neretin wrote: > Hi, why do you think that I rejected Andrey's offer? I included his patch > first in my own. Yes, patch 2-0006 is the only patch to which I have not > attached any statistics and it looks really dubious. But the rest seem > useful. Above, I

Re: CI, macports, darwin version problems

2024-09-08 Thread Thomas Munro
On Sat, Aug 3, 2024 at 12:07 AM Joe Conway wrote: > I tried making this run like a service using launchctl, but that was > giving the permissions errors. I finally gave up trying to figure it out > and just accepted that I need to manually start the script whenever I > reboot the mac. It seems to

libpq: Process buffered SSL read bytes to support records >8kB on async API

2024-09-08 Thread Lars Kanis
Dear hackers, I'm the maintainer of ruby-pg the ruby interface to the PostgreSQL database. This binding uses the asynchronous API of libpq by default to facilitate the ruby IO wait and scheduling mechanisms. This works well with the vanilla postgresql server, but it leads to starvation with

Re: Yet another way for pg_ctl stop to fail on Windows

2024-09-08 Thread Noah Misch
On Sun, Sep 08, 2024 at 06:00:00PM +0300, Alexander Lakhin wrote: > 07.09.2024 21:11, Noah Misch wrote: > > > Noah, what do you think of handling this error in line with handling of > > > ERROR_BROKEN_PIPE and ERROR_BAD_PIPE (which was done in 0ea1f2a3a)? > > > > > > I tried the following change:

Re: [PoC] Add CANONICAL option to xmlserialize

2024-09-08 Thread Jim Jones
Hi Oliver On 08.09.24 15:56, Oliver Ford wrote: > Whoops, yes all tests and docs pass! Thanks for the review! Best, Jim

Re: Yet another way for pg_ctl stop to fail on Windows

2024-09-08 Thread Alexander Lakhin
07.09.2024 21:11, Noah Misch wrote: Noah, what do you think of handling this error in line with handling of ERROR_BROKEN_PIPE and ERROR_BAD_PIPE (which was done in 0ea1f2a3a)? I tried the following change:     switch (GetLastError())     {     case ERROR_BROKEN_PIPE:  

Re: [PoC] Add CANONICAL option to xmlserialize

2024-09-08 Thread Oliver Ford
On Sun, Sep 8, 2024 at 2:44 PM Laurenz Albe wrote: > > On Sun, 2024-09-08 at 11:43 +, Oliver Ford wrote: > > The following review has been posted through the commitfest application: > > make installcheck-world: tested, failed > > Implements feature: tested, failed > > Spec compliant:

Re: [PoC] Add CANONICAL option to xmlserialize

2024-09-08 Thread Laurenz Albe
On Sun, 2024-09-08 at 11:43 +, Oliver Ford wrote: > The following review has been posted through the commitfest application: > make installcheck-world: tested, failed > Implements feature: tested, failed > Spec compliant: tested, failed > Documentation:tested, faile

Re: Add RESPECT/IGNORE NULLS and FROM FIRST/LAST options

2024-09-08 Thread Vik Fearing
On 9/7/24 22:25, Oliver Ford wrote: On Sat, May 6, 2023 at 9:41 AM Oliver Ford wrote: On Sat, 6 May 2023, 04:57 Tatsuo Ishii, wrote: Attached is the patch to implement this (on top of your patch). test=# SELECT row_number() RESPECT NULLS OVER () FROM (SELECT 1) AS s; ERROR: window funct

Re: Sort functions with specialized comparators

2024-09-08 Thread Stepan Neretin
Hi, why do you think that I rejected Andrey's offer? I included his patch first in my own. Yes, patch 2-0006 is the only patch to which I have not attached any statistics and it looks really dubious. But the rest seem useful. Above, I attached a speed graph for one of the patches and tps( pgbench)

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread Bharath Rupireddy
Hi, Thanks for reviewing. On Tue, Sep 3, 2024 at 3:01 PM shveta malik wrote: > > 1) > I see that ReplicationSlotAlter() will error out if the slot is > invalidated due to timeout. I have not tested it myself, but do you > know if slot-alter errors out for other invalidation causes as well? > Ju

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-09-08 Thread Bharath Rupireddy
Hi, Thanks for reviewing. On Mon, Sep 2, 2024 at 1:37 PM Peter Smith wrote: > > Commit message. > > 1. > Because such synced slots are typically considered not > active (for them to be later considered as inactive) as they don't > perform logical decoding to produce the changes. > > This sentenc

Re: [PoC] Add CANONICAL option to xmlserialize

2024-09-08 Thread Oliver Ford
The following review has been posted through the commitfest application: make installcheck-world: tested, failed Implements feature: tested, failed Spec compliant: tested, failed Documentation:tested, failed LGTM The new status of this patch is: Ready for Committer

Re: Sort functions with specialized comparators

2024-09-08 Thread David Rowley
On Sun, 8 Sept 2024 at 20:51, Stepan Neretin wrote: > Hi! I rebase, clean and some refactor my patches. I'm unsure what exactly is going on with this thread. It started with Andrey proposing a patch to speed up intarray sorting and now it's turned into you proposing 10 patches which implement a s

Deadlock due to locking order violation while inserting into a leaf relation

2024-09-08 Thread Dilip Kumar
Basically, when we are inserting into a leaf relation (or lower level relation of the partitioned relation), we acquire the lock on the leaf relation during parsing time itself whereas parent lock is acquire during generate_partition_qual(). Now concurrently if we try to drop the partition root th

Re: Sort functions with specialized comparators

2024-09-08 Thread Stepan Neretin
Hi! I rebase, clean and some refactor my patches. Best regards, Stepan Neretin. From f88cbb80e478d5ac3f23945b4ba0ee881f0d9cd4 Mon Sep 17 00:00:00 2001 From: "Andrey M. Borodin" Date: Sun, 8 Sep 2024 15:43:39 +0700 Subject: [PATCH v2 01/10] Use specialized sort facilities --- contrib/intarray/_i

Re: SPI_connect, SPI_connect_ext return type

2024-09-08 Thread Tom Lane
Stepan Neretin writes: >> This combines portions of Stepan's >> two patches with some additional work (mostly, that he'd missed fixing >> any of contrib/). > Thank you for the feedback! I believe the patch looks satisfactory. Should > we await a review? The changes seem straightforward to me. I