Re: Schema variables - new implementation for Postgres 15

2022-07-21 Thread Erik Rijkers
On 7/21/22 08:16, Pavel Stehule wrote: Hi new update of session variable;s implementation - fresh rebase - new possibility to trace execution with DEBUG1 notification - new SRF function pg_debug_show_used_session_variables that returns content of sessionvars hashtab - redesign of work with lis

Re: Improve description of XLOG_RUNNING_XACTS

2022-07-21 Thread Kyotaro Horiguchi
At Thu, 21 Jul 2022 11:21:09 +0900, Fujii Masao wrote in > > > On 2022/07/21 10:13, Masahiko Sawada wrote: > > Hi, > > I realized that standby_desc_running_xacts() in standbydesc.c doesn't > > describe subtransaction XIDs. I've attached the patch to improve the > > description. > > +1 > > Th

Re: Schema variables - new implementation for Postgres 15

2022-07-21 Thread Julien Rouhaud
Hi, On Thu, Jul 21, 2022 at 09:09:47AM +0200, Erik Rijkers wrote: > On 7/21/22 08:16, Pavel Stehule wrote: > > Hi > > > > new update of session variable;s implementation > > > > - fresh rebase > > - new possibility to trace execution with DEBUG1 notification > > - new SRF function pg_debug_show_

Re: Pulling up direct-correlated ANY_SUBLINK

2022-07-21 Thread Richard Guo
On Tue, Sep 10, 2019 at 9:49 PM Tom Lane wrote: > > Can we try to pull up direct-correlated ANY SubLink with the help of > > LATERAL? > > Perhaps. But what's the argument that you'd end up with a better > plan? LATERAL pretty much constrains things to use a nestloop, > so I'm not sure there's a

Re: Improve description of XLOG_RUNNING_XACTS

2022-07-21 Thread Masahiko Sawada
On Thu, Jul 21, 2022 at 4:29 PM Kyotaro Horiguchi wrote: > > At Thu, 21 Jul 2022 11:21:09 +0900, Fujii Masao > wrote in > > > > > > On 2022/07/21 10:13, Masahiko Sawada wrote: > > > Hi, > > > I realized that standby_desc_running_xacts() in standbydesc.c doesn't > > > describe subtransaction XIDs

Re: Remove fls(), use pg_bitutils.h facilities instead?

2022-07-21 Thread Thomas Munro
On Thu, Jul 21, 2022 at 1:34 AM Tom Lane wrote: > How is it sane to ask for a segment bin for zero pages? Seems like > something should have short-circuited such a case well before here. It's intended. There are two ways you can arrive here with n == 0: * There's a special case in execParallel

[PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Junwang Zhao
There are some duplicate code in table.c, add a static inline function to eliminate the duplicates. -- Regards Junwang Zhao 0001-eliminate-duplicate-code-in-table.c.patch Description: Binary data

Re: Improve description of XLOG_RUNNING_XACTS

2022-07-21 Thread Kyotaro Horiguchi
At Thu, 21 Jul 2022 16:58:45 +0900, Masahiko Sawada wrote in > > > The patch looks good to me. By the way +1 to this. > > The subxids can reach TOTAL_MAX_CACHED_SUBXIDS = > > PGPROC_MAX_CACHED_SUBXIDS(=64) * PROCARRAY_MAXPROCS. xact_desc_commit > > also shows subtransactions but they are at ma

Re: Handle infinite recursion in logical replication setup

2022-07-21 Thread Amit Kapila
On Wed, Jul 20, 2022 at 2:33 PM vignesh C wrote: > > Modified. Apart from this I have run pgperltidy on the perl file and > renamed 032_origin.pl to 030_origin.pl as currently there is > 029_on_error.pl, 031_column_list.pl and there is no 030_*.pl file. > Thanks for the comment, the attached p

add a missing space

2022-07-21 Thread Junwang Zhao
This is a minor fix that adds a missing space in file lockdefs.h -- Regards Junwang Zhao 0001-add-a-missing-space.patch Description: Binary data

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

2022-07-21 Thread Dean Rasheed
On Tue, 19 Jul 2022 at 21:21, Martin Kalcher wrote: > > Here is a patch with dimension aware array_shuffle() and array_sample(). > +1 for this feature, and this way of handling multi-dimensional arrays. > If you think array_flatten() is desirable, i can take a look at it. That's not something I

Re: i.e. and e.g.

2022-07-21 Thread Kyotaro Horiguchi
At Thu, 21 Jul 2022 12:30:04 +0700, John Naylor wrote in > On Thu, Jul 21, 2022 at 11:22 AM Kyotaro Horiguchi > wrote: > > > > At Thu, 21 Jul 2022 10:20:30 +0700, John Naylor < > john.nay...@enterprisedb.com> wrote in > > > need to change back branches. It does make sense for v15, though, and I

Re: make -C libpq check fails obscurely if tap tests are disabled

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-20, Andrew Dunstan wrote: > On 2022-07-20 We 13:23, Justin Pryzby wrote: > > PATH=... && @echo "TAP tests not enabled. Try configuring with > > --enable-tap-tests" > > /bin/sh: 1: @echo: not found > > > > make is telling the shell to run "@echo" , rather than running "echo" > > silen

Re: Is it correct to say, "invalid data in file \"%s\"", BACKUP_LABEL_FILE in do_pg_backup_stop?

2022-07-21 Thread Kyotaro Horiguchi
At Wed, 20 Jul 2022 17:09:09 +0530, Bharath Rupireddy wrote in > Hi, > > After the commit [1], is it correct to say errmsg("invalid data in file > \"%s\"", BACKUP_LABEL_FILE))); in do_pg_backup_stop() when we hold the > contents in backend global memory, not actually reading from backup_label >

