Re: vac_truncate_clog()'s bogus check leads to bogusness

2023-06-22 Thread Noah Misch
On Thu, Jun 22, 2023 at 09:45:18AM -0700, Andres Freund wrote: > On 2023-06-21 21:50:39 -0700, Noah Misch wrote: > > On Wed, Jun 21, 2023 at 03:12:08PM -0700, Andres Freund wrote: > > > When vac_truncate_clog() returns early > > ... > > > we haven't released the lwlock that we acquired earlier > >

Re: Improve logging when using Huge Pages

2023-06-22 Thread Michael Paquier
On Tue, Jun 20, 2023 at 06:44:20PM -0500, Justin Pryzby wrote: > On Tue, Jun 13, 2023 at 02:50:30PM +0900, Michael Paquier wrote: >> On Mon, Jun 12, 2023 at 02:37:15PM -0700, Nathan Bossart wrote: >> > Fair enough. I know I've been waffling in the GUC versus function >> > discussion, but FWIW v7

Re: Deleting prepared statements from libpq.

2023-06-22 Thread Michael Paquier
On Tue, Jun 20, 2023 at 01:42:13PM +0200, Jelte Fennema wrote: Thanks for updating the patch. > On Tue, 20 Jun 2023 at 06:18, Michael Paquier wrote: >> The amount of duplication between the describe and close paths >> concerns me a bit. Should PQsendClose() and PQsendDescribe() be >> merged

Re: Preventing non-superusers from altering session authorization

2023-06-22 Thread Michał Kłeczek
Hi, I’ve just stumbled upon this patch and thread and thought I could share an idea of adding an optional temporary secret to SET SESSION AUTHORIZATION so that it is only possible to RESET SESSION AUTHORIZATION by providing the same secret ,like: SET SESSION AUTHORIZATION [role] GUARDED BY

Re: Skip collecting decoded changes of already-aborted transactions

2023-06-22 Thread Dilip Kumar
On Fri, Jun 9, 2023 at 10:47 AM Masahiko Sawada wrote: > > Hi, > > In logical decoding, we don't need to collect decoded changes of > aborted transactions. While streaming changes, we can detect > concurrent abort of the (sub)transaction but there is no mechanism to > skip decoding changes of

Things I don't like about \du's "Attributes" column

2023-06-22 Thread Tom Lane
Nearby I dissed psql's \du command for its incoherent "Attributes" column [1]. It's too late to think about changing that for v16, but here's some things I think we should consider for v17: * It seems weird that some attributes are described in the negative ("Cannot login", "No inheritance"). I

Re: psql: Add role's membership options to the \du+ command

2023-06-22 Thread Tom Lane
"Jonathan S. Katz" writes: > On 6/15/23 2:47 PM, David G. Johnston wrote: >> Robert - can you please comment on what you are willing to commit in >> order to close out your open item here.  My take is that the design for >> this, the tabular form a couple of emails ago (copied here), is >>

Re: Make pgbench exit on SIGINT more reliably

2023-06-22 Thread Michael Paquier
On Thu, Jun 22, 2023 at 02:58:14PM +0900, Yugo NAGATA wrote: > On Mon, 19 Jun 2023 16:49:05 -0700 > "Tristan Partin" wrote: >> On Mon Jun 19, 2023 at 6:39 AM PDT, Yugo NAGATA wrote: >>> [1] >>> https://www.postgresql.org/message-id/flat/CSTU5P82ONZ1.19XFUGHMXHBRY%40c3po >> >> The other patch

Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX

2023-06-22 Thread Nathan Bossart
On Thu, Jun 22, 2023 at 08:43:01AM -0700, Nathan Bossart wrote: > I plan to commit these patches later today. Committed. I've also marked the related open item for v16 as resolved. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com

Re: Preventing non-superusers from altering session authorization

