Re: Invalidate the subscription worker in cases where a user loses their superuser status

2023-09-22 Thread Amit Kapila
On Sat, Sep 23, 2023 at 1:27 AM vignesh C wrote: > > > Fixed this issue by checking if the subscription owner has changed > from superuser to non-superuser in case the pg_authid rows changes. > The attached patch has the changes for the same. > @@ -3952,7 +3953,9 @@

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-22 Thread Hayato Kuroda (Fujitsu)
Dear Bharath, > > You mentioned at line 118, but at that time logical replication system is > > not > created. > > The subscriber is created at line 163. > > Therefore WALs would not be consumed automatically. > > So, not calling pg_logical_slot_get_changes() on test_slot1 won't > consume the

RE: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-22 Thread Hayato Kuroda (Fujitsu)
Dear Bharath, Again, thank you for reviewing! Here is a new version patch. > 1. > +{ oid => '8046', descr => 'for use by pg_upgrade', > + proname => 'binary_upgrade_validate_wal_records', proisstrict => 'f', > + provolatile => 'v', proparallel => 'u', prorettype => 'bool', > > +if

nbtree's ScalarArrayOp array mark/restore code appears to be buggy

2023-09-22 Thread Peter Geoghegan
Attached test case demonstrates an issue with nbtree's mark/restore code. All supported versions are affected. My suspicion is that bugfix commit 70bc5833 missed some subtlety around what we need to do to make sure that the array keys stay "in sync" with the scan. I'll have time to debug the

Re: Questions about the new subscription parameter: password_required

2023-09-22 Thread Jeff Davis
On Fri, 2023-09-22 at 08:36 -0400, Robert Haas wrote: > On Fri, Sep 22, 2023 at 4:25 AM Benoit Lobréau > wrote: > > Can we consider adding something like this to clarify? > > > > """ > > This parameter is enforced when the CREATE SUBSCRIPTION or ALTER > > SUBSCRIPTION .. CONNECTION commands are

Failures on gombessa -- EIO?

2023-09-22 Thread Thomas Munro
I am not sure why REL_16_STABLE fails consistently as of ~4 days ago. It seems like bad storage or something? Just now it happened also on HEAD. I wonder why it would be sensitive to the branch.

Re: Synchronizing slots from primary to standby

2023-09-22 Thread Amit Kapila
On Fri, Sep 22, 2023 at 6:01 PM Drouvot, Bertrand wrote: > > Thanks for all the work that has been done on this feature, and sorry > to have been quiet on it for so long. > > On 9/18/23 12:22 PM, shveta malik wrote: > > On Wed, Sep 13, 2023 at 4:48 PM Hayato Kuroda (Fujitsu) > > wrote: > >>

Re: Add support for AT LOCAL

2023-09-22 Thread Vik Fearing
On 9/22/23 23:46, cary huang wrote: The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: tested, passed Documentation:tested, passed Hello I think this

Re: Add support for AT LOCAL

2023-09-22 Thread cary huang
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: tested, passed Documentation:tested, passed Hello I think this feature can be a useful addition in

Re: Better help output for pgbench -I init_steps

2023-09-22 Thread Tristen Raab
The following review has been posted through the commitfest application: make installcheck-world: not tested Implements feature: tested, passed Spec compliant: not tested Documentation:not tested Hello, I've reviewed all 4 of your patches, each one applies and builds

Is this a problem in GenericXLogFinish()?

2023-09-22 Thread Jeff Davis
src/backend/transam/README says: ... 4. Mark the shared buffer(s) as dirty with MarkBufferDirty(). (This  must happen before the WAL record is inserted; see notes in  SyncOneBuffer().) ... But GenericXLogFinish() does this: ... /* Insert xlog record */ lsn =

Re: CREATE FUNCTION ... SEARCH { DEFAULT | SYSTEM | SESSION }

2023-09-22 Thread Jeff Davis
On Thu, 2023-09-21 at 14:06 -0400, Robert Haas wrote: > Also, in a case like this, I don't think it's unreasonable to ask > whether, perhaps, Bob just needs to be a little more careful about > setting search_path. That's what this whole thread is about: I wish it was reasonable, but I don't

Re: Questions about the new subscription parameter: password_required

2023-09-22 Thread Robert Haas
On Fri, Sep 22, 2023 at 10:59 AM Benoit Lobréau wrote: > You're right, it comes from the connection to drop the slot. > > But the code in for DropSubscription in > src/backend/commands/subscriptioncmds.c tries to connect before testing > if the slot is NONE / NULL. So it doesn't work to DISABLE

Invalidate the subscription worker in cases where a user loses their superuser status

2023-09-22 Thread vignesh C
Hi, The subscription worker was not getting invalidated when the subscription owner changed from superuser to non-superuser. Here is a test case for the same: Publisher: CREATE USER repl REPLICATION PASSWORD 'secret'; CREATE TABLE t(i INT); INSERT INTO t VALUES(1); GRANT SELECT ON t

Re: GenBKI emits useless open;close for catalogs without rows

2023-09-22 Thread Matthias van de Meent
On Fri, 22 Sept 2023 at 00:25, Andres Freund wrote: > > Hi, > > On 2023-09-19 21:05:41 +0300, Heikki Linnakangas wrote: > > On 18/09/2023 17:50, Matthias van de Meent wrote: > > > (initdb takes about 73ms locally with syncing disabled) > > > > That's impressive. It takes about 600 ms on my

Re: GUC for temporarily disabling event triggers

2023-09-22 Thread Daniel Gustafsson
> On 7 Sep 2023, at 21:02, Robert Haas wrote: > > On Thu, Sep 7, 2023 at 1:57 AM Michael Paquier wrote: >> + GUC_NOT_IN_SAMPLE | GUC_DISALLOW_IN_FILE >> >> I am a bit surprised by these two additions. Setting this GUC at >> file-level can be useful, as is documenting it in the

Re: GenBKI emits useless open;close for catalogs without rows

2023-09-22 Thread Matthias van de Meent
On Tue, 19 Sept 2023 at 20:05, Heikki Linnakangas wrote: > > On 18/09/2023 17:50, Matthias van de Meent wrote: > > (initdb takes about 73ms locally with syncing disabled) > > That's impressive. It takes about 600 ms on my laptop. Of which about > 140 ms goes into processing the BKI file. And

Re: Questions about the new subscription parameter: password_required

2023-09-22 Thread Benoit Lobréau
On 9/22/23 14:36, Robert Haas wrote: I haven't checked this, but I think what's happening here is that DROP SUBSCRIPTION tries to drop the remote slot, which requires making a connection, which can trigger the error. You might get different results if you did ALTER SUBSCRIPTION ... SET

Re: Row pattern recognition

2023-09-22 Thread Jacob Champion
On Fri, Sep 22, 2023, 3:13 AM Tatsuo Ishii wrote: > > Op 9/22/23 om 07:16 schreef Tatsuo Ishii: > >>> Attached is the fix against v6 patch. I will include this in upcoming > >>> v7 patch. > >> Attached is the v7 patch. It includes the fix mentioned above. Also > > (Champion's address bounced;

Re: Index range search optimization

2023-09-22 Thread Alexander Korotkov
Hi Peter, Hi Pavel, The v4 of the patch is attached. On Thu, Sep 21, 2023 at 11:48 PM Peter Geoghegan wrote: > > On Thu, Sep 21, 2023 at 5:11 AM Pavel Borisov wrote: > > I looked at the patch code and I agree with this optimization. > > Implementation also looks good to me except change : > >

Re: Index range search optimization

2023-09-22 Thread Pavel Borisov
On Fri, 22 Sept 2023 at 00:48, Peter Geoghegan wrote: > > On Thu, Sep 21, 2023 at 5:11 AM Pavel Borisov wrote: > > I looked at the patch code and I agree with this optimization. > > Implementation also looks good to me except change : > > + if (key->sk_flags & (SK_BT_REQFWD | SK_BT_REQBKWD) && >

Re: Use virtual tuple slot for Unique node

2023-09-22 Thread Heikki Linnakangas
I did a little more perf testing with this. I'm seeing the same benefit with the query you posted. But can we find a case where it's not beneficial? If I understand correctly, when the input slot is a virtual slot, it's cheaper to copy it to another virtual slot than to form a minimal tuple.

Re: bug fix and documentation improvement about vacuumdb

2023-09-22 Thread Daniel Gustafsson
> On 22 Sep 2023, at 11:08, Kuwamura Masaki > wrote: > > No worries at all. If you look at the page now you will see all green > checkmarks indicating that the patch was tested in CI. So now we know that > your tests fail without the fix and work with the fix applied, so all is well. > >

Re: Questions about the new subscription parameter: password_required

2023-09-22 Thread Robert Haas
On Fri, Sep 22, 2023 at 4:25 AM Benoit Lobréau wrote: > Can we consider adding something like this to clarify? > > """ > This parameter is enforced when the CREATE SUBSCRIPTION or ALTER > SUBSCRIPTION .. CONNECTION commands are executed. Therefore, it's > possible to alter the ownership of a

Re: Synchronizing slots from primary to standby

2023-09-22 Thread Drouvot, Bertrand
Hi, Thanks for all the work that has been done on this feature, and sorry to have been quiet on it for so long. On 9/18/23 12:22 PM, shveta malik wrote: On Wed, Sep 13, 2023 at 4:48 PM Hayato Kuroda (Fujitsu) wrote: Right, but I wanted to know why it is needed. One motivation seemed to know

RE: pg_ctl start may return 0 even if the postmaster has been already started on Windows

2023-09-22 Thread Hayato Kuroda (Fujitsu)
Dear Horiguchi-san, Thank you for making a patch! They can pass ci. I'm still not sure what should be, but I can respond a part. > Another issue is.. that I haven't been able to cause the false > positive of pg_ctl start.. Do you have a concise reproducer of the > issue? I found a short sleep

Re: Refactor ssl tests to avoid using internal PostgreSQL::Test::Cluster methods

2023-09-22 Thread Daniel Gustafsson
> On 3 Jul 2023, at 13:37, Heikki Linnakangas wrote: > If "pg_ctl restart" fails because of a timeout, for example, the PID file > could be present. Previously, the _update_pid(0) would error out on that, but > now it's accepted. I think that's fine, but just wanted to point it out.

Re: Row pattern recognition

2023-09-22 Thread Erik Rijkers
Op 9/22/23 om 12:12 schreef Tatsuo Ishii: Op 9/22/23 om 07:16 schreef Tatsuo Ishii: Attached is the fix against v6 patch. I will include this in upcoming v7 patch. Attached is the v7 patch. It includes the fix mentioned above. Also (Champion's address bounced; removed) On my side his

Re: logical decoding and replication of sequences, take 2

2023-09-22 Thread Dilip Kumar
On Wed, Sep 20, 2023 at 3:23 PM Dilip Kumar wrote: > > On Wed, Aug 16, 2023 at 7:57 PM Tomas Vondra > wrote: > > > > I was reading through 0001, I noticed this comment in > ReorderBufferSequenceIsTransactional() function > > + * To decide if a sequence change should be handled as transactional

Re: pg_upgrade --check fails to warn about abstime

2023-09-22 Thread Alvaro Herrera
On 2023-Sep-21, Tom Lane wrote: > Bruce Momjian writes: > > Wow, I never added code to pg_upgrade to check for that, and no one > > complained either. > > Yeah, so most people had indeed listened to warnings and moved away > from those datatypes. I'm inclined to think that adding code for

Re: Dump-restore loosing 'attnotnull' bit for DEFERRABLE PRIMARY KEY column(s).

2023-09-22 Thread Amul Sul
On Wed, Sep 20, 2023 at 8:29 PM Alvaro Herrera wrote: > On 2023-Sep-20, Amul Sul wrote: > > > On the latest master head, I can see a $subject bug that seems to be > related > > commit #b0e96f311985: > > > > Here is the table definition: > > create table foo(i int, j int, CONSTRAINT pk PRIMARY

Re: Synchronizing slots from primary to standby

2023-09-22 Thread Amit Kapila
On Thu, Sep 21, 2023 at 9:16 AM shveta malik wrote: > > On Tue, Sep 19, 2023 at 10:29 AM shveta malik wrote: > > Currently in patch001, synchronize_slot_names is a GUC on both primary > and physical standby. This GUC tells which all logical slots need to > be synced on physical standbys from the

Re: Infinite Interval

2023-09-22 Thread Ashutosh Bapat
On Fri, Sep 22, 2023 at 2:35 PM jian he wrote: > > /* TODO: Handle NULL inputs? */ > since interval_avg_serialize is strict, so handle null would be like: > if (PG_ARGISNULL(0)) then PG_RETURN_NULL(); That's automatically taken care of by the executor. Functions need to handle NULL inputs if

Re: Row pattern recognition

2023-09-22 Thread Tatsuo Ishii
> Op 9/22/23 om 07:16 schreef Tatsuo Ishii: >>> Attached is the fix against v6 patch. I will include this in upcoming >>> v7 patch. >> Attached is the v7 patch. It includes the fix mentioned above. Also > (Champion's address bounced; removed) On my side his adress bounced too:-< > Hi, > > In

Re: Report planning memory in EXPLAIN ANALYZE

2023-09-22 Thread Ashutosh Bapat
Hi Andy, Thanks for your feedback. On Fri, Sep 22, 2023 at 8:22 AM Andy Fan wrote: > > 1). The commit message of patch 1 just says how it does but doesn't > say why it does. After reading through the discussion, I suggest making > it clearer to others. > > ... > After the planning is done, it

Re: Row pattern recognition

2023-09-22 Thread Erik Rijkers
Op 9/22/23 om 07:16 schreef Tatsuo Ishii: Attached is the fix against v6 patch. I will include this in upcoming v7 patch. Attached is the v7 patch. It includes the fix mentioned above. Also Hi, In my hands, make check fails on the rpr test; see attached .diff file. In these two statements:

Re: Fix error handling in be_tls_open_server()

2023-09-22 Thread Daniel Gustafsson
> On 20 Sep 2023, at 10:58, Daniel Gustafsson wrote: >> On 20 Sep 2023, at 10:55, Sergey Shinderuk >> wrote: >> There is a typo: upon en error. Otherwise, looks good to me. Thank you. > > Thanks, will fix before pushing. I've applied this down to v15 now and the buildfarm have green builds

Re: bug fix and documentation improvement about vacuumdb

2023-09-22 Thread Kuwamura Masaki
> > No worries at all. If you look at the page now you will see all green > checkmarks indicating that the patch was tested in CI. So now we know that > your tests fail without the fix and work with the fix applied, so all is > well. > Thank you for your kind words! And it seems to me that all

Re: Infinite Interval

2023-09-22 Thread jian he
On Fri, Sep 22, 2023 at 3:49 PM Ashutosh Bapat wrote: > > On Thu, Sep 21, 2023 at 7:21 PM Ashutosh Bapat > wrote: > > > Hence I have changed interval_avg_deserialize() in 0007 to use > CurrentMemoryContext instead of aggcontext. Rest of the patches are > same as previous set. > > -- > Best

Re: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-22 Thread Amit Kapila
On Fri, Sep 22, 2023 at 10:57 AM Bharath Rupireddy wrote: > > On Thu, Sep 21, 2023 at 5:45 PM Amit Kapila wrote: > > > > > Thanks for the patch. I have some comments on v42: > > > > Probably trying to keep it similar with > > binary_upgrade_create_empty_extension(). I think it depends what > >

Re: Questions about the new subscription parameter: password_required

2023-09-22 Thread Benoit Lobréau
On 9/21/23 20:29, Robert Haas wrote: Which one? I see 2 ALTER SUBSCRIPTION ... OWNER commands in password_required.log and 1 more in password_required2.log, but they're all performed by the superuser, who is entitled to do anything they want. Thank you for taking the time to respond! I

Re: Row pattern recognition

2023-09-22 Thread Erik Rijkers
Op 9/22/23 om 10:23 schreef Erik Rijkers: Op 9/22/23 om 07:16 schreef Tatsuo Ishii: Attached is the fix against v6 patch. I will include this in upcoming v7 patch. Attached is the v7 patch. It includes the fix mentioned above.  Also (Champion's address bounced; removed) Sorry, I forgot to

Re: Row pattern recognition

2023-09-22 Thread Erik Rijkers
Op 9/22/23 om 07:16 schreef Tatsuo Ishii: Attached is the fix against v6 patch. I will include this in upcoming v7 patch. Attached is the v7 patch. It includes the fix mentioned above. Also (Champion's address bounced; removed) Hi, In my hands, make check fails on the rpr test; see

Re: [PATCH] Add extra statistics to explain for Nested Loop

2023-09-22 Thread Andrey Lepikhov
On 31/7/2022 10:49, Julien Rouhaud wrote: On Sat, Jul 30, 2022 at 08:54:33PM +0800, Julien Rouhaud wrote: Anyway, 1% is in my opinion still too much overhead for extensions that won't get any extra information. I have read all the thread and still can't understand something. What valuable data

Re: Infinite Interval

2023-09-22 Thread Dean Rasheed
On Fri, 22 Sept 2023 at 08:49, Ashutosh Bapat wrote: > > Following code in ExecInterpExpr makes it clear that the > deserialization function is be executed in per tuple memory context. > Whereas the aggregate's context is different from this context and may > lives longer that the context in

Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows

2023-09-22 Thread Kyotaro Horiguchi
At Wed, 20 Sep 2023 14:18:41 +0900 (JST), Kyotaro Horiguchi wrote in > I was able to see the trouble in the CI environment, but not > locally. I'll delve deeper into this. Thanks you for bringing it to my > attention. I found two instances with multiple child processes. # child-pid /

Re: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-22 Thread Amit Kapila
On Fri, Sep 22, 2023 at 11:59 AM Bharath Rupireddy wrote: > > On Thu, Sep 21, 2023 at 6:54 PM Hayato Kuroda (Fujitsu) > wrote: > > > > 1. > +/* > + * Use max_slot_wal_keep_size as -1 to prevent the WAL removal by the > + * checkpointer process. If WALs required by logical

Re: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-22 Thread Amit Kapila
On Fri, Sep 22, 2023 at 10:57 AM Bharath Rupireddy wrote: > > On Thu, Sep 21, 2023 at 5:45 PM Amit Kapila wrote: > > > 3. > > > +/* Quick exit if the given lsn is larger than current one */ > > > +if (start_lsn >= GetFlushRecPtr(NULL)) > > > +PG_RETURN_BOOL(false); > > > + > > >

Re: [PoC] pg_upgrade: allow to upgrade publisher node

2023-09-22 Thread Bharath Rupireddy
On Thu, Sep 21, 2023 at 6:54 PM Hayato Kuroda (Fujitsu) wrote: > > > 6. > > +if (PQntuples(res) != 1) > > +pg_fatal("could not count the number of logical replication > > slots"); > > + > > > > Not existing a single logical replication slot an error? I think it > > must be if

Re: New WAL record to detect the checkpoint redo location

2023-09-22 Thread Amit Kapila
On Thu, Sep 21, 2023 at 9:06 PM Robert Haas wrote: > > On Thu, Sep 21, 2023 at 4:22 AM Amit Kapila wrote: > > After the 0003 patch, do we need acquire exclusive lock via > > WALInsertLockAcquireExclusive() for non-shutdown checkpoints. Even the > > comment "We must block concurrent insertions

Re: Remove MSVC scripts from the tree

2023-09-22 Thread Peter Eisentraut
On 22.09.23 03:12, Michael Paquier wrote: It has been mentioned a few times now that, as Meson has been integrated in the tree, the next step would be to get rid of the custom scripts in src/tools/msvc/ and moving forward only support Meson when building with VS compilers. First we need to fix

Re: information_schema and not-null constraints

2023-09-22 Thread Peter Eisentraut
On 19.09.23 09:01, Peter Eisentraut wrote: While testing this, I noticed that the way the check_clause of regular check constraints is computed appears to be suboptimal.  It currently does CAST(substring(pg_get_constraintdef(con.oid) from 7) AS character_data) which ends up with an extra set