RE: Data is copied twice when specifying both child and parent table in publication

2022-07-21 Thread wangw.f...@fujitsu.com
On Thur, Jul 14, 2022 at 12:46 PM Peter Smith wrote: > Here are some review comments for the v6 patch (HEAD only): Thanks for your comments. > 1. Commit message > > If there are two publications that publish the parent table and the child > table > separately, and both specify the option PUBLI

Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher

2022-07-21 Thread Amit Kapila
On Wed, Jul 20, 2022 at 8:19 PM Önder Kalacı wrote: > >> >> > - Add a new class of invalidation callbacks: Today, if we do ALTER TABLE >> > or CREATE INDEX on a table, the CacheRegisterRelcacheCallback helps us to >> > re-create the cache entries. In this case, as far as I can see, we need a >>

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

2022-07-21 Thread Amit Kapila
On Thu, Jul 21, 2022 at 10:03 AM Michael Paquier wrote: > > On Thu, Jul 21, 2022 at 09:54:05AM +0530, Amit Kapila wrote: > > Yeah, it is not very clear to me either. I think this won't be > > difficult to change one or another way depending on future needs. At > > this stage, it appeared to me tha

Re: add a missing space

2022-07-21 Thread Amit Kapila
On Thu, Jul 21, 2022 at 2:08 PM Junwang Zhao wrote: > > This is a minor fix that adds a missing space in file lockdefs.h > LGTM. I'll push this in some time. -- With Regards, Amit Kapila.

Re: add a missing space

2022-07-21 Thread Junwang Zhao
Great, thanks! On Thu, Jul 21, 2022 at 6:13 PM Amit Kapila wrote: > > On Thu, Jul 21, 2022 at 2:08 PM Junwang Zhao wrote: > > > > This is a minor fix that adds a missing space in file lockdefs.h > > > > LGTM. I'll push this in some time. > > -- > With Regards, > Amit Kapila. -- Regards Junwa

Re: Handle infinite recursion in logical replication setup

2022-07-21 Thread vignesh C
On Thu, Jul 21, 2022 at 2:06 PM Amit Kapila wrote: > > On Wed, Jul 20, 2022 at 2:33 PM vignesh C wrote: > > > > Modified. Apart from this I have run pgperltidy on the perl file and > > renamed 032_origin.pl to 030_origin.pl as currently there is > > 029_on_error.pl, 031_column_list.pl and there i

Re: standby recovery fails (tablespace related) (tentative patch and discussion)

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-20, Alvaro Herrera wrote: > I see the following alternatives: > > 1. not backpatch this fix to 14 and older > 2. use a different GUC; either allow_invalid_pages as previously >suggested, or create a new one just for this purpose > 3. not provide any overriding mechanism in version

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Amit Kapila
On Thu, Jul 21, 2022 at 1:56 PM Junwang Zhao wrote: > > There are some duplicate code in table.c, add a static inline function > to eliminate the duplicates. > Can we name function as validate_object_type, or check_object_type? Otherwise, the patch looks fine to me. Let's see if others have some

Re: standby recovery fails (tablespace related) (tentative patch and discussion)

2022-07-21 Thread Thomas Munro
On Wed, Jul 20, 2022 at 10:51 PM Alvaro Herrera wrote: > v26 here. I spent some time fighting the readdir() stuff for > Windows (so that get_dirent_type returns LNK for junction points) > but couldn't make it to work and was unable to figure out why. Was it because of this? https://www.postgres

Re: standby recovery fails (tablespace related) (tentative patch and discussion)

2022-07-21 Thread Thomas Munro
On Thu, Jul 21, 2022 at 11:01 PM Alvaro Herrera wrote: > On 2022-Jul-20, Alvaro Herrera wrote: > > I see the following alternatives: > > > > 1. not backpatch this fix to 14 and older > > 2. use a different GUC; either allow_invalid_pages as previously > >suggested, or create a new one just for

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