2023-06-22 Thread Joseph Koshakow
On Wed, Jun 21, 2023 at 11:48 PM Nathan Bossart wrote: > >On Wed, Jun 21, 2023 at 04:28:43PM -0400, Joseph Koshakow wrote: >> + roleTup = SearchSysCache1(AUTHOID, ObjectIdGetDatum(AuthenticatedUserId)); >> + if (!HeapTupleIsValid(roleTup)) >> + ereport(FATAL, >

Re: Do we want a hashset type?

2023-06-22 Thread Tomas Vondra
On 6/22/23 19:52, Joel Jacobson wrote: > On Tue, Jun 20, 2023, at 14:10, Tomas Vondra wrote: >> This is also what the SQL standard does for multisets - there's SQL:20nn >> draft at http://www.wiscorp.com/SQLStandards.html, and the > predicate> section (p. 475) explains how this should work with

Re: Remove deprecation warnings when compiling PG ~13 with OpenSSL 3.0~

2023-06-22 Thread Michael Paquier
On Thu, Jun 22, 2023 at 08:08:54PM +0200, Peter Eisentraut wrote: > The message linked to above also says: > >> I'm not sure. I don't have a good sense of what OpenSSL versions we >> claim to support in branches older than PG13. We made a conscious >> decision for 1.0.1 in PG13, but I seem to

Re: pg_collation.collversion for C.UTF-8

2023-06-22 Thread Thomas Munro
On Tue, Jun 20, 2023 at 6:48 AM Jeff Davis wrote: > On Sat, 2023-06-17 at 17:54 +1200, Thomas Munro wrote: > > > Would it be correct to interpret LC_COLLATE=C.UTF-8 as > > > LC_COLLATE=C, > > > but leave LC_CTYPE=C.UTF-8 as-is? > > > > Yes. The basic idea, at least for these two OSes, is that

Re: Bytea PL/Perl transform

2023-06-22 Thread Greg Sabino Mullane
> > So I decided to propose a simple transform extension to pass bytea as > native Perl octet strings. Quick review, mostly housekeeping things: * Needs a rebase, minor failure on Mkvcbuild.pm * Code needs standardized formatting, esp. bytea_plperl.c * Needs to be meson-i-fied (i.e. add a

Re: [PATCH] pg_regress.c: Fix "make check" on Mac OS X: Pass DYLD_LIBRARY_PATH

2023-06-22 Thread David Zhang
After conducting a further investigation into this issue, I have made some discoveries. The previous patch successfully resolves the problem when running the commands `./configure && make && make check` (without any previous sudo make install or make install). However, it stops at the

Re: OK to build LLVM (*.bc) with CLANG but rest of postgresql with CC (other compiler)?

2023-06-22 Thread Andres Freund
Hi, On 2023-06-13 11:20:52 +0200, Palle Girgensohn wrote: > CLANG is used to compile *.bc files during postgresql build. Is it OK to > have a different compiler for the rest of the build? gcc, or even another > version of clang? Yes. > LLVM is an optional add-on, a package. The default version

Re: UUID v7

2023-06-22 Thread Nikolay Samokhvalov
On Tue, Feb 14, 2023 at 6:13 AM Kyzer Davis (kydavis) wrote: > I am happy to see others interested in the improvements provided by UUIDv7! Thank you for providing the details! Some small updates as I see them: - there is revision 7 now in https://github.com/ietf-wg-uuidrev/rfc4122bis - noticing

Re: Remove deprecation warnings when compiling PG ~13 with OpenSSL 3.0~

2023-06-22 Thread Peter Eisentraut
On 22.06.23 01:53, Michael Paquier wrote: Looking at the relevant thread from 2020, this was still at the point where we did not consider supporting 3.0 for all the stable branches because 3.0 was in alpha:

Re: Do we want a hashset type?

2023-06-22 Thread Joel Jacobson
On Tue, Jun 20, 2023, at 14:10, Tomas Vondra wrote: > This is also what the SQL standard does for multisets - there's SQL:20nn > draft at http://www.wiscorp.com/SQLStandards.html, and the predicate> section (p. 475) explains how this should work with NULL. I've looked again at the paper you

Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges

2023-06-22 Thread Tom Lane
=?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= writes: > Tom Lane writes: >> (Don't we have existing precedents that apply here? I can't offhand >> think of any existing ALTER commands that would reject no-op requests, >> but maybe that's not a direct precedent.) > Since it only supports adding

Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges

2023-06-22 Thread Dagfinn Ilmari Mannsåker
Tom Lane writes: > Tommy Pavlicek writes: > >> Additionally, I wasn't sure whether it was preferred to fail or succeed on >> ALTERs that have no effect, such as adding hashes on an operator that >> already allows them or disabling hashes on one that does not. I chose to >> raise an error when

Re: [PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges

2023-06-22 Thread Tom Lane
Tommy Pavlicek writes: > I've attached a couple of patches to allow ALTER OPERATOR to add > commutators, negators, hashes and merges to operators that lack them. Please add this to the upcoming commitfest [1], to ensure we don't lose track of it. > The first patch is create_op_fixes_v1.patch

Re: vac_truncate_clog()'s bogus check leads to bogusness

2023-06-22 Thread Andres Freund
Hi, On 2023-06-21 21:50:39 -0700, Noah Misch wrote: > On Wed, Jun 21, 2023 at 03:12:08PM -0700, Andres Freund wrote: > > When vac_truncate_clog() returns early > ... > > we haven't released the lwlock that we acquired earlier > > > Until there's some cause for the session to call

Re: Assert while autovacuum was executing

2023-06-22 Thread Andres Freund
Hi, On 2023-06-22 10:00:01 +0530, Amit Kapila wrote: > On Wed, Jun 21, 2023 at 11:53 AM Peter Geoghegan wrote: > > > > On Tue, Jun 20, 2023 at 10:27 PM Andres Freund wrote: > > > As far as I can tell 72e78d831a as-is is just bogus. Unfortunately that > > > likely > > > also means 3ba59ccc89 is

[PATCH] Extend ALTER OPERATOR to support adding commutator, negator, hashes, and merges

2023-06-22 Thread Tommy Pavlicek
Hi All, I've attached a couple of patches to allow ALTER OPERATOR to add commutators, negators, hashes and merges to operators that lack them. The need for this arose adding hash functions to the ltree type after the operator had been created without hash support[1]. There are potential issues

Re: New function to show index being vacuumed

2023-06-22 Thread Imseih (AWS), Sami
> I'm sorry for not having read (and not reading) the other thread yet, > but what was the reason we couldn't store that oid in a column in the > pg_s_p_vacuum-view? > Could you summarize the other solutions that were considered for this issue? Thanks for your feedback! The reason we cannot

Re: New function to show index being vacuumed

2023-06-22 Thread Matthias van de Meent
On Thu, 22 Jun 2023 at 16:45, Imseih (AWS), Sami wrote: > > Hi, > > [1] is a ready-for-committer enhancement to pg_stat_progress_vacuum which > exposes > the total number of indexes to vacuum and how many indexes have been vacuumed > in > the current vacuum cycle. > > To even further improve

Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX

2023-06-22 Thread Nathan Bossart
On Thu, Jun 22, 2023 at 04:11:08PM +0900, Michael Paquier wrote: > Sounds good to me. Thanks. I plan to commit these patches later today. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com

New function to show index being vacuumed

2023-06-22 Thread Imseih (AWS), Sami
Hi, [1] is a ready-for-committer enhancement to pg_stat_progress_vacuum which exposes the total number of indexes to vacuum and how many indexes have been vacuumed in the current vacuum cycle. To even further improve visibility into index vacuuming, it would be beneficial to have a function

Re: memory leak in trigger handling (since PG12)

2023-06-22 Thread Tomas Vondra
On 6/22/23 13:46, Tomas Vondra wrote: > ... > > I haven't tried the reproducer, but I think I see the issue - we store > the bitmap as part of the event to be executed later, but the bitmap is > in per-tuple context and gets reset. So I guess we need to copy it into > the proper long-lived

Re: Add GUC to tune glibc's malloc implementation.

2023-06-22 Thread Tom Lane
Ronan Dunklau writes: > Le jeudi 22 juin 2023, 15:49:36 CEST Tom Lane a écrit : >> Aren't these same settings controllable via environment variables? >> I could see adding some docs suggesting that you set thus-and-such >> values in the postmaster's startup script. Admittedly, the confusion >>

Re: bgwriter doesn't flush WAL stats

2023-06-22 Thread Melanie Plageman
On Wed, Jun 21, 2023 at 9:49 PM Kyotaro Horiguchi wrote: > Regarding the second patch, it introduces WAL IO time as a > IOCONTEXT_NORMAL/IOOBJECT_WAL, but it doesn't seem to follow the > convention or design of the pgstat_io component, which primarily > focuses on shared buffer IOs. I haven't

Re: Add GUC to tune glibc's malloc implementation.

2023-06-22 Thread Ronan Dunklau
Le jeudi 22 juin 2023, 15:49:36 CEST Tom Lane a écrit : > This seems like a pretty awful idea, mainly because there's no way > to have such a GUC mean anything on non-glibc platforms, which is > going to cause confusion or worse. I named the GUC glibc_malloc_max_trim_threshold, I hope this is

Re: Add GUC to tune glibc's malloc implementation.

2023-06-22 Thread Tom Lane
Ronan Dunklau writes: > Following some conversation with Tomas at PGCon, I decided to resurrect this > topic, which was previously discussed in the context of moving tuplesort to > use GenerationContext: https://www.postgresql.org/message-id/ > 8046109.NyiUUSuA9g%40aivenronan This seems like a

Add GUC to tune glibc's malloc implementation.

2023-06-22 Thread Ronan Dunklau
Hello, Following some conversation with Tomas at PGCon, I decided to resurrect this topic, which was previously discussed in the context of moving tuplesort to use GenerationContext: https://www.postgresql.org/message-id/ 8046109.NyiUUSuA9g%40aivenronan The idea for this patch is that the

Re: Making empty Bitmapsets always be NULL

2023-06-22 Thread Ranier Vilela
Em qui., 22 de jun. de 2023 às 01:43, David Rowley escreveu: > On Thu, 22 Jun 2023 at 00:16, Ranier Vilela wrote: > > 2. Only compute BITNUM when necessary. > > I doubt this will help. The % 64 done by BITNUM will be transformed > to an AND operation by the compiler which is likely going to be

Re: memory leak in trigger handling (since PG12)

2023-06-22 Thread Tomas Vondra
On 6/22/23 13:07, Alexander Pyhalov wrote: > Tomas Vondra писал 2023-05-25 17:41: > >> The attached patch does this - I realized we actually have estate in >> ExecGetAllUpdatedCols(), so we don't even need a variant with a >> different signature. That makes the patch much simpler. >> >> The

Re: Partial aggregates pushdown

2023-06-22 Thread Bruce Momjian
On Thu, Jun 22, 2023 at 05:23:33AM +, fujii.y...@df.mitsubishielectric.co.jp wrote: > Approach1-3: > I will add a postgres_fdw option "check_partial_aggregate_support". > This option is false, default. > Only if this option is true, postgres_fdw connect to the remote server and > get the

Re: memory leak in trigger handling (since PG12)

2023-06-22 Thread Alexander Pyhalov
Tomas Vondra писал 2023-05-25 17:41: The attached patch does this - I realized we actually have estate in ExecGetAllUpdatedCols(), so we don't even need a variant with a different signature. That makes the patch much simpler. The question is whether we need the signature anyway. There might be

Re: Support logical replication of DDLs

2023-06-22 Thread Amit Kapila
On Tue, Jun 13, 2023 at 1:21 PM Michael Paquier wrote: > > The patch is made of a lot of one-one mapping between enum structures > and hardcoded text used in the JSON objects, making it something hard > to maintain if a node field is added, removed or even updated into > something else. I have

Re: Support logical replication of DDLs

2023-06-22 Thread shveta malik
On Wed, Jun 21, 2023 at 6:38 PM Jelte Fennema wrote: > > (to be clear I only skimmed the end of this thread and did not look at > all the previous messages) > > I took a quick look at the first patch (about deparsing table ddl) and > it seems like this would also be very useful for a SHOW CREATE

Re: Skip collecting decoded changes of already-aborted transactions

2023-06-22 Thread Amit Kapila
On Wed, Jun 21, 2023 at 8:12 AM Masahiko Sawada wrote: > > On Thu, Jun 15, 2023 at 7:50 PM Amit Kapila wrote: > > > > On Tue, Jun 13, 2023 at 2:06 PM Masahiko Sawada > > wrote: > > > > > > On Sun, Jun 11, 2023 at 5:31 AM Andres Freund wrote: > > > > > > > > A separate issue is that

Re: Making empty Bitmapsets always be NULL

2023-06-22 Thread Yuya Watari
Hello, On Tue, Jun 20, 2023 at 1:17 PM David Rowley wrote: > I've adjusted the attached patch to do that. Thank you for updating the patch. The v4 patch looks good to me. I ran another experiment. In the experiment, I issued queries of the Join Order Benchmark [1] and measured its planning

Re: Making empty Bitmapsets always be NULL

2023-06-22 Thread Yuya Watari
Hello, On Thu, Jun 22, 2023 at 1:43 PM David Rowley wrote: > > 3. Avoid enlargement when nwords is equal wordnum. > > Can save cycles when in corner cases? > > No, you're just introducing a bug here. Arrays in C are zero-based, > so "wordnum >= a->nwords" is exactly the correct way to

Re: Remove deprecation warnings when compiling PG ~13 with OpenSSL 3.0~

2023-06-22 Thread Michael Paquier
On Thu, Jun 22, 2023 at 10:02:58AM +0200, Daniel Gustafsson wrote: > These patches LGTM from reading, Thanks for double-checking. > but I think the Discussion link in the commit > messages should refer to this thread as well. Of course. -- Michael signature.asc Description: PGP signature

Re: Remove deprecation warnings when compiling PG ~13 with OpenSSL 3.0~

2023-06-22 Thread Daniel Gustafsson
> On 22 Jun 2023, at 01:53, Michael Paquier wrote: > I have tested the attached patches across 11~13 with various versions > of OpenSSL (OPENSSL_API_COMPAT exists since 1.1.0), and this is > working here. Note that I don't have a MSVC environment at hand to > test this change on Windows, still

Re: Allow pg_archivecleanup to remove backup history files

2023-06-22 Thread Kyotaro Horiguchi
At Wed, 21 Jun 2023 23:41:33 +0900, torikoshia wrote in > --v10-0002-Preliminary-refactoring-for-a-subsequent-patch.patch > + * Also we skip backup history files when --clean-backup-history > +* is not specified. > +*/ > + if (!IsXLogFileName(walfile) &&

Re: Can JoinFilter condition be pushed down into IndexScan?

2023-06-22 Thread Bəxtiyar Neyman
Thanks, Tomas! > I know, but it makes them harder to read for people. If you want people > to respond it's generally a good idea to make it easy to understand the > question. Don't make them waste their time - they'll just skip the > message entirely. Fair point. > So, the optimizer clearly

Re: Can JoinFilter condition be pushed down into IndexScan?

2023-06-22 Thread Bəxtiyar Neyman
Thanks Tomas for the lengthy write-up! Pardon the noise in the queries (LATERAL, AND true etc): they were autogenerated by the library we wrote. > Because those queries are not doing the same thing. In the first query > you sort by t3_0 columns, while the "id = 4732455" condition is on the >

Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG

2023-06-22 Thread Heikki Linnakangas
On 21/06/2023 01:02, Joe Conway wrote: On 6/19/23 19:30, Heikki Linnakangas wrote: On 18/06/2023 21:27, Joe Conway wrote: With the patch you're proposing, do we now have a coding rule that you must call "uselocale(LC_GLOBAL_LOCALE)" before every and any call to setlocale()? If so, you missed a

Re: allow granting CLUSTER, REFRESH MATERIALIZED VIEW, and REINDEX

2023-06-22 Thread Michael Paquier
On Wed, Jun 21, 2023 at 08:06:06PM -0700, Nathan Bossart wrote: > On Thu, Jun 22, 2023 at 10:46:41AM +0900, Michael Paquier wrote: >> - /* >> -* We already checked that the user has privileges to CLUSTER the >> -* partitioned table when we locked it earlier, so there's no

Re: [DOC] Update ALTER SUBSCRIPTION documentation v3

2023-06-22 Thread Amit Kapila
On Tue, Jun 20, 2023 at 9:02 AM Peter Smith wrote: > > FYI - I have created and tested back-patches for Amit's v5 patch, > going all the way to REL_10_STABLE. > Pushed. I haven't used PG10 patch as REL_10_STABLE is out of support now. -- With Regards, Amit Kapila.

Re: ProcessStartupPacket(): database_name and user_name truncation

2023-06-22 Thread Drouvot, Bertrand
Hi, On 6/22/23 1:37 AM, Michael Paquier wrote: On Wed, Jun 21, 2023 at 12:55:15PM -0700, Nathan Bossart wrote: LGTM. I think this can wait for v17 since the current behavior has been around since 2001 and AFAIK this is the first report. While it's arguably a bug fix, the patch also breaks