Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-20 Thread jian he
hi. this time, I only checked v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch typedef struct PartitionCmd { NodeTagtype; RangeVar *name;/* name of partition to attach/detach/merge */ PartitionBoundSpec *bound;/* FOR VALUES, if attaching */

Re: Logical Replication of sequences

2025-08-20 Thread Amit Kapila
On Mon, Aug 18, 2025 at 3:36 PM vignesh C wrote: > > Thanks for the comments, the updated version has the changes for the same. > I wanted to first discuss a few design points. The patch implements "ALTER SUBSCRIPTION ... REFRESH PUBLICATION SEQUENCES" such that it copies the existing sequences v

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

2025-08-20 Thread Nathan Bossart
On Wed, Aug 20, 2025 at 10:29:03AM +0900, Richard Guo wrote: > On Wed, Aug 20, 2025 at 2:38 AM Nathan Bossart > wrote: >> There is still an open item for this one, but it's not clear whether we are >> planning to do anything about this for v18, especially since nobody has >> shown measurable perf

Re: Adding REPACK [concurrently]

2025-08-20 Thread Antonin Houska
Álvaro Herrera wrote: > On 2025-Aug-20, Antonin Houska wrote: > > > There's an issue with the symlink, maybe some meson expert can help. In > > particular, the CI on Windows ends up with the following error: > > > > ERROR: Tried to install symlink to missing file > > C:/cirrus/build/tmp_instal

Re: Adding REPACK [concurrently]

2025-08-20 Thread Andres Freund
Hi, On 2025-08-20 16:22:41 +0200, Antonin Houska wrote: > Álvaro Herrera wrote: > > > On 2025-Aug-20, Antonin Houska wrote: > > > > > There's an issue with the symlink, maybe some meson expert can help. In > > > particular, the CI on Windows ends up with the following error: > > > > > > ERROR: Tr

Re: Remove traces of long in dynahash.c

2025-08-20 Thread Chao Li
> On Aug 20, 2025, at 15:40, Michael Paquier wrote: > > On Tue, Aug 19, 2025 at 10:46:58AM -0400, Tom Lane wrote: >> +1 for getting rid of those while we're doing janitorial work here. >> They're not *quite* duplicates though, for instance next_pow2_int has >> different response to out-of-range

Re: Adding REPACK [concurrently]

2025-08-20 Thread Antonin Houska
Álvaro Herrera wrote: > Still on pg_repackdb, the implementation here is to install a symlink > called pg_repackdb which points to vacuumdb, and make the program behave > differently when called in this way. The amount of additional code for > this is relatively small, so I think this is a worth

Re: Logical Replication of sequences

2025-08-20 Thread vignesh C
On Tue, 19 Aug 2025 at 23:33, Masahiko Sawada wrote: > > I imagined something like case 2. For logical replication of tables, > if we support DDL replication (i.e., CREATE/ALTER/DROP TABLE), all > changes the apply worker executes are serialized in commit LSN order. > Therefore, users would not ha

Re: Skipping schema changes in publication

2025-08-20 Thread Shlok Kyal
Hi Kirill, Thanks for reviewing the patch. On Fri, 15 Aug 2025 at 11:46, Kirill Reshke wrote: > > Hi > > On Fri, 15 Aug 2025 at 05:53, Peter Smith wrote: > > > 1. > > bool isnull = true; > > - Datum whereClauseDatum; > > - Datum columnListDatum; > > + Datum datum; > > > > I know you did not w

Re: max_locks_per_transaction v18

2025-08-20 Thread James Pang
thanks for you clarification about additional memory calculations: for 10k connections , 5625kB maybe fine. I justed looked through the discussions about memory allocation " https://www.postgresql.org/message-id/cba2406a-66bb-41ac-b1cf-bb898596e0e1%40vondra.me";, I feel confused about the stat

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Chao Li
> On Aug 20, 2025, at 16:41, Shlok Kyal wrote: > > Hi, > > While working on the thread [1]. We encountered that in the > 'AlterPublicationTables' function, the assignment 'isnull = true' is > redundant. This assignment is not required, and the variable will be > reassigned before use. > I have

Add GUC to enable libxml2's XML_PARSE_HUGE

2025-08-20 Thread Jim Jones
Hi, In commit 71c0921 we re-introduced use of xmlParseBalancedChunkMemory in order to allow parsing of large XML documents with certain libxml2 versions [1]. While that solved a regression issue, it still leaves the handling of very large or deeply nested XML documents tied to libxml2’s internal l

Re: Add GUC to enable libxml2's XML_PARSE_HUGE

2025-08-20 Thread Tom Lane
Jim Jones writes: > To address this, Erik and I would like to propose a new GUC, > xml_parse_huge, which controls libxml2’s XML_PARSE_HUGE option. Given the spotty security history of libxml2, I can't really see how this wouldn't be enormously unsafe. Even as a superuser-only option, it seems li

Re: minor error message enhancement in refuseDupeIndexAttach

2025-08-20 Thread Peter Eisentraut
On 15.04.25 11:02, Daniel Gustafsson wrote: On 15 Apr 2025, at 10:52, jian he wrote: in refuseDupeIndexAttach, we can change from errdetail("Another index is already attached for partition \"%s\"."...) to errdetail("Another index \"%s\" is already attached for partition \"%s\".") So we ca

Re: Logical Replication of sequences

2025-08-20 Thread Masahiko Sawada
On Tue, Aug 19, 2025 at 9:14 PM Amit Kapila wrote: > > On Tue, Aug 19, 2025 at 11:33 PM Masahiko Sawada > wrote: > > > > On Tue, Aug 19, 2025 at 1:44 AM vignesh C wrote: > > > > > > > > > Case 2: Sequence value Conflict While Applying DDL Changes(Future patch) > > > > > > Example: > > > -- Publ

Re: Retail DDL

2025-08-20 Thread Kirk Wolak
On Mon, Aug 18, 2025 at 10:24 AM Jelte Fennema-Nio wrote: > On Mon, 18 Aug 2025 at 15:57, Tom Lane wrote: > > You haven't actually defined what "this" is. For starters, do you > > really want this output to be included in \d? Seems like one part > > or the other of such output would be clutter

Re: VM corruption on standby

2025-08-20 Thread Andrey Borodin
> On 20 Aug 2025, at 00:55, Tom Lane wrote: > > Andrey Borodin writes: >> I believe there is a bug with PageIsAllVisible(page) && >> visibilitymap_clear(). But I cannot prove it with an injection point test. >> Because injections points rely on CondVar, that per se creates corruption in >>

Re: Don't treat virtual generated columns as missing statistics in vacuumdb --missing-stats-only

2025-08-20 Thread Fujii Masao
On Thu, Aug 21, 2025 at 4:19 AM Nathan Bossart wrote: > > On Wed, Aug 20, 2025 at 01:53:38PM +0900, Yugo Nagata wrote: > > The patch conflicted with the latest commit, so I rebased it. > > Nice find. I would suggest adding the virtual generated column to > regression_vacuumdb_test when it is firs

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Chao Li
> On Aug 21, 2025, at 09:10, Peter Smith wrote: > > I feel that having redundant assignments can be misleading because > someone reading the code might think the initial value matters or has > some significance, when it does not. > > ~~~ > > Here's another example, in the same function: > ---

Re: pg_get_sequence_data Shows Non-NULL last_value for Freshly Created Sequence

2025-08-20 Thread Tom Lane
Nathan Bossart writes: > This function returns the values in the sequence tuple, primarily for > pg_dump (see commit bd15b7d). IIUC your patch would break pg_dump on v18 > and newer versions. The proposed patch includes a change to pg_dump that I suppose is meant to compensate. But I'm not 100%

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

2025-08-20 Thread Tomas Vondra
Hi, I think there's a minor issue in how pg_checksums validates state before checking the data. The current patch simply does: if (ControlFile->data_checksum_version == 0 && mode == PG_MODE_CHECK) pg_fatal("data checksums are not enabled in cluster"); and that worked when the vers

Re: Organize working memory under per-PlanState context

2025-08-20 Thread Tom Lane
Jeff Davis writes: > On Wed, 2025-08-20 at 09:22 +0200, Andrei Lepikhov wrote: >> Building a hash table repeatedly may be pretty costly, no? > We can check the eflags for EXEC_FLAG_REWIND. That might not be the > only condition we need to check, but we should know at plan time > whether a subtree

Re: RFC: extensible planner state

2025-08-20 Thread Robert Haas
On Tue, Aug 19, 2025 at 2:28 PM Tom Lane wrote: > You'll presumably have to use GetMemoryChunkContext() for RelOptInfo, > so I don't see much downside from using it in one or even both of the > other cases too. Pointer dereference must be faster than a function call. > Hm. We don't have read su

Re: pg_get_sequence_data Shows Non-NULL last_value for Freshly Created Sequence

2025-08-20 Thread Nathan Bossart
On Wed, Aug 20, 2025 at 07:16:55PM +0530, vignesh C wrote: > pg_sequences and pg_sequence_last_value return NULL for last_value, > which aligns with the expectation that the sequence hasn't been used > yet. However, pg_get_sequence_data returns the start value (1) even > though is_called is false.

Re: Organize working memory under per-PlanState context

2025-08-20 Thread Jeff Davis
On Wed, 2025-08-20 at 09:22 +0200, Andrei Lepikhov wrote: > I'm not sure I understand your reasoning clearly. How do you know > that > the current subtree will not be rescanned with the same parameter > set? > Building a hash table repeatedly may be pretty costly, no? We can check the eflags for

Re: Non-reproducible AIO failure

2025-08-20 Thread Alexander Lakhin
Hello Andres, 22.07.2025 02:19, Andres Freund wrote: Hi, On 2025-06-19 10:16:12 -0500, Nico Williams wrote: On Thu, Jun 19, 2025 at 05:05:25PM +0200, Daniel Gustafsson wrote: I also dug out an archeologically old MacBook Pro running macOS High Sierra 10.13.6 with an i5 using Apple LLVM versio

Re: date_trunc function in interval version

2025-08-20 Thread Przemysław Sztoch
On 8/20/2025 9:52 PM, Kirk Wolak wrote: On Mon, May 20, 2024 at 11:58 AM Przemysław Sztoch wrote: Yasir wrote on 19.05.2024 00:03: I would also like to thank Robert for presenting the matter in detail. My function date_trunc ( interval, timestamp, ...) is simila

Re: analyze-in-stages post upgrade questions

2025-08-20 Thread Justin Pryzby
When analyzing a partitioned table, I think you should use ANALYZE ONLY, or otherwise avoid processing the children twice. Thanks for handling this. I was recently suprised to learn that vacuumdb doesn't process parents. -- Justin

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 05:18:53PM +0800, Chao Li wrote: > If we look into the subsequent functions, yes, “isnull” will always > be assigned. But how about if someone incidentally changed a > subsequent function and moved an assignment? > I think giving an initial value is a good habit without much

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Chao Li
> On Aug 21, 2025, at 08:11, Michael Paquier wrote: > > Compilers are smart enough to optimize such things away My first impression was compilers would optimize the local variable “isnull", such as replacing it with a constant value. However, “isnull” will be passed into other functions wit

Re: Cygwin support

2025-08-20 Thread Kirk Wolak
On Tue, Apr 22, 2025 at 12:55 PM Laurenz Albe wrote: > On Tue, 2025-04-22 at 10:26 -0400, Tom Lane wrote: > > I vaguely recall some discussion about whether building with readline > > has become possible under MSVC. I think it'd make a lot of people > > happy if that could happen (but I hasten t

Re: Don't treat virtual generated columns as missing statistics in vacuumdb --missing-stats-only

2025-08-20 Thread Nathan Bossart
On Wed, Aug 20, 2025 at 01:53:38PM +0900, Yugo Nagata wrote: > The patch conflicted with the latest commit, so I rebased it. Nice find. I would suggest adding the virtual generated column to regression_vacuumdb_test when it is first created so that we can just rely on the existing test cases. In

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

2025-08-20 Thread Matheus Alcantara
On Tue Aug 19, 2025 at 2:40 PM -03, Masahiko Sawada wrote: > However, I have a more fundamental concern regarding the LISTEN/NOTIFY > implementation. Since vacuum doesn't consider the XIDs of notification > entries, there might be a critical issue with the truncation of clog > entries that LISTEN/N

Re: Add GUC to enable libxml2's XML_PARSE_HUGE

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 11:46:11AM -0400, Tom Lane wrote: > Independently of that, we have learned the hard way that GUCs > that change application-visible query semantics are a bad idea. > You cannot really argue that this wouldn't be one. For reference: a famous example of that is autocommit as

Re: Remove condition variables from injection wait logic.

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 11:20:11AM +0500, Kirill Reshke wrote: > $sub proposed in a nearby thread. Looks like we have a consensus that > $subj is beneficial. > I implemented necessary legwork, namely a clock-based check in the > wait() routine, PFA. I'm not sure the default pg_sleep argument of 50

Re: date_trunc function in interval version

2025-08-20 Thread Kirk Wolak
On Wed, Aug 20, 2025 at 5:13 PM Przemysław Sztoch wrote: > On 8/20/2025 9:52 PM, Kirk Wolak wrote: > > On Mon, May 20, 2024 at 11:58 AM Przemysław Sztoch > wrote: > >> Yasir wrote on 19.05.2024 00:03: >> >> I would also like to thank Robert for presenting the matter in detail. >>> >>> My functio

Re: Remove traces of long in dynahash.c

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 04:14:15PM +0800, Chao Li wrote: > I wonder if we can keep the same naming style to make the new > function name like next_pow2_64()? I don't think that this would be a good idea to have new routines published in pg_bitutils.h with names inconsistent with the existing one.

Re: Adding REPACK [concurrently]

2025-08-20 Thread Mihail Nikalayeu
Hello everyone! Alvaro Herrera : > Please note that Antonin already implemented this. See his patches > here: > https://www.postgresql.org/message-id/77690.1725610115%40antos > I proposed to leave this part out initially, which is why it hasn't been > reposted. We can review and discuss after th

Re: Remove traces of long in dynahash.c

2025-08-20 Thread Chao Li
Hi Michael, > On Aug 21, 2025, at 07:07, Michael Paquier wrote: > > > After sleeping on it, I am not sure what to do with these routines. I > don't deny that more refactoring can be done. However, all that can > also happen outside the long -> int64 switch I am suggesting. > > Any comments f

Re: Skipping schema changes in publication

2025-08-20 Thread Peter Smith
Hi Shlok, I reviewed your latest v20-0003 patch and have no more comments at this time; I only found one trivial typo. == src/bin/psql/describe.c 1. + /* + * Footers entries for a publication description or a table + * description + */ Typo. /Footers entries/Footer entries/ == Kind Reg

Re: pg_get_sequence_data Shows Non-NULL last_value for Freshly Created Sequence

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 01:01:52PM -0400, Tom Lane wrote: > The proposed patch includes a change to pg_dump that I suppose is > meant to compensate. But I'm not 100% sure that it does so correctly. > Anyway, given that it's supposed to provide low-level inspection of > the sequence tuple, I think

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

2025-08-20 Thread Richard Guo
On Wed, Aug 20, 2025 at 11:11 PM Nathan Bossart wrote: > On Wed, Aug 20, 2025 at 10:29:03AM +0900, Richard Guo wrote: > > On Wed, Aug 20, 2025 at 2:38 AM Nathan Bossart > > wrote: > >> There is still an open item for this one, but it's not clear whether we are > >> planning to do anything about

Re: Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Peter Smith
On Wed, Aug 20, 2025 at 6:41 PM Shlok Kyal wrote: > > Hi, > > While working on the thread [1]. We encountered that in the > 'AlterPublicationTables' function, the assignment 'isnull = true' is > redundant. This assignment is not required, and the variable will be > reassigned before use. > I have

Re: Add GUC to enable libxml2's XML_PARSE_HUGE

2025-08-20 Thread Erik Wienhold
On 2025-08-20 21:42 +0200, Jim Jones wrote: > On 20.08.25 17:46, Tom Lane wrote: > > Independently of that, we have learned the hard way that GUCs that > > change application-visible query semantics are a bad idea. You > > cannot really argue that this wouldn't be one. I totally forgot about that

Re: Prevent internal error at concurrent CREATE OR REPLACE FUNCTION

2025-08-20 Thread Yugo Nagata
On Thu, 17 Jul 2025 14:09:14 +0900 Yugo Nagata wrote: > On Fri, 4 Jul 2025 14:58:05 +0900 > Yugo Nagata wrote: > > > On Fri, 4 Jul 2025 10:48:26 +0700 > > Daniil Davydov <3daniss...@gmail.com> wrote: > > > > > Hi, > > > > > > On Thu, Jul 3, 2025 at 9:18 PM Yugo Nagata wrote: > > > > > > > >

Re: ReplicationSlotRelease() crashes when the instance is in the single user mode

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 07:42:11AM +, Hayato Kuroda (Fujitsu) wrote: > Let me clarify your point. For now, there are no decisions to prohibit origin > manipulations. 0002 only restricts to handle slots in the single-user mode. > Did > you say that we do not have to do tests to ensure these SQL

Remove redundant assignment of a variable in function AlterPublicationTables

2025-08-20 Thread Shlok Kyal
Hi, While working on the thread [1]. We encountered that in the 'AlterPublicationTables' function, the assignment 'isnull = true' is redundant. This assignment is not required, and the variable will be reassigned before use. I have attached a patch to address this. [1]: https://www.postgresql.or

Re: Generate GUC tables from .dat file

2025-08-20 Thread John Naylor
On Wed, Aug 20, 2025 at 3:18 AM Peter Eisentraut wrote: > Ok, I did the big conversion, and tidied everything up so that it now > generates the big tables in guc_tables.c from the .dat file. This > basically works now. > - One thing I didn't reproduce in the generated code is the line breaks > i

Re: IPC/MultixactCreation on the Standby server

2025-08-20 Thread Kirill Reshke
On Thu, 31 Jul 2025 at 11:29, Andrey Borodin wrote: > > > > > On 29 Jul 2025, at 23:15, Andrey Borodin wrote: > > > > I do not understand it yet. > > OK, I figured it out. SimpleLruDoesPhysicalPageExist() was reading a physical > file and could race with real extension by ExtendMultiXactOffset()

Re: Adding REPACK [concurrently]

2025-08-20 Thread Antonin Houska
Alvaro Herrera wrote: > On 2025-Aug-16, Robert Treat wrote: > > > On Tue, Aug 5, 2025 at 4:59 AM Antonin Houska wrote: > > > > Now that we want to cover the CLUSTER/VACUUM FULL completely, I've > > > checked the > > > options of VACUUM FULL. I found two items not supported by REPACK (but > >

Re: Remove traces of long in dynahash.c

2025-08-20 Thread Michael Paquier
On Tue, Aug 19, 2025 at 10:46:58AM -0400, Tom Lane wrote: > +1 for getting rid of those while we're doing janitorial work here. > They're not *quite* duplicates though, for instance next_pow2_int has > different response to out-of-range values than pg_nextpower2_32. This would mean introducing mor

RE: ReplicationSlotRelease() crashes when the instance is in the single user mode

2025-08-20 Thread Hayato Kuroda (Fujitsu)
Dear Michael, I found you've pushed 0001. Thanks! I've considered to create patches for other branches after you said OK, but you seemed to push all of them directly. > This has reminded me of 1a9d80282811, where I have used a trick with > pg_ctl to allow single-user mode executions to bypass the

Re: RFC: extensible planner state

2025-08-20 Thread Andrei Lepikhov
On 19/8/2025 18:47, Robert Haas wrote: polishing. If people do not like this design, then I would like to know what alternative they would prefer.Thanks for these efforts! Generally, such an interface seems good for the extension's purposes. It is OK in this specific context because all these

Re: analyze-in-stages post upgrade questions

2025-08-20 Thread Laurenz Albe
On Wed, 2025-08-20 at 13:31 +0900, Fujii Masao wrote: > OK, so for now I've pushed the patch to master. Thanks! Thank you for working on that! Yours, Laurenz Albe

Re: Organize working memory under per-PlanState context

2025-08-20 Thread Andrei Lepikhov
On 20/8/2025 07:38, Chao Li wrote: I know some memory must be retained until the entire query finishes. But those per-node memories, such as hash table, might be destroyed immediately after a node finishes. I'm not sure I understand your reasoning clearly. How do you know that the current subtr

Re: Organize working memory under per-PlanState context

2025-08-20 Thread Andrei Lepikhov
On 20/8/2025 01:34, Jeff Davis wrote: It doesn't do much yet, but it creates infrastructure that will be useful for subsequent patches to make the memory accounting and enforcement more consistent throughout the executor.Does this mean that you are considering flexible memory allocation during e

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

2025-08-20 Thread shveta malik
Please find a few comments: 1) ReplicationSlotsDropDBSlots: + bool dropped = false; We can name 'dropped ' as 'dropped_logical' similar to ReplicationSlotCleanup. 2) ReplicationSlotsDropDBSlots() + + if (dropped && nlogicalslots == 0) + DisableLogicalDecodingIfNecessary(); I could not understan