2022-07-21 Thread Martin Kalcher
Am 21.07.22 um 10:41 schrieb Dean Rasheed: A couple of quick comments on the current patch: Thank you for your feedback! It's important to mark these new functions as VOLATILE, not IMMUTABLE, otherwise they won't work as expected in queries. See https://www.postgresql.org/docs/current/xfunc-

Re: standby recovery fails (tablespace related) (tentative patch and discussion)

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-21, Thomas Munro wrote: > On Wed, Jul 20, 2022 at 10:51 PM Alvaro Herrera > wrote: > > v26 here. I spent some time fighting the readdir() stuff for > > Windows (so that get_dirent_type returns LNK for junction points) > > but couldn't make it to work and was unable to figure out why

Re: standby recovery fails (tablespace related) (tentative patch and discussion)

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-21, Thomas Munro wrote: > On Thu, Jul 21, 2022 at 11:01 PM Alvaro Herrera > wrote: > > I've got no opinions on this. I don't like either 1 or 3, so I'm going > > to add and backpatch a new GUC allow_recovery_tablespaces as the > > override mechanism. > > > > If others disagree with

Re: standby recovery fails (tablespace related) (tentative patch and discussion)

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-21, Alvaro Herrera wrote: > Yeah, I think that would reduce cruft. I'm not sure this is more > against backpatching policy or less, compared to adding a separate > GUC just for this bugfix. cruft: { {"allow_recovery_tablespaces", PG_POSTMASTER, WAL_RECOVERY,

Re: [PoC] Reducing planning time when tables have many partitions

2022-07-21 Thread Andrey Lepikhov
On 7/5/22 13:57, Yuya Watari wrote: On Mon, Jul 4, 2022 at 6:28 AM Tom Lane wrote: Perhaps the bms_is_subset class could be handled in a similar way, ie do a one-time pass to make a List of all EquivalenceMembers that use a RelOptInfo. Thank you for giving your idea. I will try to polish up m

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Aleksander Alekseev
Hi hackers, > > There are some duplicate code in table.c, add a static inline function > > to eliminate the duplicates. > > > > Can we name function as validate_object_type, or check_object_type? > > Otherwise, the patch looks fine to me. Let's see if others have > something to say. LGTM -- Bes

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Amit Kapila
On Thu, Jul 21, 2022 at 5:09 PM Aleksander Alekseev wrote: > > > > There are some duplicate code in table.c, add a static inline function > > > to eliminate the duplicates. > > > > > > > Can we name function as validate_object_type, or check_object_type? > > > > Otherwise, the patch looks fine to

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Aleksander Alekseev
Hi Amit, > I don't think this change should be part of this patch. Do you see a > reason for doing this? My bad. I thought this was done by pgindent. -- Best regards, Aleksander Alekseev v3-0001-Eliminate-duplicate-code-in-table.c.patch Description: Binary data

Re: [RFC] building postgres with meson - v10

2022-07-21 Thread Bilal Yavuz
Hi, On 2022-07-18 23:23:27 +0300, Andres Freund wrote: > Bilal, Peter previously commented on the pg_regress change for ecpg, > perhaps > you can comment on that? > > In > https://postgr.es/m/0e81e45c-c9a5-e95b-2782-ab2dfec8bf57%40enterprisedb.com > On 2022-07-06 11:03:31 +0200, Peter Eisentraut

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-21, Junwang Zhao wrote: > There are some duplicate code in table.c, add a static inline function > to eliminate the duplicates. Hmm, but see commit 2ed532ee8c47 about this kind of check. Perhaps we should change these error messages to conform to the same message style. -- Álvaro H

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

2022-07-21 Thread Dean Rasheed
On Thu, 21 Jul 2022 at 12:15, Martin Kalcher wrote: > > I agree that we should use pg_prng_uint64_range(). However, in order to > achieve interoperability with setseed() we would have to use > drandom_seed (rather than pg_global_prng_state) as rng state, which is > declared statically in float.c a

Re: [RFC] building postgres with meson - v10

2022-07-21 Thread Bilal Yavuz
Hi, Sorry for the first email. On Mon, 18 Jul 2022 at 23:23, Andres Freund wrote: > > In https://postgr.es/m/0e81e45c-c9a5-e95b-2782-ab2dfec8bf57%40enterprisedb.com > On 2022-07-06 11:03:31 +0200, Peter Eisentraut wrote: > > dff7b5a960 meson: prereq: regress: allow to specify director containing

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Aleksander Alekseev
Hi Alvaro, > Hmm, but see commit 2ed532ee8c47 about this kind of check. Perhaps we > should change these error messages to conform to the same message style. Good point! Done. -- Best regards, Aleksander Alekseev v4-0001-Eliminate-duplicate-code-in-table.c.patch Description: Binary data

Re: MultiXact\SLRU buffers configuration

