Re: [BUG] Logical replication failure "ERROR: could not map filenode "base/13237/442428" to relation OID" with catalog modifying txns

2022-07-24 Thread Masahiko Sawada
On Mon, Jul 25, 2022 at 10:45 AM Masahiko Sawada wrote: > > On Sat, Jul 23, 2022 at 8:32 PM Amit Kapila wrote: > > > > On Fri, Jul 22, 2022 at 11:48 AM Masahiko Sawada > > wrote: > > > > > > On Wed, Jul 20, 2022 at 5:50 PM Amit Kapila > > > wrote: > > > > > > > > On Wed, Jul 20, 2022 at 1:28

Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.

2022-07-24 Thread Amit Kapila
On Mon, Jul 25, 2022 at 8:34 AM Peter Smith wrote: > > On Mon, Jul 25, 2022 at 11:08 AM Michael Paquier wrote: > > > > On Sun, Jul 24, 2022 at 09:52:16PM +0530, vignesh C wrote: > > > Thanks for the comments, i have modified it by changing it to a > > > boolean parameter. The attached v4 patch

Re: predefined role(s) for VACUUM and ANALYZE

2022-07-24 Thread Nathan Bossart
On Fri, Jul 22, 2022 at 01:37:35PM -0700, Nathan Bossart wrote: > The attached patch adds a pg_vacuum_analyze role that allows VACUUM and > ANALYZE commands on all relations. I started by trying to introduce > separate pg_vacuum and pg_analyze roles, but that quickly became > complicated because

Re: A proposal for shared memory based backup infrastructure

2022-07-24 Thread mahendrakar s
Hi Bharath, *"Typically, step (3) takes a good amount of time in productionenvironments with terabytes or petabytes scale of data and keeping thesession alive from step (1) to (4) has overhead and it wastes theresources. And the session can get closed for various reasons - idlein session

Re: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS

2022-07-24 Thread Nathan Bossart
On Sun, Jul 24, 2022 at 11:49:23PM -0400, Tom Lane wrote: > Nathan Bossart writes: >> I noticed that a couple of places check whether whereToSendOutput is set to >> DestRemote to determine if this is an interactive session. > > IIRC, that would end in not loading the preload libraries in a

Re: optimize lookups in snapshot [sub]xip arrays

2022-07-24 Thread Zhang Mingli
Got it, thanks. Regards, Zhang Mingli > On Jul 25, 2022, at 12:08, Nathan Bossart wrote: > > On Sun, Jul 24, 2022 at 12:48:25PM +0800, Zhang Mingli wrote: >> If snaphost->suboverflowed is false then the subxcnt must be less than >> PGPROC_MAX_CACHED_SUBXIDS which is 64 now. >> >> And we

Re: Handle infinite recursion in logical replication setup

2022-07-24 Thread Amit Kapila
On Sun, Jul 24, 2022 at 10:21 PM Jonathan S. Katz wrote: > > On 7/22/22 12:47 AM, Amit Kapila wrote: > > On Fri, Jul 22, 2022 at 1:39 AM Jonathan S. Katz > > wrote: > > >> 1. I'm concerned by calling this "Bidirectional replication" in the docs > >> that we are overstating the current

COPY FROM FORMAT CSV FORCE_NULL(*) ?

2022-07-24 Thread jian he
Hi, there. copy force null git commit didn't attach a discussion link. So I don't know if it's already been discussed. Current seem you cannot do COPY forcetest FROM STDIN WITH (FORMAT

Re: optimize lookups in snapshot [sub]xip arrays

2022-07-24 Thread Nathan Bossart
On Sun, Jul 24, 2022 at 12:48:25PM +0800, Zhang Mingli wrote: > If snaphost->suboverflowed is false then the subxcnt must be less than > PGPROC_MAX_CACHED_SUBXIDS which is 64 now. > > And we won’t use hash if the xcnt is less than XIP_HASH_MIN_ELEMENTS which is > 128 currently during

Re: ReadRecentBuffer() is broken for local buffer