Add ALTER INDEX ENABLE/DISABLE for Temporarily Disabling Indexes

2025-08-20 Thread Alaa Attya
Dear PostgreSQL Hackers, I am writing to propose a new feature to allow temporarily disabling and enabling indexes without dropping them. This would provide a safer, more efficient alternative to the current drop/recreate workflow for testing and maintenance purposes. I am aware of prior discussion

vacuumdb --missing-stats-only and permission issue

2025-08-20 Thread Fujii Masao
Hi, While following the discussion on vacuumdb --missing-stats-only [1], I noticed that this option queries pg_statistic and pg_statistic_ext_data. As a result, non-superusers like pg_maintain cannot use it because by default they lack permission to access those catalogs. I'm not sure whether --m

Remove redundant assignment in CreateWorkExprContext

2025-08-20 Thread Chao Li
Hi, While discussing [1], I was reading execUtils.c, then I noticed this redundant local variable assignment in CreateWorkExprContext(). The attached patch fixed that. [1]: https://www.postgresql.org/message-id/caa4ek1+seus_6vqay9tf_r4ow+e-q7lynlfsd78haoslsgp...@mail.gmail.com Best regards

Re: Proposal: Conflict log history table for Logical Replication

2025-08-20 Thread Dilip Kumar
On Wed, Aug 20, 2025 at 5:46 PM Amit Kapila wrote: > > On Wed, Aug 20, 2025 at 11:47 AM Dilip Kumar wrote: > > > > On Mon, Aug 18, 2025 at 12:25 PM Amit Kapila > > wrote: > > > > > > > > One idea to keep things simple for the first version is that we allow > > > users to specify the table_name