2022-07-21 Thread Yura Sokolov
Good day, all. I did benchmark of patch on 2 socket Xeon 5220 CPU @ 2.20GHz . I used "benchmark" used to reproduce problems with SLRU on our customers setup. In opposite to Shawn's tests I concentrated on bad case: a lot of contention. slru-funcs.sql - function definitions - functions creates a

Re: Improve description of XLOG_RUNNING_XACTS

2022-07-21 Thread Ashutosh Bapat
Hi On Thu, Jul 21, 2022 at 6:44 AM Masahiko Sawada wrote: > > Hi, > > I realized that standby_desc_running_xacts() in standbydesc.c doesn't > describe subtransaction XIDs. I've attached the patch to improve the > description. Here is an example by pg_wlaldump: > > * HEAD > rmgr: Standby len (

Re: SLRUs in the main buffer pool, redux

2022-07-21 Thread Yura Sokolov
Good day, Thomas В Пт, 27/05/2022 в 23:24 +1200, Thomas Munro пишет: > Rebased, debugged and fleshed out a tiny bit more, but still with > plenty of TODO notes and questions. I will talk about this idea at > PGCon, so I figured it'd help to have a patch that actually applies, > even if it doesn't

Re: Remove fls(), use pg_bitutils.h facilities instead?

2022-07-21 Thread Tom Lane
Thomas Munro writes: > On Thu, Jul 21, 2022 at 1:34 AM Tom Lane wrote: >> How is it sane to ask for a segment bin for zero pages? Seems like >> something should have short-circuited such a case well before here. > It's intended. There are two ways you can arrive here with n == 0: OK. >> We c

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Amit Kapila
On Thu, Jul 21, 2022 at 6:12 PM Aleksander Alekseev wrote: > > Hi Alvaro, > > > Hmm, but see commit 2ed532ee8c47 about this kind of check. Perhaps we > > should change these error messages to conform to the same message style. > > Good point! Done. > Yeah, that's better. On again thinking about

Re: System catalog documentation chapter

2022-07-21 Thread Bruce Momjian
On Wed, Jul 20, 2022 at 09:19:17PM -0400, Bruce Momjian wrote: > On Wed, Jul 20, 2022 at 04:32:46PM -0400, Bruce Momjian wrote: > > On Wed, Jul 20, 2022 at 04:23:21PM -0400, Isaac Morland wrote: > > > Will there be a comprehensive list somewhere? Even if it just lists the > > > views, > > > gives

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Aleksander Alekseev
Hi Amit, > Yeah, that's better. On again thinking about the function name, I > wonder if validate_relation_type() suits here as there is no generic > object being passed? Yep, validate_relation_type() sounds better. -- Best regards, Aleksander Alekseev v5-0001-Eliminate-duplicate-code-in-tabl

Re: Make name optional in CREATE STATISTICS

2022-07-21 Thread Dean Rasheed
On Wed, 20 Jul 2022 at 12:01, Matthias van de Meent wrote: > > On Wed, 13 Jul 2022 at 08:07, Simon Riggs > wrote: > > > > > + *CREATE STATISTICS [ [IF NOT EXISTS] stats_name ] > > I think this is ready for a committer, so I've marked it as such. > Picking this up... I tend to a

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Aleksander Alekseev
Hi Amit, > Yep, validate_relation_type() sounds better. Or maybe validate_relation_kind() after all? -- Best regards, Aleksander Alekseev

postgres_fdw: Fix bug in checking of return value of PQsendQuery().

2022-07-21 Thread Fujii Masao
Hi, I found that fetch_more_data_begin() in postgres_fdw reports an error when PQsendQuery() returns the value less than 0 as follows though PQsendQuery() can return only 1 or 0. I think this is a bug. Attached is the patch that fixes this bug. This needs to be back-ported to v14 where async

Re: Custom tuplesorts for extensions

2022-07-21 Thread Alexander Korotkov
Hi, John! On Thu, Jul 21, 2022 at 6:44 AM John Naylor wrote: > On Tue, Jul 12, 2022 at 3:23 PM Alexander Korotkov > wrote: > > There are some places, which potentially could cause a slowdown. I'm > > going to make some experiments with that. > > I haven't looked at the patches, so I don't know

Re: postgres_fdw: Fix bug in checking of return value of PQsendQuery().

2022-07-21 Thread Japin Li
On Thu, 21 Jul 2022 at 22:22, Fujii Masao wrote: > Hi, > > I found that fetch_more_data_begin() in postgres_fdw reports an error when > PQsendQuery() returns the value less than 0 as follows though PQsendQuery() > can return only 1 or 0. I think this is a bug. Attached is the patch that > fi

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-21 Thread Amit Langote
On Wed, Jul 20, 2022 at 11:09 PM Amit Langote wrote: > On Wed, Jul 20, 2022 at 12:37 AM Andres Freund wrote: > > On 2022-07-19 20:40:11 +0900, Amit Langote wrote: > > > About that, I was wondering if the blocks in llvm_compile_expr() need > > > to be hand-coded to match what's added in ExecInterp

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Junwang Zhao
yeah, IMHO validate_relation_kind() is better ;) On Thu, Jul 21, 2022 at 10:21 PM Aleksander Alekseev wrote: > > Hi Amit, > > > Yep, validate_relation_type() sounds better. > > Or maybe validate_relation_kind() after all? > > -- > Best regards, > Aleksander Alekseev -- Regards Junwang Zhao

