Re: Make name optional in CREATE STATISTICS

2022-07-22 Thread Michael Paquier
On Fri, Jul 22, 2022 at 11:54:27PM -0400, Tom Lane wrote: > That does not seem like an improvement. In v15: > > regression=# REINDEX SYSTEM CONCURRENTLY db; > ERROR: cannot reindex system catalogs concurrently > > As of HEAD: > > regression=# REINDEX SYSTEM CONCURRENTLY db; > ERROR: syntax

Fix annotations nextFullXid

2022-07-22 Thread Zhang Mingli
Hi,VariableCacheData.nextFullXid is renamed to nextXid in commit https://github.com/postgres/postgres//commit/fea10a64340e529805609126740a540c8f9daab4Fix the annotations for less confusion.Regards,Zhang Mingli Fix-annotations-nextFullXid.patch Description: Binary data

Re: Removing obsolete configure checks

2022-07-22 Thread Thomas Munro
On Sat, Jul 23, 2022 at 4:05 PM Tom Lane wrote: > Thomas Munro writes: > > On Fri, Feb 21, 2020 at 7:00 AM Tom Lane wrote: > >> All of the above are required by C99 and/or SUSv2, and the configure-using > >> buildfarm members are unanimous in reporting that they have them, and > >>

Re: Removing obsolete configure checks

2022-07-22 Thread Tom Lane
Thomas Munro writes: > On Fri, Feb 21, 2020 at 7:00 AM Tom Lane wrote: >> All of the above are required by C99 and/or SUSv2, and the configure-using >> buildfarm members are unanimous in reporting that they have them, and >> msvc/Solution.pm expects Windows to have them. > I think the same now

Re: Expose Parallelism counters planned/execute in pg_stat_statements

2022-07-22 Thread Julien Rouhaud
Hi, On Fri, Jul 22, 2022 at 02:11:35PM -0400, Anthony Sotolongo wrote: > > On 22-07-22 12:08, Julien Rouhaud wrote: > > > > With your current patch it only says if the plan and execution had > > parallelism > > enabled, but not if it could actually use with parallelism at all. It gives > > some

Re: Make name optional in CREATE STATISTICS

2022-07-22 Thread Tom Lane
Michael Paquier writes: > I have just looked at 83011ce, and got what you've done here. You > have thrown away reindex_target_multitable and added three parts for > SCHEMA, DATABASE and SYSTEM instead with their own options, enforcing > the restriction on CONCURRENTLY at the end of REINDEX

Re: potential memory leak in pg_regcomp()

2022-07-22 Thread Tom Lane
Zhihong Yu writes: > I was looking at pg_regcomp(): > re->re_guts = VS(MALLOC(sizeof(struct guts))); > I did some search trying to find where re_guts is freed but haven't > found it. In rfree(), which is called from freev(). regards, tom lane

Re: Removing obsolete configure checks

2022-07-22 Thread Thomas Munro
On Fri, Feb 21, 2020 at 7:00 AM Tom Lane wrote: > wchar.h > > All of the above are required by C99 and/or SUSv2, and the configure-using > buildfarm members are unanimous in reporting that they have them, and > msvc/Solution.pm expects Windows to have them. I think the same now applies to ,

Re: potential memory leak in pg_regcomp()

2022-07-22 Thread Michael Paquier
On Fri, Jul 22, 2022 at 08:20:04PM -0700, Zhihong Yu wrote: > Hi, > I was looking at pg_regcomp(): > > re->re_guts = VS(MALLOC(sizeof(struct guts))); > > I did some search trying to find where re_guts is freed but haven't > found it. > Can someone enlighten me? Oops. It seems that you are

Re: Make name optional in CREATE STATISTICS

2022-07-22 Thread Michael Paquier
On Fri, Jul 22, 2022 at 03:06:46PM +0200, Alvaro Herrera wrote: > Actually, looking at the grammar again I realized that the '('options')' > part could be refactored; and with that, keeping an extra production for > REINDEX DATABASE CONCURRENTLY is short enough. It is removed from > REINDEX

potential memory leak in pg_regcomp()

2022-07-22 Thread Zhihong Yu
Hi, I was looking at pg_regcomp(): re->re_guts = VS(MALLOC(sizeof(struct guts))); I did some search trying to find where re_guts is freed but haven't found it. Can someone enlighten me? Thanks

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