2022-07-24 Thread Richard Guo
On Mon, Jul 25, 2022 at 2:22 AM Heikki Linnakangas wrote: > if (BufferIsLocal(recent_buffer)) > { > - bufHdr = GetBufferDescriptor(-recent_buffer - 1); > + bufHdr = GetLocalBufferDescriptor(-recent_buffer - 1); Aha, we're using the wrong buffer

Re: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS

2022-07-24 Thread Tom Lane
Nathan Bossart writes: > I noticed that a couple of places check whether whereToSendOutput is set to > DestRemote to determine if this is an interactive session. IIRC, that would end in not loading the preload libraries in a standalone backend. Perhaps that's what we want, but I'd supposed not.

Re: Unprivileged user can induce crash by using an SUSET param in PGOPTIONS

2022-07-24 Thread Nathan Bossart
On Sat, Jul 23, 2022 at 01:23:24PM -0400, Tom Lane wrote: > - /* > - * process any libraries that should be preloaded at backend start (this > - * likewise can't be done until GUC settings are complete) > - */ > - process_session_preload_libraries(); This patch essentially

Re: Collect ObjectAddress for ATTACH DETACH PARTITION to use in event trigger

2022-07-24 Thread Amit Kapila
On Sat, Jul 23, 2022 at 4:28 PM Michael Paquier wrote: > > On Sat, Jul 23, 2022 at 05:44:28PM +0900, Michael Paquier wrote: > > Changing get_altertable_subcmdtypes() to return a set of rows made of > > (subcommand, object description) is what I actually meant upthread as > > it feels natural

Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.

2022-07-24 Thread Peter Smith
On Mon, Jul 25, 2022 at 11:08 AM Michael Paquier wrote: > > On Sun, Jul 24, 2022 at 09:52:16PM +0530, vignesh C wrote: > > Thanks for the comments, i have modified it by changing it to a > > boolean parameter. The attached v4 patch has the changes for the same. > > Okay, thanks for the patch.

Re: Proposal to provide the facility to set binary format output for specific OID's per session

2022-07-24 Thread Kyotaro Horiguchi
At Fri, 22 Jul 2022 11:00:18 -0400, Dave Cramer wrote in > As a proof of concept I provide the attached patch which implements the > ability to specify which oids will be returned in binary format per > session. ... > Both the JDBC driver and the go driver can exploit this change with no >

Re: Using each rel as both outer and inner for JOIN_ANTI

2022-07-24 Thread Richard Guo
On Fri, Jul 2, 2021 at 11:23 AM Richard Guo wrote: > Thanks! Test cases are updated in v3 patch. Also merge join can do the > 'right anti join' too in the same patch. > > Thanks again for reviewing this patch. > Rebased this patch with latest master, with no other changes. Thanks Richard

Re: ReadRecentBuffer() is broken for local buffer

2022-07-24 Thread Zhang Mingli
Nice catch, LGTM. > On Jul 25, 2022, at 02:22, Heikki Linnakangas wrote: > > ReadRecentBuffer() doesn't work for local buffers, i.e. for temp tables. The > bug is pretty clear if you look at the code: > > if (BufferIsLocal(recent_buffer)) > { > - bufHdr =

Re: Remove useless arguments in ReadCheckpointRecord().

2022-07-24 Thread Tom Lane
Fujii Masao writes: > On 2022/07/22 17:31, Kyotaro Horiguchi wrote: >> I believed that it is recommended to move to the style not having the >> outmost parens. That style has been introduced by e3a87b4991. > I read the commit log, but I'm not sure yet if it's really recommended to > remove

Re: Remove useless arguments in ReadCheckpointRecord().

2022-07-24 Thread Fujii Masao
On 2022/07/22 17:31, Kyotaro Horiguchi wrote: I believed that it is recommended to move to the style not having the outmost parens. That style has been introduced by e3a87b4991. I read the commit log, but I'm not sure yet if it's really recommended to remove extra parens even from the

Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.

2022-07-24 Thread Michael Paquier
On Sun, Jul 24, 2022 at 09:52:16PM +0530, vignesh C wrote: > Thanks for the comments, i have modified it by changing it to a > boolean parameter. The attached v4 patch has the changes for the same. Okay, thanks for the patch. This looks good to me, so let's do as Amit suggests. I'll apply that

Re: Custom tuplesorts for extensions

2022-07-24 Thread Justin Pryzby
Note that 0001+0002 (without the others) incurs warnings: $ time { make -j4 clean; make -j4; } >/dev/null tuplesort.c:1883:9: warning: unused variable 'i' [-Wunused-variable] tuplesort.c:1955:10: warning: unused variable 'i' [-Wunused-variable] tuplesort.c:2026:9: warning: unused variable 'i'

Re: Proposal: allow database-specific role memberships

2022-07-24 Thread Kenaniah Cerny
Hi Antonin, Thank you again for the detailed review and questions. It was encouraging to see the increasing level of nuance in this latest round. It's not clear from the explanation of the GRANT ... IN DATABASE ... / GRANT > ... IN CURRENT DATABASE ... that, even if "membership in ... will be

Re: 012_subtransactions.pl vs clang -fsanitize=undefined

2022-07-24 Thread Thomas Munro
On Mon, Jul 25, 2022 at 10:18 AM Tom Lane wrote: > I wrote: > > I think what's happening is just that this build configuration > > eats stack extravagantly. > > That's definitely it, but I don't entirely see why. Here are a > couple of major offenders though: Interesting. I wonder where we can

Re: 012_subtransactions.pl vs clang -fsanitize=undefined

2022-07-24 Thread Tom Lane
I wrote: > I think what's happening is just that this build configuration > eats stack extravagantly. That's definitely it, but I don't entirely see why. Here are a couple of major offenders though: (gdb) x/8i ExecInterpExpr 0x11a5530 : push %rbp 0x11a5531 :mov%rsp,%rbp

Re: 012_subtransactions.pl vs clang -fsanitize=undefined

2022-07-24 Thread Tom Lane
Thomas Munro writes: > On Mon, Jul 25, 2022 at 8:59 AM Justin Pryzby wrote: >> I found that -fsanitize causes the test to fail, going back to REL_10_STABLE, >> for any clang in: > Yeah I've seen this too... it'd be good to figure out how to fix it: >

Re: ReadRecentBuffer() is broken for local buffer

2022-07-24 Thread Thomas Munro
On Mon, Jul 25, 2022 at 6:22 AM Heikki Linnakangas wrote: > ReadRecentBuffer() doesn't work for local buffers, i.e. for temp tables. > The bug is pretty clear if you look at the code: -bufHdr = GetBufferDescriptor(-recent_buffer - 1); +intb = -recent_buffer - 1; + +

Re: 012_subtransactions.pl vs clang -fsanitize=undefined

2022-07-24 Thread Thomas Munro
On Mon, Jul 25, 2022 at 8:59 AM Justin Pryzby wrote: > I found that -fsanitize causes the test to fail, going back to REL_10_STABLE, > for any clang in: > > 1:11.1.0-6 > 1:12.0.1-19ubuntu3 > 1:13.0.1-2ubuntu2 > 1:14.0.0-1ubuntu1 > > | time ./configure --enable-cassert --enable-debug

012_subtransactions.pl vs clang -fsanitize=undefined

2022-07-24 Thread Justin Pryzby
I found that -fsanitize causes the test to fail, going back to REL_10_STABLE, for any clang in: 1:11.1.0-6 1:12.0.1-19ubuntu3 1:13.0.1-2ubuntu2 1:14.0.0-1ubuntu1 | time ./configure --enable-cassert --enable-debug --enable-tap-tests --with-CC=clang-13 CFLAGS='-fsanitize=undefined' | time { make

Re: psql - factor out echo code

2022-07-24 Thread Pavel Stehule
Hi ne 24. 7. 2022 v 21:39 odesílatel Fabien COELHO napsal: > > >> Attached v4 simplifies the format and fixes this one. > > > > I think this goes way way overboard in terms of invasiveness. There's no > > need to identify individual call sites of PSQLexec. [...] > > ISTM that having the

Re: [PATCH] Introduce array_shuffle() and array_sample()

2022-07-24 Thread Fabien COELHO
Hello, Thank you for your feedback. I attached a patch, that addresses most of your points. I'll look into it. It would help if the patch could include a version number at the end. Should the exchange be skipped when i == k? The additional branch is actually slower (on my machine,

Re: [PATCH] Introduce array_shuffle() and array_sample()

2022-07-24 Thread Martin Kalcher
Am 24.07.22 um 10:15 schrieb Fabien COELHO: My 0,02€ about this patch: Thank you for your feedback. I attached a patch, that addresses most of your points. Use (void) when declaring no parameters in headers or in functions. Done. Should the exchange be skipped when i == k? The

Re: fairywren hung in pg_basebackup tests

2022-07-24 Thread Noah Misch
On Sun, Jul 24, 2022 at 12:55:56PM -0400, Tom Lane wrote: > Andrew Dunstan writes: > > fairywren (msys2 animal) is currently hung in the pg_basebackup tests. > > Here's the bottom of the regress log. I don't have further info as yet, > > but can dig is someone has a suggestion. > > Hm, what's

Re: Schema variables - new implementation for Postgres 15

2022-07-24 Thread Justin Pryzby
Hi Erik, On Sun, Jul 24, 2022 at 03:39:32PM +0200, Erik Rijkers wrote: > Attached a few small text-changes. When you send patches like this, could you rename them to something other than *.patch and *.diff ? Otherwise, cfbot tries to apply *only* your patches to master, which fails due to

ReadRecentBuffer() is broken for local buffer

2022-07-24 Thread Heikki Linnakangas
ReadRecentBuffer() doesn't work for local buffers, i.e. for temp tables. The bug is pretty clear if you look at the code: if (BufferIsLocal(recent_buffer)) { - bufHdr = GetBufferDescriptor(-recent_buffer - 1); + bufHdr =

Re: fairywren hung in pg_basebackup tests

2022-07-24 Thread Tom Lane
Andrew Dunstan writes: > fairywren (msys2 animal) is currently hung in the pg_basebackup tests. > Here's the bottom of the regress log. I don't have further info as yet, > but can dig is someone has a suggestion. Hm, what's with the "Use of uninitialized value" warnings?

Re: Handle infinite recursion in logical replication setup

2022-07-24 Thread Jonathan S. Katz
On 7/22/22 12:47 AM, Amit Kapila wrote: On Fri, Jul 22, 2022 at 1:39 AM Jonathan S. Katz wrote: 1. I'm concerned by calling this "Bidirectional replication" in the docs that we are overstating the current capabilities. I think this is accentuated int he opening paragraph: ==snip==

fairywren hung in pg_basebackup tests

2022-07-24 Thread Andrew Dunstan
fairywren (msys2 animal) is currently hung in the pg_basebackup tests. Here's the bottom of the regress log. I don't have further info as yet, but can dig is someone has a suggestion. ### Starting node "main" # Running: pg_ctl -w -D

Re: Refactor to make use of a common function for GetSubscriptionRelations and GetSubscriptionNotReadyRelations.

2022-07-24 Thread vignesh C
On Fri, Jul 22, 2022 at 11:11 AM Amit Kapila wrote: > > On Fri, Jul 22, 2022 at 3:47 AM Peter Smith wrote: > > > > I was in favour of enum mostly because I thought the bitmask of an > > earlier patch was mis-used; IMO each bit should only be for > > representing something as "on/set". So a bit

Re: Schema variables - new implementation for Postgres 15

2022-07-24 Thread Erik Rijkers
On 7/22/22 10:58, Pavel Stehule wrote: čt 21. 7. 2022 v 9:34 odesílatel Julien Rouhaud > napsal: > [v20220722] patches Hi Pavel, Thanks, docs now build. Attached a few small text-changes. Also, the pg_restore-doc still has the old name 'schema_variable'

Re: optimize lookups in snapshot [sub]xip arrays

2022-07-24 Thread Yura Sokolov
В Ср, 13/07/2022 в 10:09 -0700, Nathan Bossart пишет: > Hi hackers, > > A few years ago, there was a proposal to create hash tables for long > [sub]xip arrays in snapshots [0], but the thread seems to have fizzled out. > I was curious whether this idea still showed measurable benefits, so I >

Re: redacting password in SQL statement in server log

2022-07-24 Thread Julien Rouhaud
Hi, On Sun, Jul 24, 2022 at 04:33:59AM -0700, Zhihong Yu wrote: > I am thinking of adding `if not exists` to `CREATE ROLE` statement: > > CREATE ROLE trustworthy if not exists; > > In my previous example, if the user can issue the above command, there > would be no SQL statement logged. It's not

Re: redacting password in SQL statement in server log

2022-07-24 Thread Zhihong Yu
On Sat, Jul 23, 2022 at 5:27 PM Tom Lane wrote: > Zhihong Yu writes: > > Currently, in situation such as duplicate role creation, the server log > > would show something such as the following: > > > 2022-07-22 13:48:18.251 UTC [330] STATEMENT: CREATE ROLE test WITH LOGIN > > PASSWORD 'foobar';

Re: Schema variables - new implementation for Postgres 15

2022-07-24 Thread Julien Rouhaud
Hi, On Fri, Jul 22, 2022 at 10:58:25AM +0200, Pavel Stehule wrote: > > Apparently most of the changes in catalogs.sgml didn't survive the last > > rebase. > > I do see the needed section in v20220709-0012-documentation.patch: > > > > > + > > > + pg_variable > > > [...] > > > > should be fixed

Re: pg_stat_statements and "IN" conditions

2022-07-24 Thread Dmitry Dolgov
> On Sat, Mar 26, 2022 at 06:40:35PM +0100, Dmitry Dolgov wrote: > > On Mon, Mar 14, 2022 at 04:51:50PM +0100, Dmitry Dolgov wrote: > > > On Mon, Mar 14, 2022 at 11:38:23AM -0400, Tom Lane wrote: > > > Dmitry Dolgov <9erthali...@gmail.com> writes: > > > > On Mon, Mar 14, 2022 at 11:23:17AM -0400,

Re: [PATCH] Introduce array_shuffle() and array_sample()

2022-07-24 Thread Fabien COELHO
i came to the same conclusions and went with Option 1 (see patch). Mainly because most code in utils/adt is organized by type and this way it is clear, that this is a thin wrapper around pg_prng. Small patch update. I realized the new functions should live array_userfuncs.c (rather than