Re: shared-memory based stats collector - v70

2022-07-21 Thread Greg Stark
On Wed, 20 Jul 2022 at 15:09, Andres Freund wrote: > > Each backend only had stats for things it touched. But the stats collector > read all files at startup into hash tables and absorbed all generated stats > into those as well. Fascinating. I'm surprised this didn't raise issues previously fo

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Junwang Zhao
btw, there are some typos in Patch v5, %s/ralation/relation/g On Thu, Jul 21, 2022 at 10:05 PM Aleksander Alekseev wrote: > > Hi Amit, > > > Yeah, that's better. On again thinking about the function name, I > > wonder if validate_relation_type() suits here as there is no generic > > object being

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-21 Thread Amit Langote
On Thu, Jul 21, 2022 at 11:55 PM Amit Langote wrote: > On Wed, Jul 20, 2022 at 11:09 PM Amit Langote wrote: > > On Wed, Jul 20, 2022 at 12:37 AM Andres Freund wrote: > > > On 2022-07-19 20:40:11 +0900, Amit Langote wrote: > > > > About that, I was wondering if the blocks in llvm_compile_expr() n

Re: postgres_fdw: Fix bug in checking of return value of PQsendQuery().

2022-07-21 Thread Tom Lane
Fujii Masao writes: > I found that fetch_more_data_begin() in postgres_fdw reports an error when > PQsendQuery() returns the value less than 0 as follows though PQsendQuery() > can return only 1 or 0. I think this is a bug. Attached is the patch that > fixes this bug. This needs to be back-por

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

2022-07-21 Thread Martin Kalcher
Am 21.07.22 um 14:25 schrieb Dean Rasheed: I'm inclined to say that we want a new pg_global_prng_user_state that is updated by setseed(), and used by random(), array_shuffle(), array_sample(), and any other user-facing random functions we add later. I like the idea. How would you organize the

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Aleksander Alekseev
Hi Junwang, > btw, there are some typos in Patch v5, %s/ralation/relation/g D'oh! > yeah, IMHO validate_relation_kind() is better ;) Cool. Here is the corrected patch. Thanks! -- Best regards, Aleksander Alekseev v6-0001-Eliminate-duplicate-code-in-table.c.patch Description: Binary data

Re: [PATCH v1] eliminate duplicate code in table.c

2022-07-21 Thread Junwang Zhao
LGTM On Thu, Jul 21, 2022 at 11:52 PM Aleksander Alekseev wrote: > > Hi Junwang, > > > btw, there are some typos in Patch v5, %s/ralation/relation/g > > D'oh! > > > yeah, IMHO validate_relation_kind() is better ;) > > Cool. Here is the corrected patch. Thanks! > > -- > Best regards, > Aleksander

Re: Make name optional in CREATE STATISTICS

2022-07-21 Thread Simon Riggs
On Thu, 21 Jul 2022 at 15:12, Dean Rasheed wrote: > > On Wed, 20 Jul 2022 at 12:01, Matthias van de Meent > wrote: > > > > On Wed, 13 Jul 2022 at 08:07, Simon Riggs > > wrote: > > > > > > > + *CREATE STATISTICS [ [IF NOT EXISTS] stats_name ] > > > > I think this is ready for a c

let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-21 Thread Robert Haas
Hi, Currently, it's possible to remove the rolissuper bit from the bootstrap superuser, but this leaves that user - and the system in general - in an odd state. The bootstrap user continues to own all of the objects it owned before, e.g. all of the system catalogs. Direct DML on system catalogs is

Re: Make name optional in CREATE STATISTICS

2022-07-21 Thread Tomas Vondra
On 7/21/22 16:12, Dean Rasheed wrote: > On Wed, 20 Jul 2022 at 12:01, Matthias van de Meent > wrote: >> >> On Wed, 13 Jul 2022 at 08:07, Simon Riggs >> wrote: >>> + *CREATE STATISTICS [ [IF NOT EXISTS] stats_name ] >> >> I think this is ready for a committer, so I've marked

Re: Add connection active, idle time to pg_stat_activity