2022-07-22 Thread Michael Paquier
On Fri, Jul 22, 2022 at 01:18:34PM +1200, Thomas Munro wrote: > I wonder if we should move the noise suppression check closer to > pg_regress, so that it works also for the "main" pg_regress run, not > only the one in this new TAP test. As discussed in this thread, > inconclusively: Yes,

Re: pg_tablespace_location() failure with allow_in_place_tablespaces

2022-07-22 Thread Michael Paquier
On Fri, Jul 22, 2022 at 05:50:58PM +1200, Thomas Munro wrote: > On Thu, Mar 31, 2022 at 5:01 PM Michael Paquier wrote: >> Yeah, I saw that in-place tablespaces were part of the main tarball in >> base backups as we rely on the existence of a link to decide if the >> contents of a path should be

Interpretation of docs for \copy ... from stdin inaccurate when using -c

2022-07-22 Thread David G. Johnston
This works: vagrant@vagrant:/usr/local/pgsql/bin$ echo 'value1' | ./psql -d postgres -c '\copy csvimport from stdin;' COPY 1 However: For \copy ... from stdin, data rows are read from the same source that issued the command and When either -c or -f is specified, psql does not read commands

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

2022-07-22 Thread Tom Lane
I wrote: > So it'll work in 3.81 (released 2006) and later, but not 3.80. Confirmed that things are fine with 3.81. > TBH my inclination here is to move our goalposts to say "we support > gmake 3.81 and later". Barring objections, I'll push the attached patch. I suppose we could undo whatever

Re: [Commitfest 2022-07] Begins Now

2022-07-22 Thread Jacob Champion
On Mon, Jul 18, 2022 at 1:44 PM Andres Freund wrote: > ISTM that you're trying to get patches to have zero reviewers if they need > more reviewers, because that can serve as a signal in the CF app. But to me > that's a bad proxy. Okay. I need to put some more thought into what it is that I

Re: [Commitfest 2022-07] Begins Now

2022-07-22 Thread Jacob Champion
On 7/15/22 16:42, Jacob Champion wrote: > On 7/8/22 16:42, Jacob Champion wrote: >> On 7/1/22 08:08, Jacob Champion wrote: >>> It's been July everywhere on Earth for a few hours, so the July >>> commitfest is now in progress: >>> >>> https://commitfest.postgresql.org/38/ With one week

Re: Refactoring the regression tests for more independence

2022-07-22 Thread Tom Lane
Aleksander Alekseev writes: > Sorry about the confusion regarding the environment differences. GCC > version is 8.3.0, Perl 5.28.1. All in all this is pretty much the > default Raspbian 10 environment, something you would typically get > after setting up your RPi 3 B+ using Raspberry Pi Imager

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

2022-07-22 Thread Nathan Bossart
On Fri, Jul 22, 2022 at 06:44:04PM -0400, Tom Lane wrote: > Another idea is to add a "bool interactive" parameter to InitPostgres, > thereby shoving the issue out to the call sites. Still wouldn't > expose the am_walsender angle, but conceivably it'd be more > future-proof anyway? I hesitated to

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

2022-07-22 Thread Tom Lane
Nathan Bossart writes: > On Fri, Jul 22, 2022 at 02:56:22PM -0400, Tom Lane wrote: >> +if (!bootstrap && >> +!IsAutoVacuumWorkerProcess() && >> +!IsBackgroundWorker && >> +!am_walsender) >> +process_session_preload_libraries(); > I worry that

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