Re: VM corruption on standby

2025-08-20 Thread Thomas Munro
On Wed, Aug 20, 2025 at 3:47 PM Tom Lane wrote: > Having said that, we should in any case have a better story on > what WaitEventSetWait should do after detecting postmaster death. > So I'm all for trying to avoid the proc_exit path if we can > design a better answer. Yeah. I've posted a concept

Redesigning postmaster death handling

2025-08-20 Thread Thomas Munro
Hi, Here's an experimental patch to fix our shutdown strategy on postmaster death, as discussed in a nearby report[1]. Maybe it's possible to switch to _exit() without also switching to preemptive handling, but it seems fragile and painful for no gain. Following that line of thinking, we might a

RE: memory leak in logical WAL sender with pgoutput's cachectx

2025-08-20 Thread Hayato Kuroda (Fujitsu)
Dear Sawada-san, > It decrements the counter whenever we successfully find the entry from > the cache but I'm not sure this is the right approach. What if no > cache invalidation happens at all but we retrieve entries from the > cache many times? Oh, right. I tried to handle the case that invalid

Re: Redesigning postmaster death handling

2025-08-20 Thread Thomas Munro
On Thu, Aug 21, 2025 at 5:28 PM Tom Lane wrote: > Hmm. Up to now, we have not had an assumption that postmaster > children are aware of every other postmaster child. In particular, > not all postmaster children have PGPROC entries. How much does > this matter? What happens if the shared PGPROC