2022-07-21 Thread Sergey Dudoladov
Hello, I have addressed the reviews. @Aleksander Alekseev thanks for reporting the issue. I have altered the patch to respect the behavior of pg_stat_activity, specifically [1] > Another important point is that when a server process is asked to display any > of these statistics, > it first fetc

Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-21 Thread Tom Lane
Robert Haas writes: > Currently, it's possible to remove the rolissuper bit from the > bootstrap superuser, but this leaves that user - and the system in > general - in an odd state. The bootstrap user continues to own all of > the objects it owned before, e.g. all of the system catalogs. Direct >

Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-21 Thread David G. Johnston
On Thu, Jul 21, 2022 at 9:28 AM Tom Lane wrote: > Robert Haas writes: > > Currently, it's possible to remove the rolissuper bit from the > > bootstrap superuser, but this leaves that user - and the system in > > general - in an odd state. The bootstrap user continues to own all of > > the object

Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-21 Thread Tom Lane
"David G. Johnston" writes: > On Thu, Jul 21, 2022 at 9:28 AM Tom Lane wrote: >> True, but what if the idea is to have *no* superusers? I seem >> to recall people being interested in setups like that. > I would expect an initdb option (once this is possible) to specify this > desire and we just

Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-21 Thread Robert Haas
On Thu, Jul 21, 2022 at 12:28 PM Tom Lane wrote: > True, but what if the idea is to have *no* superusers? I seem > to recall people being interested in setups like that. Hmm, right. There's nothing that stops you from de-super-ing all of your superusers today, and then if you ever need to do any

Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-21 Thread Tom Lane
Robert Haas writes: > ... if > we want to regard no-superusers as a supported configuration, we > probably need to tighten that up. I think it's kind of hopeless, Yeah, I agree. At least, I'm uninterested in spending any of my own time trying to make that usefully-more-secure than it is today. I

Re: PG 15 (and to a smaller degree 14) regression due to ExprEvalStep size

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-21, Amit Langote wrote: > Because I wrote all of it while not really understanding how the LLVM > constructs like blocks and branches work, the only reason I think > those llvm_compile_expr() additions may be correct is that all the > tests in jsonb_sqljson.sql pass even if I add the f

Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-21 Thread Nathan Bossart
On Thu, Jul 21, 2022 at 01:02:50PM -0400, Tom Lane wrote: > Robert Haas writes: >> ... if >> we want to regard no-superusers as a supported configuration, we >> probably need to tighten that up. I think it's kind of hopeless, > > Yeah, I agree. At least, I'm uninterested in spending any of my >

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

2022-07-21 Thread Martin Kalcher
Am 21.07.22 um 10:41 schrieb Dean Rasheed: It's important to mark these new functions as VOLATILE, not IMMUTABLE, otherwise they won't work as expected in queries. See https://www.postgresql.org/docs/current/xfunc-volatility.html It would be better to use pg_prng_uint64_range() rather than rand

Re: Make name optional in CREATE STATISTICS

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-21, Dean Rasheed wrote: > I tend to agree with Matthias' earlier point about avoiding code > duplication in the grammar. Without going off and refactoring other > parts of the grammar not related to this patch, it's still a slightly > smaller, simpler change, and less code duplication,

Re: First draft of the PG 15 release notes

2022-07-21 Thread Bruce Momjian
On Tue, Jul 12, 2022 at 02:47:07PM -0400, Bruce Momjian wrote: > On Mon, Jul 11, 2022 at 11:31:32PM -0700, Noah Misch wrote: > > On Mon, Jul 11, 2022 at 12:39:57PM -0400, Bruce Momjian wrote: > > > I had trouble reading the sentences in the order you used so I > > > restructured it: > > > > > >

Re: Allow placeholders in ALTER ROLE w/o superuser

2022-07-21 Thread Nathan Bossart
On Wed, Jul 20, 2022 at 11:50:10AM -0400, Tom Lane wrote: > I think that 13d838815 has completely changed the terms that this > discussion needs to be conducted under. It seems clear to me now > that if you want to relax this only-superusers restriction, what > you have to do is store the OID of t

Re: Fix gcc warning in sync.c (usr/src/backend/storage/sync/sync.c)

2022-07-21 Thread Alvaro Herrera
On 2022-Jul-15, Thomas Munro wrote: > On Mon, Jul 11, 2022 at 9:45 PM Kyotaro Horiguchi > wrote: > > So, for starters, I compiled the whole tree with -Wshadow=local. and I > > saw many warnings with it. At a glance all of them are reasonably > > "fixed" but I don't think it is what we want... >

Re: Transparent column encryption

2022-07-21 Thread Jacob Champion
On Mon, Jul 18, 2022 at 3:53 AM Peter Eisentraut wrote: > Some other products make use of secure enclaves to do computations on > (otherwise) encrypted values on the server. I don't fully know how that > works, but I suspect that asymmetric keys can play a role in that. (I > don't have any immed

Re: Transparent column encryption