2022-07-22 Thread Nathan Bossart
On Fri, Jul 22, 2022 at 02:56:22PM -0400, Tom Lane wrote: > + /* > + * If this is an interactive session, load any libraries that should be > + * preloaded at backend start. Since those are determined by GUCs, this > + * can't happen until GUC settings are complete, but we want

Re: privileges for ALTER ROLE/DATABASE SET

2022-07-22 Thread Nathan Bossart
On Fri, Jul 22, 2022 at 04:16:14PM -0400, Tom Lane wrote: > Clearly, you need enough privilege to SET the parameter, and you need > some sort of management privilege on the target role or DB. There > might be room to discuss what that per-role/DB privilege needs to be. > But I'm very skeptical

Re: PANIC: wrong buffer passed to visibilitymap_clear

2022-07-22 Thread Tom Lane
Peter Geoghegan writes: > It would also be helpful if you told us about the specific table > involved. Though the important thing (the essential thing) is to test > today's REL_14_STABLE. There have been *lots* of bug fixes since > Postgres 14 beta2 was current. Yeah. To be blunt, you're

Re: PANIC: wrong buffer passed to visibilitymap_clear

2022-07-22 Thread Peter Geoghegan
On Fri, Jul 22, 2022 at 1:22 AM 王伟(学弈) wrote: > I recently find this problem while testing PG14 with sysbench. The line numbers from your stack trace don't match up with REL_14_STABLE. Is this actually a fork of Postgres 14? (Oh, looks like it's an old beta release.) > Then I look through the

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

2022-07-22 Thread Tom Lane
I wrote: > Yeah, it is. I looked at the gmake manual on that machine, and its > description of "export" seems about the same as what I see in a > modern version. Um ... I was not looking in the right place. The description of "target-specific variables" does not say you can use "export",

Re: Support logical replication of DDLs

2022-07-22 Thread Zheng Li
Hello, Here is a patch that supports replication of global object commands, these include ROLE statements, database statements and tablespace statements. The patch should be applied on top of the v13 DDL replication patch set that ZJ Hou sent in the previous email. Global objects commands are

Re: 回复:Re: PANIC: wrong buffer passed to visibilitymap_clear

2022-07-22 Thread Tomas Vondra
On 7/22/22 14:17, 王伟(学弈) wrote: > On 7/22/22 18:06, Tomas Vondra wrote: >> Which PG14 version / commit is this, exactly? What sysbench parameters >> did you use, how likely is hitting the issue? > PG_VERSION is '14beta2'. > The head commit id is 'e1c1c30f635390b6a3ae4993e8cac213a33e6e3f'. Why not

Re: Add last failed connection error message to pg_stat_wal_receiver

2022-07-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 The patch can be applied to PG master branch without

Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-22 Thread Robert Haas
On Fri, Jul 22, 2022 at 1:21 PM Joe Conway wrote: > My strategy has been to ensure no other roles are members of the > bootstrap superuser role, and then alter the bootstrap user to be > NOLOGIN. E.g. in the example here: Yeah, making the bootstrap role NOLOGIN seems more reasonable than making

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

2022-07-22 Thread Tom Lane
Alvaro Herrera writes: > On 2022-Jul-22, Alvaro Herrera wrote: >> It's not very common -- we do have some target-specific variable >> assignments, but none of them use 'export'. I saw somewhere that this >> works from Make 3.77 onwards, and we require 3.80, so it should be okay. >> The buildfarm

predefined role(s) for VACUUM and ANALYZE

2022-07-22 Thread Nathan Bossart
Hi hackers, The previous attempt to add a predefined role for VACUUM and ANALYZE [0] resulted in the new pg_checkpoint role in v15. I'd like to try again to add a new role (or multiple new roles) for VACUUM and ANALYZE. The primary motivation for this is to continue chipping away at things that

Re: Proposal: add a debug message about using geqo

2022-07-22 Thread Jacob Champion
On Wed, Jun 1, 2022 at 11:09 PM KAWAMOTO Masaya wrote: > That sounds a nice idea. But I don't think that postgres shows in the > EXPLAIN output why the plan is selected. Would it be appropriate to > show that GEQO is used in EXPLAIN output? I'm reminded of Greenplum's "Optimizer" line in its

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

2022-07-22 Thread Alvaro Herrera
On 2022-Jul-22, Alvaro Herrera wrote: > It's not very common -- we do have some target-specific variable > assignments, but none of them use 'export'. I saw somewhere that this > works from Make 3.77 onwards, and we require 3.80, so it should be okay. > The buildfarm will tell us ... Hm, so

Re: privileges for ALTER ROLE/DATABASE SET

2022-07-22 Thread Tom Lane
Nathan Bossart writes: > Presently, if a role has privileges to SET a parameter, it is able to ALTER > ROLE/DATABASE SET that parameter, provided it otherwise has permission to > alter that role/database. This includes cases where the role only has SET > privileges via the new pg_parameter_acl

privileges for ALTER ROLE/DATABASE SET

2022-07-22 Thread Nathan Bossart
Hi hackers, Presently, if a role has privileges to SET a parameter, it is able to ALTER ROLE/DATABASE SET that parameter, provided it otherwise has permission to alter that role/database. This includes cases where the role only has SET privileges via the new pg_parameter_acl catalog. For

Re: explain analyze rows=%.0f

2022-07-22 Thread Naeem Akhter
The following review has been posted through the commitfest application: make installcheck-world: tested, passed Implements feature: tested, passed Spec compliant: not tested Documentation:not tested Verified patch 'explain_float_row_v3.patch' on master &

Re: Refactoring the regression tests for more independence

2022-07-22 Thread Aleksander Alekseev
Hi Tom, > Since you haven't explained what's different about this environment, > it's hard to comment on these results. But is this really a stock > Postgres source tree, with no local modifications? The fragment of > src/test/regress/expected/copy.out that you show does not look > current.

Re: Refactoring the regression tests for more independence

2022-07-22 Thread Tom Lane
Aleksander Alekseev writes: > I wanted to test one of the patches we have for the July CF on the > Raspberry Pi 3 Model B+. It runs Raspbian GNU/Linux 10 (buster) and > Linux Kernel 5.10.60-v7+. > I discovered that the PostgreSQL tests don't pass in this environment. Since you haven't explained

Re: warn if GUC set to an invalid shared library

2022-07-22 Thread Tom Lane
Justin Pryzby writes: > On Fri, Jul 22, 2022 at 03:00:23PM -0400, Tom Lane wrote: >> Shouldn't you be doing this when the source is PGC_S_TEST, instead? > That makes sense, but it doesn't work for ALTER SYSTEM, which uses PGC_S_FILE. Hmph. I wonder if we shouldn't change that, because it's a

Re: warn if GUC set to an invalid shared library

2022-07-22 Thread Justin Pryzby
On Fri, Jul 22, 2022 at 03:00:23PM -0400, Tom Lane wrote: > Justin Pryzby writes: > > On Fri, Jul 22, 2022 at 01:53:21PM -0400, Tom Lane wrote: > >> This indicates that the warning is being issued in the wrong place. > >> It's okay if it comes out during ALTER SYSTEM. It's not okay if it > >>

Re: warn if GUC set to an invalid shared library

2022-07-22 Thread Tom Lane
Justin Pryzby writes: > On Fri, Jul 22, 2022 at 01:53:21PM -0400, Tom Lane wrote: >> This indicates that the warning is being issued in the wrong place. >> It's okay if it comes out during ALTER SYSTEM. It's not okay if it >> comes out during server start; then it's just an annoyance. > The

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

2022-07-22 Thread Tom Lane
Kyotaro Horiguchi writes: > At Fri, 22 Jul 2022 10:00:34 +0900, Michael Paquier > wrote in >> On Thu, Jul 21, 2022 at 05:39:35PM -0700, Gurjeet Singh wrote: >>> The patch also adds an assertion in pg_parameter_aclcheck() to ensure >>> that there's a transaction is in progress before it's

Re: warn if GUC set to an invalid shared library

2022-07-22 Thread Justin Pryzby
On Fri, Jul 22, 2022 at 01:53:21PM -0400, Tom Lane wrote: > > 2022-07-22 10:37:50.217 PDT [1131187] LOG: database system is shut down > > 2022-07-22 10:37:50.306 PDT [1134058] WARNING: could not access file > > "$libdir/plugins/lol" > > 2022-07-22 10:37:50.306 PDT [1134058] DETAIL: The server

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

2022-07-22 Thread Alvaro Herrera
On 2022-Jul-21, Andrew Dunstan wrote: > On 2022-07-21 Th 04:53, Alvaro Herrera wrote: > > Here's a different take. Just assign the variable separately. > > Nice, I didn't know you could do that. It's not very common -- we do have some target-specific variable assignments, but none of them use

Re: Expose Parallelism counters planned/execute in pg_stat_statements

2022-07-22 Thread Anthony Sotolongo
On 22-07-22 12:08, Julien Rouhaud wrote: Hi, On Fri, Jul 22, 2022 at 11:17:52AM -0400, Anthony Sotolongo wrote: On 21-07-22 20:35, Justin Pryzby wrote: 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

Re: warn if GUC set to an invalid shared library

2022-07-22 Thread Tom Lane
Maciek Sakrejda writes: >> I've started to think that we should really WARN whenever a (set of) GUC is >> set >> in a manner that the server will fail to start - not just for shared >> libraries. > +0.5. I think it's a reasonable change, but I've never broken my > server with anything other

Re: warn if GUC set to an invalid shared library

2022-07-22 Thread Maciek Sakrejda
Thanks for picking this back up, Justin. >I've started to think that we should really WARN whenever a (set of) GUC is set >in a manner that the server will fail to start - not just for shared libraries. +0.5. I think it's a reasonable change, but I've never broken my server with anything other

Re: let's disallow ALTER ROLE bootstrap_superuser NOSUPERUSER

2022-07-22 Thread Joe Conway
On 7/21/22 12:46, Tom Lane wrote: "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

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

2022-07-22 Thread Joe Conway
On 7/19/22 10:20, Tom Lane wrote: Everything else either explicitly rejects more-than-one-D arrays or does something that is compatible with thinking of them as arrays-of-arrays. I think I am responsible for at least some of those, and I agree that thinking of MD arrays as arrays-of-arrays is

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

2022-07-22 Thread Önder Kalacı
Hi, > > > > > One another idea could be to re-calculate the index, say after N > updates/deletes for the table. We may consider using subscription_parameter > for getting N -- with a good default, or even hard-code into the code. I > think the cost of re-calculating should really be pretty small

Re: Expose Parallelism counters planned/execute in pg_stat_statements

2022-07-22 Thread Julien Rouhaud
Hi, On Fri, Jul 22, 2022 at 11:17:52AM -0400, Anthony Sotolongo wrote: > > On 21-07-22 20:35, Justin Pryzby wrote: > > 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 > > >

Re: Expose Parallelism counters planned/execute in pg_stat_statements

2022-07-22 Thread Anthony Sotolongo
On 21-07-22 20:35, Justin Pryzby wrote: 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,

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

2022-07-22 Thread Dave Cramer
Greetings, Jack Christensen the author of the go pgx driver had suggested Default result formats should be settable per session · Discussion #5 · postgresql-interfaces/enhancement-ideas (github.com) The JDBC driver has a

Re: Support tab completion for upper character inputs in psql

2022-07-22 Thread Tom Lane
"tanghy.f...@fujitsu.com" writes: > I think 02b8048 forgot to free some used memory. > Attached a tiny patch to fix it. Please have a check. Right you are. Inspired by that, I tried running some tab-completion operations under valgrind, and found another nearby leak in patternToSQLRegex.

Re: StrategyAM for IndexAMs

2022-07-22 Thread Simon Riggs
On Fri, 22 Jul 2022 at 10:23, Matthias van de Meent wrote: > > On Tue, 19 Jul 2022 at 18:56, Simon Riggs > wrote: > > > > I'm preparing the way for a later patch that would allow unique hash > > indexes to be primary keys. There are various parts to the problem. I > > was surprised at how many

Re: Skip partition tuple routing with constant partition key

2022-07-22 Thread Amit Langote
On Thu, Jul 14, 2022 at 2:31 PM David Rowley wrote: > I've spent some time looking at the v10 patch, and to be honest, I > don't really like the look of it :( Thanks for the review and sorry for the delay in replying. > 1. I think we should be putting the cache fields in PartitionDescData >

Re: Use extended statistics to estimate (Var op Var) clauses

2022-07-22 Thread Dean Rasheed
On Thu, 21 Jul 2022 at 12:42, Tomas Vondra wrote: > > > This needs to account for nullfrac, since x = x is only true if x is not > > null. > > Right, I forgot to account for nullfrac. > Ditto variable <= variable > > I don't like how matching_restriction_variables() is adding a > > non-trivial

Re: Pluggable toaster

2022-07-22 Thread Matthias van de Meent
On Wed, 20 Jul 2022 at 11:16, Nikita Malakhov wrote: > > Hi hackers! Hi, Please don't top-post here. See https://wiki.postgresql.org/wiki/Mailing_Lists#Email_etiquette_mechanics. > We really need your feedback on the last patchset update! This is feedback on the latest version that was

Re: Make name optional in CREATE STATISTICS

2022-07-22 Thread Alvaro Herrera
On 2022-Jul-22, Michael Paquier wrote: > So this indeed has as effect to make possible the use of CONCURRENTLY > for DATABASE and SYSTEM only within the parenthesized grammar. Seeing > the simplifications this creates, I'd agree with dropping this part of > the grammar. Actually, looking at the

proposal - enhancing plpgsql's FOREACH statement for support json type

2022-07-22 Thread Pavel Stehule
Hi now we have lot of nice json related functions and I think so can be nice if plpgsql's statement FOREACH can directly support json type. It can save some CPY cycles by reducing some transformations. My idea is following - new syntax FOREACH targetvar IN JSON ARRAY json array expr LOOP ...

回复:Re: PANIC: wrong buffer passed to visibilitymap_clear

2022-07-22 Thread 王伟(学弈)
On 7/22/22 18:06, Tomas Vondra wrote: > Which PG14 version / commit is this, exactly? What sysbench parameters > did you use, how likely is hitting the issue? PG_VERSION is '14beta2'. The head commit id is 'e1c1c30f635390b6a3ae4993e8cac213a33e6e3f'. I have run these sysbench commands for couple

Re: explain analyze rows=%.0f

2022-07-22 Thread Robert Haas
On Fri, Jul 22, 2022 at 6:47 AM Amit Kapila wrote: > I feel the discussion has slightly deviated which makes it unclear > whether this patch is required or not? My opinion is that showing some fractional digits at least when loops>1 would be better than what we have now. It might not be the best

Re: Windows default locale vs initdb

2022-07-22 Thread Juan José Santamaría Flecha
On Wed, Jul 20, 2022 at 1:44 PM Thomas Munro wrote: > On Wed, Jul 20, 2022 at 10:27 PM Juan José Santamaría Flecha > wrote: > > Still, WIN1252 is not the wrong answer for what we are asking. Even if > you enable UTF-8 support [1], the system will use the current default > Windows ANSI code page

Re: Pluggable toaster

2022-07-22 Thread Aleksander Alekseev
Hi Nikita, > I've reworked the patch set according to recommendations of Aleksander > Alekseev, Robert Haas > and Matthias van de Meent, and decided, as it was recommended earlier, > include only the most > important part in the first set. Also, I've added a large README on Pluggable > TOAST

Re: Pluggable toaster

2022-07-22 Thread Nikita Malakhov
Hi hackers! I've reworked the patch set according to recommendations of Aleksander Alekseev, Robert Haas and Matthias van de Meent, and decided, as it was recommended earlier, include only the most important part in the first set. Also, I've added a large README on Pluggable TOAST to sources,

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

2022-07-22 Thread Dean Rasheed
On Fri, 22 Jul 2022 at 10:31, Martin Kalcher wrote: > > 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. > > What do you think? Looks fairly

Re: making relfilenodes 56 bits

2022-07-22 Thread vignesh C
On Wed, Jul 20, 2022 at 4:57 PM Dilip Kumar wrote: > > On Mon, Jul 18, 2022 at 4:51 PM Dilip Kumar wrote: > > > > I was doing some more testing by setting the FirstNormalRelFileNumber > > to a high value(more than 32 bits) I have noticed a couple of problems > > there e.g. relpath is still using

Re: explain analyze rows=%.0f

2022-07-22 Thread Amit Kapila
On Fri, Jul 8, 2022 at 3:50 AM Justin Pryzby wrote: > > On Thu, Jul 07, 2022 at 04:21:37PM -0400, Robert Haas wrote: > > I mean, what I really want here if I'm honest is to not have the > > system divide the number of rows by the loop count. And it sort of > > sounds like maybe that's what you

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

2022-07-22 Thread Amit Kapila
On Fri, Jul 22, 2022 at 1:37 PM Junwang Zhao wrote: > > Here is the patch v7. Thanks! > LGTM. I'll push this sometime early next week unless there are more suggestions/comments. -- With Regards, Amit Kapila.

Re: PANIC: wrong buffer passed to visibilitymap_clear

2022-07-22 Thread Tomas Vondra
On 7/22/22 10:22, 王伟(学弈) wrote: > Hi, > I recently find this problem while testing PG14 with sysbench. > Then I look through the emails from pgsql-hackers and find a previous > similary bug which > is  > https://www.postgresql.org/message-id/flat/2247102.1618008027%40sss.pgh.pa.us >

Re: Add connection active, idle time to pg_stat_activity

2022-07-22 Thread Aleksander Alekseev
Hi hackers, All in all the patch seems to be in good shape. > This is consistent with the current documentation: > > > Each individual server process transmits new statistical counts to the > > collector just before going idle; so a query or transaction still in > > progress does not affect

Re: Add proper planner support for ORDER BY / DISTINCT aggregates

2022-07-22 Thread Richard Guo
On Wed, Jul 20, 2022 at 1:27 PM David Rowley wrote: > I've been working on this patch again. There was a bit of work to do > to rebase it atop db0d67db2. The problem there was that since this > patch appends pathkeys to suit ORDER BY / DISTINCT aggregates to the > query's group_pathkeys,

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

2022-07-22 Thread Martin Kalcher
Am 22.07.22 um 09:59 schrieb Dean Rasheed:> Option 1: Keep random.c small - Responsible for initialisation of the user prng on demand - Expose the user prng state to other code like float.c and arrayfuncs.c Option 2: Move all random functions wanting to use the user prng to random.c -

Re: StrategyAM for IndexAMs

2022-07-22 Thread Matthias van de Meent
On Tue, 19 Jul 2022 at 18:56, Simon Riggs wrote: > > I'm preparing the way for a later patch that would allow unique hash > indexes to be primary keys. There are various parts to the problem. I > was surprised at how many times we hardcode BTREE_AM_OID and > associated BT Strategy Numbers in many

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

2022-07-22 Thread Yuya Watari
Dear Andrey Lepikhov, Thank you for replying and being a reviewer for this patch. I really appreciate it. > Are you still working on this patch? Yes, I’m working on improving this patch. It is not easy to address the problems that this patch has, but I’m hoping to send a new version of it in a

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

2022-07-22 Thread Amit Kapila
On Thu, Jul 21, 2022 at 11:53 AM Michael Paquier wrote: > > On Wed, Jul 20, 2022 at 04:36:13PM +0530, Amit Kapila wrote: > > Right. But, I noticed that get_altertable_subcmdtypes() doesn't handle > > AT_AttachPartition or AT_DetachPartition. We can handle those and at > > least have a test for

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

2022-07-22 Thread Thomas Munro
On Fri, Jul 22, 2022 at 8:19 PM Alvaro Herrera wrote: > On 2022-Jul-22, Kyotaro Horiguchi wrote: > > At Thu, 21 Jul 2022 23:14:57 +1200, Thomas Munro > > wrote in > > > Would it help if we back-patched the allow_in_place_tablespaces stuff? > > > I'm not sure how hard/destabilising that would

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

2022-07-22 Thread Kyotaro Horiguchi
At Fri, 22 Jul 2022 10:18:58 +0200, Alvaro Herrera wrote in > OK, I'll wait for allow_in_place_tablespaces to be backpatched then. > > I would like to get this fix pushed before the next set of minors, so if > you won't have time for the backpatches early enough, maybe I can work > on getting

Re: Fast COPY FROM based on batch insert

2022-07-22 Thread Andrey Lepikhov
On 7/22/22 13:14, Etsuro Fujita wrote: On Fri, Jul 22, 2022 at 3:39 PM Andrey Lepikhov Why such cascade flush is really necessary, especially for BEFORE and INSTEAD OF triggers? BEFORE triggers on the chosen partition might query the parent table, not just the partition, so I think we need to

Re: Add connection active, idle time to pg_stat_activity

2022-07-22 Thread Aleksander Alekseev
Hi Sergey, > @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 fetches the most

Re: Remove useless arguments in ReadCheckpointRecord().

2022-07-22 Thread Kyotaro Horiguchi
At Fri, 22 Jul 2022 11:50:14 +0900, Fujii Masao wrote in > Sorry, I failed to understand your point. Could you clarify your > point? Wrote as a reply to Tom's message. > > By the way, > > this looks like a good chance to remove the (now) extra parens around > > errmsg() and friends. > > For

RE: Support tab completion for upper character inputs in psql

2022-07-22 Thread tanghy.f...@fujitsu.com
On Monday, January 31, 2022 3:35 AM, Tom Lane wrote: > "tanghy.f...@fujitsu.com" writes: > > Thanks for your V16 patch, I tested it. > > The results LGTM. > > Pushed, thanks for looking. I think 02b8048 forgot to free some used memory. Attached a tiny patch to fix it. Please have a check.

PANIC: wrong buffer passed to visibilitymap_clear

2022-07-22 Thread 王伟(学弈)
Hi, I recently find this problem while testing PG14 with sysbench. Then I look through the emails from pgsql-hackers and find a previous similary bug which is https://www.postgresql.org/message-id/flat/2247102.1618008027%40sss.pgh.pa.us. But the bugfix

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

2022-07-22 Thread Alvaro Herrera
On 2022-Jul-22, Kyotaro Horiguchi wrote: > At Thu, 21 Jul 2022 23:14:57 +1200, Thomas Munro > wrote in > > Would it help if we back-patched the allow_in_place_tablespaces stuff? > > I'm not sure how hard/destabilising that would be, but I could take a > > look tomorrow. > > +1. Addiotional

Re: Remove useless arguments in ReadCheckpointRecord().

2022-07-22 Thread Kyotaro Horiguchi
At Thu, 21 Jul 2022 23:10:04 -0400, Tom Lane wrote in > Fujii Masao writes: > > On 2022/07/21 14:54, Kyotaro Horiguchi wrote: > >> At Thu, 21 Jul 2022 11:45:23 +0900, Fujii Masao > >> wrote in > >>> - (errmsg("could not locate required checkpoint record"), > >>> + (errmsg("could not locate a

Re: Fast COPY FROM based on batch insert

2022-07-22 Thread Etsuro Fujita
On Fri, Jul 22, 2022 at 3:39 PM Andrey Lepikhov wrote: > Analyzing multi-level heterogeneous partitioned configurations I > realized, that single write into a partition with a trigger will flush > buffers for all other partitions of the parent table even if the parent > haven't any triggers. > It

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

2022-07-22 Thread Junwang Zhao
Here is the patch v7. Thanks! On Fri, Jul 22, 2022 at 1:15 PM Amit Kapila wrote: > > On Fri, Jul 22, 2022 at 7:39 AM Kyotaro Horiguchi > wrote: > > > > +errmsg("cannot operate on relation \"%s\"", > > > > Other callers of errdetail_relkind_not_supported()

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

2022-07-22 Thread Etsuro Fujita
On Fri, Jul 22, 2022 at 12:07 PM Fujii Masao wrote: > Pushed. This is my oversight in commit 27e1f1456. :-( Thanks for the report and fix, Fujii-san! Best regards, Etsuro Fujita

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

2022-07-22 Thread Dean Rasheed
On Thu, 21 Jul 2022 at 16:43, Martin Kalcher wrote: > > 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

Re: NAMEDATALEN increase because of non-latin languages

2022-07-22 Thread John Naylor
On Tue, Jul 19, 2022 at 10:57 PM Andres Freund wrote: > > Hi, > > On 2022-07-19 14:30:34 +0700, John Naylor wrote: > > I'm thinking where the first few attributes are fixed length, not null, and > > (because of AIX) not double-aligned, we can do a single memcpy on multiple > > columns at once.

Re: pg_tablespace_location() failure with allow_in_place_tablespaces

2022-07-22 Thread Alvaro Herrera
On 2022-Jul-22, Thomas Munro wrote: > Thanks. Pushed. Also CC'ing Alvaro who expressed an interest in this > problem[1]. > [1] https://postgr.es/m/2022072751.x7hod2xgrd76xr5c%40alvherre.pgsql Yay! Thanks. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/

Re: Fast COPY FROM based on batch insert

2022-07-22 Thread Andrey Lepikhov
On 7/20/22 13:10, Etsuro Fujita wrote: On Tue, Jul 19, 2022 at 6:35 PM Andrey Lepikhov wrote: On 18/7/2022 13:22, Etsuro Fujita wrote: I rewrote the decision logic to something much simpler and much less invasive, which reduces the patch size significantly. Attached is an updated patch.

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

2022-07-22 Thread Kyotaro Horiguchi
At Fri, 22 Jul 2022 11:11:23 +0530, Amit Kapila wrote in > Hmm, I think that sounds more complicated than what I expected. I > suggest let's go with a simple idea of using a boolean not_ready which > will decide whether to use the additional key to search. I feel we can > extend it by using a

Re: Strange failures on chipmunk

2022-07-22 Thread Michael Paquier
On Fri, Jul 22, 2022 at 04:35:30PM +1200, Thomas Munro wrote: > I noticed another (presumed) Raspberry Pi apparently behaving > strangely at the storage level (guessing it's a Pi by the armv7l > architecture): dangomushi appears to get files mixed up. Here it is > trying to compile a log file

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

2022-07-22 Thread Masahiko Sawada
On Wed, Jul 20, 2022 at 5:50 PM Amit Kapila wrote: > > On Wed, Jul 20, 2022 at 1:28 PM Masahiko Sawada wrote: > > > > On Wed, Jul 20, 2022 at 2:19 PM Amit Kapila wrote: > > > > > > On Wed, Jul 20, 2022 at 9:01 AM Masahiko Sawada > > > wrote: > > > > > > > Another idea would be to have

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

2022-07-22 Thread Kyotaro Horiguchi
At Fri, 22 Jul 2022 10:00:34 +0900, Michael Paquier wrote in > 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