Re: pg15b4: FailedAssertion("TransactionIdIsValid(xmax)

2022-09-09 Thread Justin Pryzby
The OOM was at: < 2022-09-09 19:34:24.043 CDT >LOG: server process (PID 14841) was terminated by signal 9: Killed The first SIGABRT was at: < 2022-09-09 19:37:31.650 CDT >LOG: server process (PID 7363) was terminated by signal 6: Aborted And I've just found a bunch of "interesting" logs

Re: pg15b4: FailedAssertion("TransactionIdIsValid(xmax)

2022-09-09 Thread Justin Pryzby
On Sat, Sep 10, 2022 at 12:07:30PM +0800, Zhang Mingli wrote: > That’s interesting, dig into it for a while but not too much progress. > > Maybe we could add some logs to print MultiXactMembers’ xid and status if xid > is 0. > > Inside MultiXactIdGetUpdateXid() > > ``` > nmembers =

Re: pg15b4: FailedAssertion("TransactionIdIsValid(xmax)

2022-09-09 Thread Zhang Mingli
Hi, That’s interesting, dig into it for a while but not too much progress. Maybe we could add some logs to print MultiXactMembers’ xid and status if xid is 0. Inside MultiXactIdGetUpdateXid() ``` nmembers = GetMultiXactIdMembers(xmax, , false, false); if (nmembers > 0)

Re: pg15b4: FailedAssertion("TransactionIdIsValid(xmax)

2022-09-09 Thread Justin Pryzby
On Fri, Sep 09, 2022 at 09:06:37PM -0500, Justin Pryzby wrote: > #0 0x7fb8a22f31f7 in raise () from /lib64/libc.so.6 > #1 0x7fb8a22f48e8 in abort () from /lib64/libc.so.6 > #2 0x0098f9be in ExceptionalCondition > (conditionName=conditionName@entry=0x9fada4

Re: Assertion failure in WaitForWALToBecomeAvailable state machine

2022-09-09 Thread Bharath Rupireddy
On Mon, Aug 15, 2022 at 11:30 AM Bharath Rupireddy wrote: > > On Thu, Aug 11, 2022 at 10:06 PM Bharath Rupireddy > wrote: > > > > Today I encountered the assertion failure [2] twice while working on > > another patch [1]. The pattern seems to be that the walreceiver got > > killed or crashed and

pg15b4: FailedAssertion("TransactionIdIsValid(xmax)

2022-09-09 Thread Justin Pryzby
The sequence of events leading up to this: 0) Yesterday I upgraded an internal VM to pg15b4 using PGDG RPMs; It's the same VM that hit the prefetch_recovery bug which was fixed by adb466150. I don't think that should've left it in a weird state (since recovery was sucessful when

Re: why can't a table be part of the same publication as its schema

2022-09-09 Thread Amit Kapila
On Fri, Sep 9, 2022 at 8:48 PM Robert Haas wrote: > > On Fri, Sep 9, 2022 at 10:29 AM houzj.f...@fujitsu.com > wrote: > > IIRC, the feature currently works almost the same as you described. It > > doesn't > > create entry for tables that are published via its schema level, it only > > record >

Re: cataloguing NOT NULL constraints

2022-09-09 Thread Zhihong Yu
Hi, w.r.t. the while loop in findNotNullConstraintAttnum(): + if (multiple == NULL) + break; I think `pfree(arr)` should be called before breaking. + if (constraint->cooked_expr != NULL) + return tryExtractNotNullFromNode(stringToNode(constraint->cooked_expr),

Re: Summary function for pg_buffercache

2022-09-09 Thread Melih Mutlu
Hi Aleksander and Nathan, Thanks for your comments. Aleksander Alekseev , 9 Eyl 2022 Cum, 17:36 tarihinde şunu yazdı: > However I'm afraid you can't examine BufferDesc's without taking > locks. This is explicitly stated in buf_internals.h: > > """ > Buffer header lock (BM_LOCKED flag) must be

Re: [RFC] building postgres with meson - v12

2022-09-09 Thread Andres Freund
Hi, On 2022-08-31 11:11:54 -0700, Andres Freund wrote: > > If the above are addressed, I think this will be just about at the > > point where the above patches can be committed. > > Woo! There was a lot less progress over the last ~week than I had hoped. The reason is that I was trying to figure

Re: Patch proposal: make use of regular expressions for the username in pg_hba.conf

2022-09-09 Thread Jacob Champion
On 8/19/22 01:12, Drouvot, Bertrand wrote: > + wstr = palloc((strlen(tok->string + 1) + 1) * sizeof(pg_wchar)); > > + wlen = pg_mb2wchar_with_len(tok->string + 1, > > + wstr, strlen(tok->string + 1)); The

[Commitfest 2022-09] First week is over

2022-09-09 Thread Ibrar Ahmed
Just a reminder that the first week of "September 2022 commitfest" is over, As of now, there are "295" patches in total. Out of these 295 patches, "29" patches required committer attention, and 188 patches need reviews. I think we need more reviewers to low down the number. I will keep sending

Re: Avoid overhead with fprintf related functions

2022-09-09 Thread Nathan Bossart
On Fri, Sep 09, 2022 at 05:53:54PM -0400, Tom Lane wrote: > Ranier Vilela writes: >> Em sex., 9 de set. de 2022 às 13:20, Nathan Bossart < >> nathandboss...@gmail.com> escreveu: >>> I agree with David [0]. But if you can demonstrate a performance gain, >>> perhaps it's worth considering a subset

Re: predefined role(s) for VACUUM and ANALYZE

2022-09-09 Thread Nathan Bossart
On Wed, Sep 07, 2022 at 04:15:23PM -0700, Mark Dilger wrote: > Ok, now I'm a bit lost. If I want to use Nathan's feature to create a role > to vacuum and analyze my database on a regular basis, how does per-relation > granularity help me? If somebody creates a new table and doesn't grant those

Re: Patch proposal: make use of regular expressions for the username in pg_hba.conf

2022-09-09 Thread Jacob Champion
On Thu, Sep 8, 2022 at 5:46 PM Tom Lane wrote: > Jacob Champion writes: > > I think you're going to have to address backwards compatibility > > concerns. Today, I can create a role named "/a", and I can put that > > into the HBA without quoting it. I'd be unamused if, after an upgrade, > > my

Re: configure --with-uuid=bsd fails on NetBSD

2022-09-09 Thread Andres Freund
Hi, On 2022-09-09 17:31:40 -0400, Tom Lane wrote: > Harder for who? AFAICT there is nobody but me routinely running > full tests on NetBSD, else we'd have found this problem much earlier. Bilal's report was caused by automating testing on netbsd (and openbsd) as well, as part of the meson

Re: Switching XLog source from archive to streaming when primary available

2022-09-09 Thread Nathan Bossart
On Fri, Sep 09, 2022 at 11:07:00PM +0530, Bharath Rupireddy wrote: > On Fri, Sep 9, 2022 at 10:29 PM Nathan Bossart > wrote: >> IMO the timeout approach would be more intuitive for users. When it comes >> to archive recovery, "WAL segment" isn't a standard unit of measure. WAL >> segment size

Re: Introduce wait_for_subscription_sync for TAP tests

2022-09-09 Thread Thomas Munro
On Sat, Sep 10, 2022 at 9:45 AM Tom Lane wrote: > Masahiko Sawada writes: > > On Fri, Sep 9, 2022 at 11:31 PM Tom Lane wrote: > >> Recently a number of buildfarm animals have failed at the same > >> place in src/test/subscription/t/100_bugs.pl [1][2][3][4]: > >> > >> # Failed test '2x3000

Re: Avoid overhead with fprintf related functions

2022-09-09 Thread Ranier Vilela
Em sex., 9 de set. de 2022 às 18:53, Tom Lane escreveu: > Ranier Vilela writes: > > Em sex., 9 de set. de 2022 às 13:20, Nathan Bossart < > > nathandboss...@gmail.com> escreveu: > >> I agree with David [0]. But if you can demonstrate a performance gain, > >> perhaps it's worth considering a

Re: Introduce wait_for_subscription_sync for TAP tests

2022-09-09 Thread Masahiko Sawada
On Sat, Sep 10, 2022 at 6:45 AM Tom Lane wrote: > > Masahiko Sawada writes: > > On Fri, Sep 9, 2022 at 11:31 PM Tom Lane wrote: > >> Recently a number of buildfarm animals have failed at the same > >> place in src/test/subscription/t/100_bugs.pl [1][2][3][4]: > >> > >> # Failed test '2x3000

Re: Avoid overhead with fprintf related functions

2022-09-09 Thread Tom Lane
Ranier Vilela writes: > Em sex., 9 de set. de 2022 às 13:20, Nathan Bossart < > nathandboss...@gmail.com> escreveu: >> I agree with David [0]. But if you can demonstrate a performance gain, >> perhaps it's worth considering a subset of these changes in hot paths. > head: > Time: 418,210 ms >

Re: Avoid overhead with fprintf related functions

2022-09-09 Thread Ranier Vilela
Em sex., 9 de set. de 2022 às 10:45, Ranier Vilela escreveu: > Based on work in [1]. > According to https://cplusplus.com/reference/cstdio/fprintf/ > The use of fprintf is related to the need to generate a string based on a > format, which should be different from "%s". > Since fprintf has

Re: Introduce wait_for_subscription_sync for TAP tests

2022-09-09 Thread Tom Lane
Masahiko Sawada writes: > On Fri, Sep 9, 2022 at 11:31 PM Tom Lane wrote: >> Recently a number of buildfarm animals have failed at the same >> place in src/test/subscription/t/100_bugs.pl [1][2][3][4]: >> >> # Failed test '2x3000 rows in t' >> # at t/100_bugs.pl line 149. >> # got:

Re: Avoid overhead with fprintf related functions

2022-09-09 Thread Ranier Vilela
Em sex., 9 de set. de 2022 às 13:20, Nathan Bossart < nathandboss...@gmail.com> escreveu: > On Fri, Sep 09, 2022 at 10:45:37AM -0300, Ranier Vilela wrote: > > Based on work in [1]. > > According to https://cplusplus.com/reference/cstdio/fprintf/ > > The use of fprintf is related to the need to

Re: Introduce wait_for_subscription_sync for TAP tests

2022-09-09 Thread Masahiko Sawada
On Fri, Sep 9, 2022 at 11:31 PM Tom Lane wrote: > > Amit Kapila writes: > > Pushed. > > Recently a number of buildfarm animals have failed at the same > place in src/test/subscription/t/100_bugs.pl [1][2][3][4]: > > # Failed test '2x3000 rows in t' > # at t/100_bugs.pl line 149. > #

Re: configure --with-uuid=bsd fails on NetBSD

2022-09-09 Thread Tom Lane
Andres Freund writes: > On 2022-09-09 12:48:38 -0400, Tom Lane wrote: >> Pushed with those changes and doc updates. I did not push the >> variant expected-file. I think the entire point here is that >> we are *not* deeming the new NetBSD implementation acceptable, >> so allowing it to pass

Re: configure --with-uuid=bsd fails on NetBSD

2022-09-09 Thread Andres Freund
Hi, On 2022-09-09 12:48:38 -0400, Tom Lane wrote: > Pushed with those changes and doc updates. I did not push the > variant expected-file. I think the entire point here is that > we are *not* deeming the new NetBSD implementation acceptable, > so allowing it to pass regression tests is the

Re: Summary function for pg_buffercache

2022-09-09 Thread Aleksander Alekseev
Hi hackers, > > I suggest we focus on saving the memory first and then think about the > > performance, if necessary. > > +1 I made a mistake in v3 cfbot complained about. It should have been: ``` if (RelFileNumberIsValid(BufTagGetRelNumber(>tag))) ``` Here is the corrected patch. -- Best

Re: Expand palloc/pg_malloc API

2022-09-09 Thread Tom Lane
Robert Haas writes: > On Fri, Aug 12, 2022 at 3:31 AM Peter Eisentraut > wrote: >> (Personally, I have always been a bit suspicious about using the name >> palloc() without memory context semantics in frontend code, but I guess >> this is wide-spread now.) > I think it would be a good thing to

Re: Expand palloc/pg_malloc API

2022-09-09 Thread Tom Lane
Peter Eisentraut writes: > I have updated this patch set to rename the _obj() functions to > _object(), and I have dropped the _ptrtype() variants. > I have also split the patch to put the new API and the example uses into > separate patches. This patch set seems fine to me, so I've marked it

Re: [BUG] Storage declaration in ECPG

2022-09-09 Thread Tom Lane
Andrey Sokolov writes: > [ v2-0001-Fix-storage-declaration-in-ECPG.patch ] Pushed. I didn't think a whole new test case was appropriate, either from the patch-footprint or test-runtime standpoint, so I just added a couple of declarations to preproc/variable.pgc.

Re: preserve timestamps when installing headers

2022-09-09 Thread Heikki Linnakangas
On 11/01/2022 00:03, Tom Lane wrote: Peter Eisentraut writes: I don't think preserving timestamps should be the default behavior, but I would support organizing things so that additional options can be passed to "install" to make it do whatever the user prefers. But that won't work if some

Re: Making autovacuum logs indicate if insert-based threshold was the triggering condition

2022-09-09 Thread Peter Geoghegan
On Fri, Sep 9, 2022 at 11:11 AM Justin Pryzby wrote: > > It might make sense to *always* show how close we were to hitting each > > of the thresholds, including the ones that we didn't end up hitting > > (we may come pretty close quite often, which seems like it might > > matter). But showing

Re: why can't a table be part of the same publication as its schema

2022-09-09 Thread Mark Dilger
> On Sep 9, 2022, at 8:18 AM, Robert Haas wrote: > > Things might be clearer if we'd made the syntax "ALTER PUBLICATION p1 > { ADD | DROP } { TABLE | SCHEMA } name". I don't understand why we > used this ALL TABLES IN SCHEMA language. The conversation, as I recall, was that "ADD SCHEMA foo"

Re: Making autovacuum logs indicate if insert-based threshold was the triggering condition

2022-09-09 Thread Justin Pryzby
On Sat, Aug 06, 2022 at 04:09:28PM -0700, Peter Geoghegan wrote: > What are the chances that both thresholds will be crossed at *exactly* > (not approximately) the same time in a real world case, where the > table isn't tiny (tiny relative to the "autovacuum_naptime quantum")? > This is a very

Re: small windows psqlrc re-wording

2022-09-09 Thread Tom Lane
I wrote: > On testing that in HEAD, I read > Both the system-wide startup file and the user's personal startup file > can be made psql-version-specific by appending a dash and the > PostgreSQL major or minor release number to the file name, for example > ~/.psqlrc-16 or

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-09 Thread Jaime Casanova
On Wed, Sep 07, 2022 at 12:39:08PM -0700, Andres Freund wrote: > Hi, > > On 2022-09-06 18:40:49 -0500, Jaime Casanova wrote: > > I'm not sure what is causing this, but I have seen this twice. The > > second time without activity after changing the set of tables in a > > PUBLICATION. > > Can you

Re: Switching XLog source from archive to streaming when primary available

2022-09-09 Thread Bharath Rupireddy
On Fri, Sep 9, 2022 at 10:29 PM Nathan Bossart wrote: > > On Fri, Sep 09, 2022 at 12:14:25PM +0530, Bharath Rupireddy wrote: > > On Fri, Sep 9, 2022 at 10:57 AM Kyotaro Horiguchi > > wrote: > >> At Thu, 8 Sep 2022 10:53:56 -0700, Nathan Bossart > >> wrote in > >> > My general point is that we

Re: Possible crash on standby

2022-09-09 Thread Nathan Bossart
On Fri, Sep 09, 2022 at 10:51:10PM +0530, Bharath Rupireddy wrote: > I think it is a duplicate of [1]. I have tested the above use-case > with the patch at [1] and it fixes the issue. I added this thread to the existing commitfest entry. Thanks for pointing this out.

Re: Summary function for pg_buffercache

2022-09-09 Thread Nathan Bossart
On Fri, Sep 09, 2022 at 05:36:45PM +0300, Aleksander Alekseev wrote: > However I'm afraid you can't examine BufferDesc's without taking > locks. This is explicitly stated in buf_internals.h: Yeah, when I glanced at this patch earlier, I wondered about this. > I suggest we focus on saving the

Re: Possible crash on standby

2022-09-09 Thread Bharath Rupireddy
On Fri, Sep 9, 2022 at 2:00 PM Kyotaro Horiguchi wrote: > > Hello. > > While I played with some patch, I met an assertion failure. > > #2 0x00b350e0 in ExceptionalCondition ( > conditionName=0xbd8970 "!IsInstallXLogFileSegmentActive()", > errorType=0xbd6e11 "FailedAssertion",

Re: Error "initial slot snapshot too large" in create replication slot

2022-09-09 Thread Robert Haas
On Mon, Jul 18, 2022 at 10:55 PM Kyotaro Horiguchi wrote: > Thanks! Just rebased. Hi, I mentioned this patch to Andres in conversation, and he expressed a concern that there might be no guarantee that we retain enough CLOG to look up XIDs. Presumably this wouldn't be an issue when the snapshot

Re: Possible crash on standby

2022-09-09 Thread Nathan Bossart
On Fri, Sep 09, 2022 at 05:29:49PM +0900, Kyotaro Horiguchi wrote: > This is because WaitForWALToBecomeAvailable doesn't call > XLogSHutdownWalRcv() when walreceiver has been stopped before we reach > the WalRcvStreaming() call cited above. But we need to set > InstasllXLogFileSegmentActive to

Re: is_superuser is not documented

2022-09-09 Thread Tom Lane
I wrote: > On the other hand, it seems pretty silly that it's GUC_REPORT if > we want to consider it private. I've not checked the git history, > but I bet that flag was added later with no thought about context. > > If we are going to document this then we should at least remove > the

Re: Add the ability to limit the amount of memory that can be allocated to backends.

2022-09-09 Thread Justin Pryzby
On Sat, Sep 03, 2022 at 11:40:03PM -0400, Reid Thompson wrote: > > > +   0, 0, INT_MAX, > > > +   NULL, NULL, NULL > > I think this needs a maximum like INT_MAX/1024/1024 > > Is this noting that we'd set a ceiling of 2048MB? The reason is that you're later multiplying it

Re: Add tracking of backend memory allocated to pg_stat_activity

2022-09-09 Thread Justin Pryzby
On Fri, Sep 09, 2022 at 12:34:15PM -0400, Stephen Frost wrote: > > While we are at it, what do you think about also recording the max memory > > allocated by a backend? (could be useful and would avoid sampling for which > > there is no guarantee to sample the max anyway). FYI, that's already

Re: Switching XLog source from archive to streaming when primary available

2022-09-09 Thread Nathan Bossart
On Fri, Sep 09, 2022 at 12:14:25PM +0530, Bharath Rupireddy wrote: > On Fri, Sep 9, 2022 at 10:57 AM Kyotaro Horiguchi > wrote: >> At Thu, 8 Sep 2022 10:53:56 -0700, Nathan Bossart >> wrote in >> > My general point is that we should probably offer some basic preventative >> > measure against

Re: Remove redundant code in pl_exec.c

2022-09-09 Thread Tom Lane
Japin Li writes: > On Fri, 09 Sep 2022 at 23:34, Tom Lane wrote: >> I don't like this particularly --- it puts way too much premium on >> the happenstance that the MakeExpandedObjectReadOnly call is the >> very last step in the callback function. If that needed to change, >> we'd have a mess.

Re: is_superuser is not documented

2022-09-09 Thread Tom Lane
"Euler Taveira" writes: > On Fri, Sep 9, 2022, at 2:28 AM, bt22kawamotok wrote: >> is_superuser function checks whether a user is a superuser or not, and >> is commonly used. However, is_superuser is not documented and is set to >> UNGROUPED in guc.c. I think is_superuser should be added to the

Re: Add the ability to limit the amount of memory that can be allocated to backends.

2022-09-09 Thread Stephen Frost
Greetings, * David Rowley (dgrowle...@gmail.com) wrote: > On Thu, 1 Sept 2022 at 04:52, Reid Thompson > wrote: > > Add the ability to limit the amount of memory that can be allocated to > > backends. > > Are you aware that relcache entries are stored in backend local memory > and that once

Re: configure --with-uuid=bsd fails on NetBSD

2022-09-09 Thread Tom Lane
Nazir Bilal Yavuz writes: > I updated my patch. I checked version field in 'uuid_generate_internal' > function instead of checking it in 'uuid_generate_v1' and > 'uuid_generate_v1mc' functions, but I have some questions: Yeah, that seems like the right place. I tweaked the code to check

Re: ICU for global collation

2022-09-09 Thread Justin Pryzby
In pg14: |postgres=# create database a LC_COLLATE C LC_CTYPE C LOCALE C; |ERROR: conflicting or redundant options |DETAIL: LOCALE cannot be specified together with LC_COLLATE or LC_CTYPE. In pg15: |postgres=# create database a LC_COLLATE "en_US.UTF-8" LC_CTYPE "en_US.UTF-8" LOCALE

Re: Add tracking of backend memory allocated to pg_stat_activity

2022-09-09 Thread Stephen Frost
Greetings, * Kyotaro Horiguchi (horikyota@gmail.com) wrote: > At Tue, 06 Sep 2022 17:10:49 -0400, Reid Thompson > wrote in > > I'm open to guidance on testing for performance degradation. I did > > note some basic pgbench comparison numbers in the thread regarding > > limiting backend

Re: [PATCH] Fix alter subscription concurrency errors

2022-09-09 Thread Alvaro Herrera
On 2022-Aug-26, Jelte Fennema wrote: > I indeed don't think this problem is unique to subscriptions, but it seems > better to at least have this problem in a few places less (not making perfect > the enemy of good). > > If someone has a more generic way of solving this for other commands too,

Re: Add tracking of backend memory allocated to pg_stat_activity

2022-09-09 Thread Stephen Frost
Greetings, * Drouvot, Bertrand (bdrou...@amazon.com) wrote: > On 9/1/22 3:28 AM, Kyotaro Horiguchi wrote: > >At Wed, 31 Aug 2022 12:05:55 -0500, Justin Pryzby > >wrote in > >>On Wed, Aug 31, 2022 at 12:03:06PM -0400, Reid Thompson wrote: > >>>Attached is a patch to > >>>Add tracking of backend

Re: Avoid overhead with fprintf related functions

2022-09-09 Thread Nathan Bossart
On Fri, Sep 09, 2022 at 10:45:37AM -0300, Ranier Vilela wrote: > Based on work in [1]. > According to https://cplusplus.com/reference/cstdio/fprintf/ > The use of fprintf is related to the need to generate a string based on a > format, which should be different from "%s". > Since fprintf has

Re: pg_upgrade generated files in subdir follow-up

2022-09-09 Thread Justin Pryzby
On Wed, Aug 31, 2022 at 04:41:24PM +0200, Daniel Gustafsson wrote: > > On 31 Aug 2022, at 15:59, Tom Lane wrote: > > > > Daniel Gustafsson writes: > >> Commit 38bfae36526 moved the .txt files pg_upgrade generates to a separate > >> subdir, but there are a few left which are written to cwd. The

Re: Remove redundant code in pl_exec.c

2022-09-09 Thread Japin Li
On Fri, 09 Sep 2022 at 23:34, Tom Lane wrote: > Japin Li writes: >> IMO, we can invoke plpgsql_param_eval_generic in >> plpgsql_param_eval_generic_ro >> to avoid the redundant. > > I don't like this particularly --- it puts way too much premium on > the happenstance that the

Re: is_superuser is not documented

2022-09-09 Thread Euler Taveira
On Fri, Sep 9, 2022, at 2:28 AM, bt22kawamotok wrote: > is_superuser function checks whether a user is a superuser or not, and > is commonly used. However, is_superuser is not documented and is set to > UNGROUPED in guc.c. I think is_superuser should be added to the > documentation and set to

Re: Remove redundant code in pl_exec.c

2022-09-09 Thread Tom Lane
Japin Li writes: > I found there are some redundant code in pl_exec.c, > plpgsql_param_eval_generic_ro is same as plpgsql_param_eval_generic > except it invokes MakeExpandedObjectReadOnly. Which is exactly why it's NOT redundant. > IMO, we can invoke plpgsql_param_eval_generic in

Re: why can't a table be part of the same publication as its schema

2022-09-09 Thread Robert Haas
On Fri, Sep 9, 2022 at 10:29 AM houzj.f...@fujitsu.com wrote: > IIRC, the feature currently works almost the same as you described. It doesn't > create entry for tables that are published via its schema level, it only > record > the published schema and check which tables are part of it. Oh,

Remove redundant code in pl_exec.c

2022-09-09 Thread Japin Li
Hi, hackers I found there are some redundant code in pl_exec.c, plpgsql_param_eval_generic_ro is same as plpgsql_param_eval_generic except it invokes MakeExpandedObjectReadOnly. IMO, we can invoke plpgsql_param_eval_generic in plpgsql_param_eval_generic_ro to avoid the redundant. Is there

Re: configure --with-uuid=bsd fails on NetBSD

2022-09-09 Thread Nazir Bilal Yavuz
Hi, On 8/26/22 19:21, Tom Lane wrote: Nazir Bilal Yavuz writes: Based on these discussions, I attached a patch. I think the right fix is to call uuid_create and then actually check the version field of the result. This avoids breaking what need not be broken, and it'd also guard against

Re: HOT chain validation in verify_heapam()

2022-09-09 Thread Robert Haas
On Fri, Sep 9, 2022 at 10:00 AM Himanshu Upadhyaya wrote: > Approach of introducing a successor array is good but I see one overhead with > having both successor and predecessor array, that is, we will traverse each > offset on page thrice(one more for original loop on offset) and with each >

Re: Summary function for pg_buffercache

2022-09-09 Thread Aleksander Alekseev
Hi Melih, > I would appreciate any feedback/comment on this change. Another benefit of pg_buffercache_summary() you didn't mention is that it allocates much less memory than pg_buffercache_pages() does. Here is v3 where I added this to the documentation. The patch didn't apply to the current

Re: Introduce wait_for_subscription_sync for TAP tests

2022-09-09 Thread Tom Lane
Amit Kapila writes: > Pushed. Recently a number of buildfarm animals have failed at the same place in src/test/subscription/t/100_bugs.pl [1][2][3][4]: # Failed test '2x3000 rows in t' # at t/100_bugs.pl line 149. # got: '9000' # expected: '6000' # Looks like you failed 1 test

RE: why can't a table be part of the same publication as its schema

2022-09-09 Thread houzj.f...@fujitsu.com
On Friday, September 9, 2022 9:57 PM Robert Haas wrote: > > On Fri, Sep 9, 2022 at 5:21 AM Amit Kapila wrote: > > So, why shouldn't a "FOR ALL TABLES IN SCHEMA" publication follow a > > similar behavior? Hi > > It feels like a mistake to me that there's any catalog representation at all >

Re: [PATCH v1] fix potential memory leak in untransformRelOptions

2022-09-09 Thread Alvaro Herrera
On 2022-Sep-01, Tom Lane wrote: > Junwang Zhao writes: > > result = lappend(result, makeDefElem(pstrdup(s), val, -1)); > > + pfree(s); > > I wonder why it's pstrdup'ing s in the first place. Yeah, I think both the pstrdups in that function are useless. The DefElems can just point to the

Re: Patch proposal: make use of regular expressions for the username in pg_hba.conf

2022-09-09 Thread Tom Lane
"Drouvot, Bertrand" writes: > Agree that it seems unlikely but maybe we could add a new GUC to turn > the regex usage on the hba file on/off (and use off as the default)? I think that will just add useless complication. regards, tom lane

Re: HOT chain validation in verify_heapam()

2022-09-09 Thread Himanshu Upadhyaya
On Wed, Sep 7, 2022 at 2:49 AM Robert Haas wrote: > > But here's one random idea: add a successor[] array and an lp_valid[] > array. In the first loop, set lp_valid[offset] = true if it passes the > check_lp() checks, and set successor[A] = B if A redirects to B or has > a CTID link to B,

Re: why can't a table be part of the same publication as its schema

2022-09-09 Thread Robert Haas
On Fri, Sep 9, 2022 at 5:21 AM Amit Kapila wrote: > So, why shouldn't a "FOR ALL TABLES IN SCHEMA" publication follow a > similar behavior? Surely that is not the same case at all. If you're publishing everything, there's no point in also having a specific list of things that you want published,

Avoid overhead with fprintf related functions

2022-09-09 Thread Ranier Vilela
Based on work in [1]. According to https://cplusplus.com/reference/cstdio/fprintf/ The use of fprintf is related to the need to generate a string based on a format, which should be different from "%s". Since fprintf has overhead when parsing the "format" parameter, plus all the trouble of checking

Re: Summary function for pg_buffercache

2022-09-09 Thread Melih Mutlu
Hi hackers, I also added documentation changes into the patch. You can find it attached. I would appreciate any feedback about this pg_buffercache_summary function. Best, Melih From 82e92d217dd240a9b6c1184cf29d4718343558b8 Mon Sep 17 00:00:00 2001 From: Melih Mutlu Date: Tue, 9 Aug 2022

Re: confirmed_flush_lsn shows LSN of the data that has not yet been received by the logical subscriber.

2022-09-09 Thread Ashutosh Bapat
On Thu, Sep 8, 2022 at 8:32 PM Ashutosh Sharma wrote: > > On Thu, Sep 8, 2022 at 6:23 PM Ashutosh Bapat > wrote: > > > > On Thu, Sep 8, 2022 at 4:14 PM Ashutosh Sharma > > wrote: > > > > > > Hi All, > > > > > > The logically decoded data are sent to the logical subscriber at the time > > > of

Re: Doc fix and adjustment for MERGE command

2022-09-09 Thread Vitaly Burovoy
On 2022-09-09 11:54Z, Alvaro Herrera wrote: On 2022-Sep-08, Vik Fearing wrote: On 9/7/22 22:51, Vitaly Burovoy wrote: Hello hackers! Reading docs for the MERGE statement I've found a little error: a semicolon in middle of a statement and absence of a semicolon in the end of it. Key words in

Re: MERGE and parsing with prepared statements

2022-09-09 Thread Alvaro Herrera
On 2022-Aug-12, Simon Riggs wrote: > Sorry, but I disagree with this chunk in the latest commit, > specifically, changing the MATCHED from after to before the NOT > MATCHED clause. > > The whole point of the second example was to demonstrate that the > order of the MATCHED/NOT MATCHED clauses

Re: [PATCH]Feature improvement for MERGE tab completion

2022-09-09 Thread Shinya Kato
On 2022-09-09 11:18, bt22kawamotok wrote: I created a patch for improving MARGE tab completion. Currently there is a problem with "MERGE INTO dst as d Using src as s ON d.key = s.key WHEN " is typed, "MATCHED" and "NOT MATCHED" is not completed. There is also a problem that typing "MERGE INTO a

Re: Doc fix and adjustment for MERGE command

2022-09-09 Thread Alvaro Herrera
On 2022-Sep-08, Vik Fearing wrote: > On 9/7/22 22:51, Vitaly Burovoy wrote: > > Hello hackers! > > > > Reading docs for the MERGE statement I've found a little error: a > > semicolon in middle of a statement and absence of a semicolon in the end > > of it. > > > > Key words in subqueries are

Re: New docs chapter on Transaction Management and related changes

2022-09-09 Thread Simon Riggs
On Thu, 8 Sept 2022 at 08:42, Alvaro Herrera wrote: > > On 2022-Sep-06, Simon Riggs wrote: > > > On Tue, 6 Sept 2022 at 17:19, Erik Rijkers wrote: > > > > > > Op 06-09-2022 om 17:16 schreef Simon Riggs: > > > > New chapter on transaction management, plus a few related changes. > > > > > > > >

Re: Bump MIN_WINNT to 0x0600 (Vista) as minimal runtime in 16~

2022-09-09 Thread Michael Paquier
On Fri, Sep 09, 2022 at 10:55:55AM +0900, Michael Paquier wrote: > Thanks. This set of simplifications is too good to let go, and I have > a window to look after the buildfarm today and tomorrow, which should > be enough to take action if need be. Hence, I have applied the > patch. Now, let's

Re: Implementing Incremental View Maintenance

2022-09-09 Thread Yugo NAGATA
Hello huyajun, I'm sorry for delay in my response. On Tue, 26 Jul 2022 12:00:26 +0800 huyajun wrote: > I read your patch and think this processing is greet, but there is a risk of > deadlock. > Although I have not thought of a suitable processing method for the time > being, > it is also

Re: SI-read predicate locks on materialized views

2022-09-09 Thread Dilip Kumar
On Tue, Jul 26, 2022 at 3:31 PM Richard Guo wrote: > > > On Tue, Jul 26, 2022 at 3:44 PM Yugo NAGATA wrote: >> >> If such two transactions run concurrently, a write skew anomaly occurs, >> and the result of order_summary refreshed in T1 will not contain the >> record inserted in T2. Yes we do

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-09 Thread Alvaro Herrera
On 2022-Sep-09, Amit Langote wrote: > Yes, the loop in GetForeignKeyActionTriggers() needs this: > > + /* Only ever look at "action" triggers on the PK side. */ > + if (RI_FKey_trigger_type(trgform->tgfoid) != RI_TRIGGER_PK) > + continue; > > Likewise,

Re: making relfilenodes 56 bits

2022-09-09 Thread Dilip Kumar
On Thu, Sep 8, 2022 at 4:10 PM Dilip Kumar wrote: > On a separate note, while reviewing the latest patch I see there is some risk > of using the unflushed relfilenumber in GetNewRelFileNumber() function. > Basically, in the current code, the flushing logic is tightly coupled with > the

Re: why can't a table be part of the same publication as its schema

2022-09-09 Thread Amit Kapila
On Fri, Sep 9, 2022 at 11:44 AM Tom Lane wrote: > > Amit Kapila writes: > > To avoid these confusions, we have disallowed adding a table if its > > schema is already part of the publication and vice-versa. > > Really? > > Is there logic in ALTER TABLE SET SCHEMA that rejects the command >

RE: Perform streaming logical transactions by background workers and parallel apply

2022-09-09 Thread houzj.f...@fujitsu.com
On Friday, September 9, 2022 3:02 PM Peter Smith wrote: > > Here are my review comments for the v28-0001 patch: > > (There may be some overlap with other people's review comments and/or > some fixes already made). > Thanks for the comments. > 3. > > max_logical_replication_workers

Re: proposal: possibility to read dumped table's name from file

2022-09-09 Thread Andrew Dunstan
> On Sep 9, 2022, at 5:53 PM, John Naylor wrote: > > On Thu, Sep 8, 2022 at 7:32 PM Daniel Gustafsson wrote: >> [v3] > > Note that the grammar has shift-reduce conflicts. If you run a fairly > recent Bison, you can show them like this: > > bison -Wno-deprecated -Wcounterexamples -d -o

Possible crash on standby

2022-09-09 Thread Kyotaro Horiguchi
Hello. While I played with some patch, I met an assertion failure. #2 0x00b350e0 in ExceptionalCondition ( conditionName=0xbd8970 "!IsInstallXLogFileSegmentActive()", errorType=0xbd6e11 "FailedAssertion", fileName=0xbd6f28 "xlogrecovery.c", lineNumber=4190) at assert.c:69

Re: proposal: possibility to read dumped table's name from file

2022-09-09 Thread John Naylor
On Thu, Sep 8, 2022 at 7:32 PM Daniel Gustafsson wrote: > [v3] Note that the grammar has shift-reduce conflicts. If you run a fairly recent Bison, you can show them like this: bison -Wno-deprecated -Wcounterexamples -d -o filterparse.c filterparse.y filterparse.y: warning: 2 shift/reduce

Re: [BUG] wrong FK constraint name when colliding name on ATTACH

2022-09-09 Thread Amit Langote
On Fri, Sep 9, 2022 at 4:54 AM Tom Lane wrote: > Andres Freund writes: > > Something here doesn't look to be quite right. Starting with this commit CI > > [1] started to fail on freebsd (stack trace [2]), and in the meson branch > > I've > > also seen the crash on windows (CI run[3], stack

Re: Perform streaming logical transactions by background workers and parallel apply

2022-09-09 Thread Peter Smith
Here are my review comments for the v28-0001 patch: (There may be some overlap with other people's review comments and/or some fixes already made). == 1. Commit Message In addition, the patch extends the logical replication STREAM_ABORT message so that abort_time and abort_lsn can also be

Re: Improve description of XLOG_RUNNING_XACTS

2022-09-09 Thread Kyotaro Horiguchi
At Fri, 9 Sep 2022 09:48:05 +0900, Masahiko Sawada wrote in > On Tue, Aug 23, 2022 at 11:53 AM Kyotaro Horiguchi > wrote: > > > > At Mon, 15 Aug 2022 11:16:56 +0900, Masahiko Sawada > > wrote in > > > Or we can output the "subxid overwlowed" first. > > > > (I prefer this, as that doesn't

Re: Switching XLog source from archive to streaming when primary available

2022-09-09 Thread Bharath Rupireddy
On Fri, Sep 9, 2022 at 10:57 AM Kyotaro Horiguchi wrote: > > At Thu, 8 Sep 2022 10:53:56 -0700, Nathan Bossart > wrote in > > On Thu, Sep 08, 2022 at 05:16:53PM +0530, Bharath Rupireddy wrote: > > > I'm attaching the v3 patch with the review comments addressed, please > > > review it further. >

Re: why can't a table be part of the same publication as its schema

2022-09-09 Thread Tom Lane
Amit Kapila writes: > To avoid these confusions, we have disallowed adding a table if its > schema is already part of the publication and vice-versa. Really? Is there logic in ALTER TABLE SET SCHEMA that rejects the command dependent on the contents of the publication tables? If so, are there