2022-07-21 Thread Jacob Champion
On Mon, Jul 18, 2022 at 9:07 AM Robert Haas wrote: > Even there, what can be accomplished with a feature that only encrypts > individual column values is by nature somewhat limited. If you have a > text column that, for one row, stores the value 'a', and for some > other row, stores the entire tex

Re: Make name optional in CREATE STATISTICS

2022-07-21 Thread Dean Rasheed
On Thu, 21 Jul 2022 at 18:42, Alvaro Herrera wrote: > > Thanks. I was looking at the recently modified REINDEX syntax and > noticed there another spot for taking an optional name. I ended up > reusing OptSchemaName for that, as in the attached patch. I think > adding production-specific additio

Re: Transparent column encryption

2022-07-21 Thread Bruce Momjian
On Mon, Jul 18, 2022 at 12:53:23PM +0200, Peter Eisentraut wrote: > Asymmetric keys gives you some more options for how you set up the keys at > the beginning. For example, you create the asymmetric key pair on the host > where your client program that wants access to the encrypted data will run.

Re: make -C libpq check fails obscurely if tap tests are disabled

2022-07-21 Thread Andrew Dunstan
On 2022-07-21 Th 04:53, Alvaro Herrera wrote: > On 2022-Jul-20, Andrew Dunstan wrote: > >> On 2022-07-20 We 13:23, Justin Pryzby wrote: >>> PATH=... && @echo "TAP tests not enabled. Try configuring with >>> --enable-tap-tests" >>> /bin/sh: 1: @echo: not found >>> >>> make is telling the shell to

Re: Handle infinite recursion in logical replication setup

2022-07-21 Thread Jonathan S. Katz
Hi, On 7/21/22 6:34 AM, vignesh C wrote: On Thu, Jul 21, 2022 at 2:06 PM Amit Kapila wrote: On Wed, Jul 20, 2022 at 2:33 PM vignesh C wrote: Modified. Apart from this I have run pgperltidy on the perl file and renamed 032_origin.pl to 030_origin.pl as currently there is 029_on_error.pl, 03

Undocumented Order By vs Target List Volatile Function Behavior

2022-07-21 Thread David G. Johnston
Hey, This came up today on twitter as a claimed POLA violation: postgres=# select random(), random() order by random(); random| random -+- 0.08176638503720679 | 0.08176638503720679 (1 row) Which was explained long ago by Tom as: http

Re: System column support for partitioned tables using heap

2022-07-21 Thread Robert Haas
On Tue, Jul 19, 2022 at 11:22 PM Morris de Oryx wrote: > It might help if I show a sample insert handling function. The issue is with > the line at the end of the top CTE, insert_rows: > > returning xmax as inserted_transaction_id), > > That's what fails on partitions. Is there an alterna

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

2022-07-21 Thread Tom Lane
Gurjeet Singh writes: > While poking at plperl's GUC in an internal discussion, I was able to > induce a crash (or an assertion failure in assert-enabled builds) as > an unprivileged user. > My investigation so far has revealed that the code path for the > following condition has never been tested

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

2022-07-21 Thread Peter Smith
On Thu, Jul 21, 2022 at 10:11 PM Amit Kapila wrote: > > On Thu, Jul 21, 2022 at 10:03 AM Michael Paquier wrote: > > > > On Thu, Jul 21, 2022 at 09:54:05AM +0530, Amit Kapila wrote: > > > Yeah, it is not very clear to me either. I think this won't be > > > difficult to change one or another way de

Expose Parallelism counters planned/execute in pg_stat_statements

2022-07-21 Thread Anthony Sotolongo
Hi all: Here's a patch to add counters about  planned/executed  for parallelism  to pg_stat_statements, as a way to follow-up on if the queries are planning/executing with parallelism, this can help to understand if you have a good/bad configuration or if your hardware is enough We decided

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

2022-07-21 Thread Nathan Bossart
On Thu, Jul 21, 2022 at 05:44:11PM -0400, Tom Lane wrote: > Right. So there are basically two things we could do about this: > > 1. set_config_option could decline to call pg_parameter_aclcheck > if not IsTransactionState(), instead failing the assignment. > This isn't a great answer because it w

Re: [PATCH] Log details for client certificate failures

2022-07-21 Thread Jacob Champion
On Wed, Jul 20, 2022 at 3:42 PM Tom Lane wrote: > Jacob Champion writes: > > I'm currently hardcoding an elevel of ERROR on the new guc_strdup()s, > > because that seems to be a common case for the check hooks. > > Really? That's almost certainly NOT okay. As an example, if you > have a problem

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

2022-07-21 Thread Tom Lane
Nathan Bossart writes: > +StartTransactionCommand(); > process_session_preload_libraries(); > +CommitTransactionCommand(); Yeah, that way would avoid any questions about changing the order of operations, but it seems like a mighty expensive solution: it's adding a transaction to each

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