Re: Logical Replication of sequences

2025-08-20 Thread shveta malik
On Wed, Aug 20, 2025 at 2:25 PM vignesh C wrote: > > On Tue, 19 Aug 2025 at 23:33, Masahiko Sawada wrote: > > > > I imagined something like case 2. For logical replication of tables, > > if we support DDL replication (i.e., CREATE/ALTER/DROP TABLE), all > > changes the apply worker executes are s

RE: ReplicationSlotRelease() crashes when the instance is in the single user mode

2025-08-20 Thread Hayato Kuroda (Fujitsu)
Dear Michael and hackers, This is a wrap-up of this thread. I'm planning to close the thread once. > I am saying that there is little point in having tests for the origin > functions in single-user mode as these don't do anything really > fancy with global states (there's a acquired_by of course,

Re: Redesigning postmaster death handling

2025-08-20 Thread Tom Lane
Thomas Munro writes: > Following that line of thinking, we might as well just ask the kernel > to hit our existing SIGQUIT handler at parent exit, on Linux/FreeBSD. > Job done. One other thought here: do we *really* want such a critical-and-hard- to-test aspect of our behavior to be handled compl

Re: Organize working memory under per-PlanState context

2025-08-20 Thread Andrei Lepikhov
On 20/8/2025 19:00, Jeff Davis wrote: On Wed, 2025-08-20 at 09:22 +0200, Andrei Lepikhov wrote: I'm not sure I understand your reasoning clearly. How do you know that the current subtree will not be rescanned with the same parameter set? Building a hash table repeatedly may be pretty costly, no?

RE: Fix replica identity checks for MERGE command on published table.

2025-08-20 Thread Zhijie Hou (Fujitsu)
On Friday, July 11, 2025 3:09 PM Dean Rasheed wrote: > > On Tue, 8 Jul 2025 at 09:51, Dean Rasheed > wrote: > > > > Answering my own question, INSERT ... ON CONFLICT DO UPDATE does > have > > the same problem as MERGE. To reproduce the error, all you need to do > > is create the unique index it

Re: Conflict detection for update_deleted in logical replication

2025-08-20 Thread shveta malik
On Wed, Aug 20, 2025 at 12:12 PM Zhijie Hou (Fujitsu) wrote: > > > I agree. Here is V63 version which implements this approach. > Thank You for the patches. > The retention status is recorded in the pg_subscription catalog > (subretentionactive) to prevent unnecessary retention initiation upon s

Re: Add GUC to enable libxml2's XML_PARSE_HUGE

2025-08-20 Thread Jim Jones
Hi Tom Thanks for replying so quickly! On 20.08.25 17:46, Tom Lane wrote: > Given the spotty security history of libxml2, I can't really see > how this wouldn't be enormously unsafe. Even as a superuser-only > option, it seems like a bad idea. I was under the impression that the status quo alre

Re: date_trunc function in interval version

2025-08-20 Thread Kirk Wolak
On Mon, May 20, 2024 at 11:58 AM Przemysław Sztoch wrote: > Yasir wrote on 19.05.2024 00:03: > > I would also like to thank Robert for presenting the matter in detail. >> >> My function date_trunc ( interval, timestamp, ...) is similar to original >> function date_trunc ( text, timestamp ...) . >

Re: pg_get_sequence_data Shows Non-NULL last_value for Freshly Created Sequence

2025-08-20 Thread Nathan Bossart
On Wed, Aug 20, 2025 at 11:47:38AM -0500, Nathan Bossart wrote: > This function returns the values in the sequence tuple, primarily for > pg_dump (see commit bd15b7d). IIUC your patch would break pg_dump on v18 > and newer versions. Concretely, after the following commands, the patch causes pg_du

Re: Test instability when pg_dump orders by OID

2025-08-20 Thread Noah Misch
On Wed, Aug 20, 2025 at 10:11:15AM +0500, Kirill Reshke wrote: > On Sun, 10 Aug 2025 at 21:37, Noah Misch wrote: > > Thanks. Given the current state of freeze for tomorrow's release wrap, the > > decision is less obvious than usual. I'm seeing these options: > > > > 1. Remove the new assertion i

Re: VM corruption on standby

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 09:14:04AM -0400, Andres Freund wrote: > On 2025-08-19 23:47:21 -0400, Tom Lane wrote: >> Hm. It still makes me mighty uncomfortable, because the point of a >> critical section is "crash the database if anything goes wrong during >> this bit". Waiting for another process -

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

2025-08-20 Thread Matheus Alcantara
On Tue Aug 19, 2025 at 2:37 PM -03, Daniil Davydov wrote: > Hi, > > On Tue, Aug 19, 2025 at 6:31 PM Matheus Alcantara > wrote: >> >> On Tue Aug 19, 2025 at 12:57 AM -03, Daniil Davydov wrote: >> > You have started a very long transaction, which holds its xid and prevents >> > vacuum from freezing

Re: When deleting the plpgsql function, release the CachedPlan of the function

2025-08-20 Thread Tom Lane
Vladlen Popolitov writes: > What do you mean, when speak about function cache? What I'm thinking about is the function parse-tree, which not incidentally contains a bunch of links to cached plans (via SPI). Looking at plpgsql_free_function_memory might clarify things for you.

Re: meson: Add _static and _shared suffixes to the library names

2025-08-20 Thread Nazir Bilal Yavuz
Hi, On Thu, 14 Aug 2025 at 10:37, Nazir Bilal Yavuz wrote: > > On Wed, 13 Aug 2025 at 23:03, Andres Freund wrote: > > > > v2-0002-ci-windows-Use-DEBUG-FULL-instead-of-DEBUG-FASTLI.patch > > > Separately I think we should report this as a bug to meson. Could you > > perhaps > > create a minimal

Re: VM corruption on standby

2025-08-20 Thread Andres Freund
Hi, On 2025-08-19 23:47:21 -0400, Tom Lane wrote: > Thomas Munro writes: > > On Wed, Aug 20, 2025 at 7:50 AM Tom Lane wrote: > >> I'm inclined to think that we do want to prohibit WaitEventSetWait > >> inside a critical section --- it just seems like a bad idea all > >> around, even without cons

Re: When deleting the plpgsql function, release the CachedPlan of the function

2025-08-20 Thread Vladlen Popolitov
章晨曦 писал(а) 2025-08-19 12:31: I think you misunderstand Man's meaning. In Man's example, the func cache neither dropped (will cause memory leak) nor reused. So the question here: 1. Drop the cache when func dropped 2. Keep the cache and reused when func recreate I prefer the 2ed solution. Re

pg_get_sequence_data Shows Non-NULL last_value for Freshly Created Sequence

2025-08-20 Thread vignesh C
Hi, I noticed an inconsistency in the behavior of sequence-related functions for a freshly created sequence. CREATE SEQUENCE s1; postgres=# select last_value from pg_sequences; last_value (1 row) postgres=# select pg_sequence_last_value('s1'); pg_sequence_last_value -

Re: Proposal: Conflict log history table for Logical Replication

2025-08-20 Thread Amit Kapila
On Wed, Aug 20, 2025 at 11:47 AM Dilip Kumar wrote: > > On Mon, Aug 18, 2025 at 12:25 PM Amit Kapila wrote: > > > > > One idea to keep things simple for the first version is that we allow > > users to specify the table_name for storing conflicts but the table > > should be created internally and

Re: Adding REPACK [concurrently]

2025-08-20 Thread Álvaro Herrera
On 2025-Aug-20, Antonin Houska wrote: > There's an issue with the symlink, maybe some meson expert can help. In > particular, the CI on Windows ends up with the following error: > > ERROR: Tried to install symlink to missing file > C:/cirrus/build/tmp_install/usr/local/pgsql/bin/vacuumdb Hmm, t

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

2025-08-20 Thread Tomas Vondra
On 8/16/25 21:34, Daniel Gustafsson wrote: > Attached is a rebase on top of the func.sgml changes which caused this to no > longer apply. > > This version is also substantially updated with a new injection point based > test suite, fixed a few bugs (found by said test suite), added checkpoint to >

Re: Logical Replication of sequences

2025-08-20 Thread Amit Kapila
On Wed, Aug 20, 2025 at 11:00 PM Masahiko Sawada wrote: > > On Tue, Aug 19, 2025 at 9:14 PM Amit Kapila wrote: > > > > If so, I don't think we can do much with the design > > choice we made. During DDL replication of sequences, we need to > > consider it as a conflict. > > > > BTW, note that the

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-20 Thread jian he
On Wed, Aug 20, 2025 at 5:22 PM jian he wrote: > > this time, I only checked > v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch > > typedef struct PartitionCmd > { > NodeTagtype; > RangeVar *name;/* name of partition to attach/detach/merge > */ > P

Re: Possible inaccurate description of wal_compression in docs

2025-08-20 Thread Michael Paquier
On Wed, Aug 20, 2025 at 09:01:12AM +0800, Xuneng Zhou wrote: > +1 for e.g. e.g. feels more elegant, so I have reused your suggestion, and applied the result down to v13. -- Michael signature.asc Description: PGP signature

Re: Remove traces of long in dynahash.c

2025-08-20 Thread Tom Lane
Michael Paquier writes: > On Wed, Aug 20, 2025 at 04:14:15PM +0800, Chao Li wrote: >> I wonder if we can keep the same naming style to make the new >> function name like next_pow2_64()? > I don't think that this would be a good idea to have new routines > published in pg_bitutils.h with names inc

Re: Redesigning postmaster death handling

2025-08-20 Thread Tom Lane
Thomas Munro writes: > Here's an experimental patch to fix our shutdown strategy on > postmaster death, as discussed in a nearby report[1]. Thanks for tackling this topic. > For systems lacking that facility, the idea I'm trying out here is > that backends that detect the condition in WaitEventS

RE: memory leak in logical WAL sender with pgoutput's cachectx

2025-08-20 Thread Hayato Kuroda (Fujitsu)
Dear Xuneng, > This may not be ideal. It decrements on every lookup of an existing > entry, not just when consuming an invalidation, which could make the > counter go > negative. Do we need decrementing logic? Not perfect 1:1 tracking > seems ok in here; though it might make the clean-up a bit mo

RE: memory leak in logical WAL sender with pgoutput's cachectx

2025-08-20 Thread Hayato Kuroda (Fujitsu)
> Firstly I also considered but did not choose because of the code complexity. > After considering more, it is not so difficult, PSA new file. v3 contained 100_cachectm_oom.pl, which won't succeed. Here is a patch which removed the test file. Best regards, Hayato Kuroda FUJITSU LIMITED v4-0001

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2025-08-20 Thread jian he
On Thu, Aug 21, 2025 at 10:53 AM jian he wrote: > > > this time, I only checked > > v52-0001-Implement-ALTER-TABLE-.-MERGE-PARTITIONS-.-comma.patch > > hi. we may need to change checkPartition. +-- ERROR: "sales_apr2022" is not a table +ALTER TABLE sales_range MERGE PARTITIONS (sales_feb2022,

Re: Standardize LSN-based filename

2025-08-20 Thread Fujii Masao
On Wed, Aug 20, 2025 at 10:37 AM Japin Li wrote: > Yeah. It's for both consistency and for proper file sorting. > > Zero-padding ensures that when a file system or tool sorts the snapshot files > alphabetically, the order is also chronological. For example, without > zero-padding, 2-1.snap would

Re: Remove condition variables from injection wait logic.

2025-08-20 Thread Andrey Borodin
> On 21 Aug 2025, at 04:02, Michael Paquier wrote: > > I would not object to that if that's the actual consensus as we don't > have a strong requirement for condition variables when it comes to > testing. That's just a more efficient implementation, and it makes > the tests faster. If we do