2022-07-21 Thread Gurjeet Singh
On Thu, Jul 21, 2022 at 2:44 PM Tom Lane wrote: > > Gurjeet Singh writes: > > While poking at plperl's GUC in an internal discussion, I was able to > > induce a crash (or an assertion failure in assert-enabled builds) as > > an unprivileged user. > > My investigation so far has revealed that the

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

2022-07-21 Thread Gurjeet Singh
On Thu, Jul 21, 2022 at 3:29 PM Nathan Bossart wrote: > > On Thu, Jul 21, 2022 at 05:44:11PM -0400, Tom Lane wrote: > > Right. So there are basically two things we could do about this: > > > > 1. set_config_option could decline to call pg_parameter_aclcheck > > if not IsTransactionState(), instea

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

2022-07-21 Thread Nathan Bossart
On Thu, Jul 21, 2022 at 07:30:20PM -0400, Tom Lane wrote: > Nathan Bossart writes: >> +StartTransactionCommand(); >> process_session_preload_libraries(); >> +CommitTransactionCommand(); > > Yeah, that way would avoid any questions about changing the order of > operations, but it seem

Re: standby recovery fails (tablespace related) (tentative patch and discussion)

2022-07-21 Thread Kyotaro Horiguchi
At Thu, 21 Jul 2022 23:14:57 +1200, Thomas Munro wrote in > On Thu, Jul 21, 2022 at 11:01 PM Alvaro Herrera > wrote: > > On 2022-Jul-20, Alvaro Herrera wrote: > > > I see the following alternatives: > > > > > > 1. not backpatch this fix to 14 and older > > > 2. use a different GUC; either allo

Re: Expose Parallelism counters planned/execute in pg_stat_statements

2022-07-21 Thread Justin Pryzby
On Thu, Jul 21, 2022 at 06:26:58PM -0400, Anthony Sotolongo wrote: > Hi all: > Here's a patch to add counters about  planned/executed  for parallelism  to > pg_stat_statements, as a way to follow-up on if the queries are > planning/executing with parallelism, this can help to understand if you have

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

2022-07-21 Thread Gurjeet Singh
On Thu, Jul 21, 2022 at 4:35 PM Gurjeet Singh wrote: > I like the idea of performing library initialization in > InitPostgres(), as it performs the first transaction of the > connection, and because of the libraries' ability to gin up new GUC > variables that might need special handling, and also

Re: Make name optional in CREATE STATISTICS

2022-07-21 Thread Michael Paquier
On Thu, Jul 21, 2022 at 07:42:12PM +0200, Alvaro Herrera wrote: > Thanks. I was looking at the recently modified REINDEX syntax and > noticed there another spot for taking an optional name. I ended up > reusing OptSchemaName for that, as in the attached patch. I think > adding production-specifi

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

2022-07-21 Thread Michael Paquier
On Thu, Jul 21, 2022 at 05:39:35PM -0700, Gurjeet Singh wrote: > One notable side effect of this change is that > process_session_preload_libraries() is now called _before_ we > SetProcessingMode(NormalProcessing). Which means any database access > performed by _PG_init() of an extension will be do

Re: standby recovery fails (tablespace related) (tentative patch and discussion)

2022-07-21 Thread Kyotaro Horiguchi
At Thu, 21 Jul 2022 13:25:05 +0200, Alvaro Herrera wrote in > On 2022-Jul-21, Alvaro Herrera wrote: > > > Yeah, I think that would reduce cruft. I'm not sure this is more > > against backpatching policy or less, compared to adding a separate > > GUC just for this bugfix. > > cruft: > > {

Re: Memory leak fix in psql

2022-07-21 Thread Michael Paquier
On Thu, Jul 21, 2022 at 02:43:03PM +0800, Japin Li wrote: > I attached a patch for v14 [1] based on master, if you want to apply it, > please consider reviewing it. We are talking about a few hundred bytes leaked each time, so this does not worry me much in the older branches, honestly. -- Michael

Re: Reducing logs produced by TAP tests running pg_regress on crash

2022-07-21 Thread Michael Paquier
On Thu, Jun 23, 2022 at 02:30:13PM +0900, Michael Paquier wrote: > One idea I got to limit the useless output generated is to check the > status of the cluster after running the regression test suite as > restart_on_crash is disabled by default in Cluster.pm, and avoid any > follow-up logic in the

Re: Reducing logs produced by TAP tests running pg_regress on crash

2022-07-21 Thread Thomas Munro
On Fri, Jul 22, 2022 at 1:09 PM Michael Paquier wrote: > On Thu, Jun 23, 2022 at 02:30:13PM +0900, Michael Paquier wrote: > > One idea I got to limit the useless output generated is to check the > > status of the cluster after running the regression test suite as > > restart_on_crash is disabled b

  1   2   >