Re: [PATCH] Add inline comments to the pg_hba_file_rules view

2023-09-15 Thread Michael Paquier
On Fri, Sep 15, 2023 at 09:37:23AM +0200, Jim Jones wrote: > SELECT type, database, user_name, address, c.comment > FROM  pg_hba_file_rules h, pg_read_conf_comments(h.file_name) c > WHERE user_name[1]='jim' AND h.line_number = c.line_number ; > >  type | database | user_name |  address  | comment

Re: JSON Path and GIN Questions

2023-09-15 Thread Erik Rijkers
Op 9/15/23 om 22:27 schreef David E. Wheeler: On Sep 12, 2023, at 21:00, Erik Wienhold wrote: That's also my understanding. We had a discussion about the docs on @@, @?, and jsonb_path_query on -general a while back [1]. Maybe it's useful also. Okay, I’ll take a pass at expanding the docs

Re: Add 'worker_type' to pg_stat_subscription

2023-09-15 Thread Michael Paquier
On Fri, Sep 15, 2023 at 09:35:38AM -0700, Nathan Bossart wrote: > Concretely, like this. There are two references to "synchronization worker" in tablesync.c (exit routine and busy loop), and a bit more of "sync worker".. Anyway, these don't matter much, but there are two errmsgs where the term

Re: [PoC] Improve dead tuple storage for lazy vacuum

2023-09-15 Thread Andres Freund
Hi, On 2023-08-28 23:43:22 +0900, Masahiko Sawada wrote: > I've attached v42 patch set. I improved tidstore regression test codes > in addition of imcorporating the above comments. Why did you need to disable the benchmark module for CI? Greetings, Andres Freund

Re: Performance degradation on concurrent COPY into a single relation in PG16.

2023-09-15 Thread Andres Freund
Hi, On 2023-09-06 18:01:53 -0400, Tom Lane wrote: > It turns out that this patch is what's making buildfarm member > chipmunk fail in contrib/pg_visibility [1]. That's easily reproduced > by running the test with shared_buffers = 10MB. I didn't dig further > than the "git bisect" result: At

Re: SET ROLE documentation improvement

2023-09-15 Thread Yurii Rashkovskii
On Fri, Sep 15, 2023 at 1:47 PM Nathan Bossart wrote: > On Fri, Sep 15, 2023 at 11:26:16AM -0700, Yurii Rashkovskii wrote: > > I believe SET ROLE documentation makes a slightly incomplete statement > > about what happens when a superuser uses SET ROLE. > > > > The documentation reading suggests

Re: ALTER ROLE documentation improvement

2023-09-15 Thread Yurii Rashkovskii
On Fri, Sep 15, 2023 at 1:53 PM Nathan Bossart wrote: > On Fri, Sep 15, 2023 at 11:46:35AM -0700, Yurii Rashkovskii wrote: > > It appears that 16.0 improved some of the checks in ALTER ROLE. > Previously, > > it was possible to do the following (assuming current_user is a bootstrap > > user): >

Re: JSON Path and GIN Questions

2023-09-15 Thread Tom Lane
"David E. Wheeler" writes: > On Sep 14, 2023, at 00:41, Tom Lane wrote: >> As far as json in particular is concerned, 8.14.4 jsonb Indexing [4] >> is pretty clear about what is or is not supported. > How do you feel about this note, then? I think it's unnecessary. If we did consider it

Re: ALTER ROLE documentation improvement

2023-09-15 Thread Nathan Bossart
On Fri, Sep 15, 2023 at 11:46:35AM -0700, Yurii Rashkovskii wrote: > It appears that 16.0 improved some of the checks in ALTER ROLE. Previously, > it was possible to do the following (assuming current_user is a bootstrap > user): > > ``` > ALTER ROLE current_user NOSUPERUSER > ``` > > As of

Re: SET ROLE documentation improvement

2023-09-15 Thread Nathan Bossart
On Fri, Sep 15, 2023 at 11:26:16AM -0700, Yurii Rashkovskii wrote: > I believe SET ROLE documentation makes a slightly incomplete statement > about what happens when a superuser uses SET ROLE. > > The documentation reading suggests that the superuser would lose all their > privileges. However,

semantics of "convenient to store" in FmgrInfo ?

2023-09-15 Thread Chapman Flack
Hi, At one time 12 years ago, fn_collation was stored in FmgrInfo, with a comment saying it was really "parse-time-determined information about the arguments, rather than about the function itself" but saying "it's convenient" to store it in FmgrInfo rather than in FunctionCallInfoData. But in

Re: JSON Path and GIN Questions

2023-09-15 Thread David E. Wheeler
On Sep 12, 2023, at 21:00, Erik Wienhold wrote: > That's also my understanding. We had a discussion about the docs on @@, @?, > and > jsonb_path_query on -general a while back [1]. Maybe it's useful also. Okay, I’ll take a pass at expanding the docs on this. I think a little mini-tutorial

Re: JSON Path and GIN Questions

2023-09-15 Thread David E. Wheeler
On Sep 14, 2023, at 00:41, Tom Lane wrote: > As far as json in particular is concerned, 8.14.4 jsonb Indexing [4] > is pretty clear about what is or is not supported. How do you feel about this note, then? diff --git a/doc/src/sgml/json.sgml b/doc/src/sgml/json.sgml index

Re: Detoasting optionally to make Explain-Analyze less misleading

2023-09-15 Thread stepan rutz
Hi, please see a revised version yesterday's mail. The patch attached now provides the following: EXPLAIN(ANALYZE,SERIALIZE) and EXPLAIN(ANALYZE,SERIALIZEBINARY) and timing output. Both options perform the serialization during analyze and provide an additional output in the plan like this:

ALTER ROLE documentation improvement

2023-09-15 Thread Yurii Rashkovskii
Hi, It appears that 16.0 improved some of the checks in ALTER ROLE. Previously, it was possible to do the following (assuming current_user is a bootstrap user): ``` ALTER ROLE current_user NOSUPERUSER ``` As of 16.0, this produces an error: ``` ERROR: permission denied to alter role DETAIL:

Re: Faster "SET search_path"

2023-09-15 Thread Jeff Davis
On Tue, 2023-09-12 at 13:55 -0700, Jeff Davis wrote: > On Mon, 2023-08-07 at 15:39 -0700, Nathan Bossart wrote: > > 0003 is looking pretty good, too, but I think we > > should get some more eyes on it, given the complexity. > > Attached rebased version of 0003. Is someone else planning to look

SET ROLE documentation improvement

2023-09-15 Thread Yurii Rashkovskii
Hi, I believe SET ROLE documentation makes a slightly incomplete statement about what happens when a superuser uses SET ROLE. The documentation reading suggests that the superuser would lose all their privileges. However, they still retain the ability to use `SET ROLE` again. The attached patch

Re: Small patch modifying variable name to reflect the logic involved

2023-09-15 Thread Daniel Gustafsson
> On 14 Sep 2023, at 11:30, Daniel Gustafsson wrote: > >> On 14 Sep 2023, at 08:28, Krishnakumar R wrote: > >> Please find a small patch to improve code readability by modifying >> variable name to reflect the logic involved - finding diff between end >> and start time of WAL sync. > > -

Re: Add 'worker_type' to pg_stat_subscription

2023-09-15 Thread Nathan Bossart
On Thu, Sep 14, 2023 at 03:04:19PM -0700, Nathan Bossart wrote: > The only reason I didn't apply this already is because IMHO we should > adjust the worker types and the documentation for the view to be > consistent. For example, the docs say "leader apply worker" but the view > just calls them

Re: Implement a column store for pg?

2023-09-15 Thread Jonah H. Harris
On Fri, Sep 15, 2023 at 10:21 AM jacktby jacktby wrote: > > I’m trying to implement a new column store for pg, is there a good > example to reference? > That’s too complex, I just need to know the interface about design a > column store. In fact, I just need a simple example, and I will

Re: Make --help output fit within 80 columns per line

2023-09-15 Thread torikoshia
On 2023-09-12 15:27, Peter Eisentraut wrote: Also, it would be very useful if the TAP test function could print out the violating lines if a test fails. (Similar to how is() and like() print the failing values.) Attached patch for this. Below are the the outputs when test failed: ``` $ cd

Re: Unlogged relations and WAL-logging

2023-09-15 Thread Heikki Linnakangas
On 01/09/2023 15:49, Peter Eisentraut wrote: Is the patch 0003-Remove-unnecessary-smgrimmedsync-when-creating-unlog.patch still relevant, or can this commitfest entry be closed? Yes. Pushed it now, thanks! -- Heikki Linnakangas Neon (https://neon.tech)

Re: bug fix and documentation improvement about vacuumdb

2023-09-15 Thread Nathan Bossart
On Fri, Sep 15, 2023 at 10:13:10AM +0200, Daniel Gustafsson wrote: >> On 15 Sep 2023, at 04:39, Kyotaro Horiguchi wrote: >> It seems to work fine. However, if we're aiming for consistent >> spacing, the "IS NULL" (two spaces in between) might be an concern. > > I don't think that's a problem. I

Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set

2023-09-15 Thread Daniel Gustafsson
> On 15 Sep 2023, at 16:38, Nathan Bossart wrote: > this should use errdetail() instead of errhint(). In > the provided patch, the new message explains how the module is not > configured. It doesn't hint at how to fix it (although presumably one > could figure that out pretty easily). Fair

Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set

2023-09-15 Thread Nathan Bossart
On Fri, Sep 15, 2023 at 02:48:55PM +0200, Daniel Gustafsson wrote: >> On 15 Sep 2023, at 12:49, Alvaro Herrera wrote: >> >> On 2023-Sep-15, Daniel Gustafsson wrote: >> >>> -basic_archive_configured(ArchiveModuleState *state) >>> +basic_archive_configured(ArchiveModuleState *state, const char

Re: pgBufferUsage.blk_{read|write}_time are zero although there are pgBufferUsage.local_blks_{read|written}

2023-09-15 Thread Melanie Plageman
On Fri, Sep 15, 2023 at 9:24 AM Nazir Bilal Yavuz wrote: > I found that pgBufferUsage.blk_{read|write}_time are zero although there are > pgBufferUsage.local_blks_{read|written} Yes, good catch. This is a bug. I will note that at least in 15 and likely before, pgBufferUsage.local_blks_written

Re: sslinfo extension - add notbefore and notafter timestamps

2023-09-15 Thread Daniel Gustafsson
> On 12 Sep 2023, at 21:40, Jacob Champion wrote: > > Hello, > > On 7/25/23 07:21, Daniel Gustafsson wrote: >> The attached version passes ssl tests for me on 1.0.2 through OpenSSL Git >> HEAD. > > Tests pass for me too, including LibreSSL 3.8. Thanks for testing! >> + /* Calculate the

Re: Implement a column store for pg?

2023-09-15 Thread jacktby jacktby
> 2023年9月15日 20:31,jacktby jacktby 写道: > > I’m trying to implement a new column store for pg, is there a good example to > reference? That’s too complex, I just need to know the interface about design a column store. In fact, I just need a simple example, and I will implement it by myself,

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

2023-09-15 Thread Hayato Kuroda (Fujitsu)
> Thank you for reviewing! PSA new version patch set. Sorry, wrong patch attached. PSA the correct ones. There is a possibility that XLOG_PARAMETER_CHANGE may be generated, when GUC parameters are changed just before doing the upgrade. Added to list. Best Regards, Hayato Kuroda FUJITSU LIMITED

Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set

2023-09-15 Thread Daniel Gustafsson
> On 15 Sep 2023, at 12:49, Alvaro Herrera wrote: > > On 2023-Sep-15, Daniel Gustafsson wrote: > >> -basic_archive_configured(ArchiveModuleState *state) >> +basic_archive_configured(ArchiveModuleState *state, const char **errmsg) >> >> The variable name errmsg implies that it will contain the

Re: Implement a column store for pg?

2023-09-15 Thread Daniel Gustafsson
> On 15 Sep 2023, at 14:31, jacktby jacktby wrote: > > I’m trying to implement a new column store for pg, is there a good example to > reference? There are open-source forks of postgres that have column-stores, like Greenplum for example. Be sure to check the license and existence of any

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

2023-09-15 Thread Hayato Kuroda (Fujitsu)
Dear Amit, Thank you for reviewing! PSA new version patch set. > Few comments: > 1. Why is the FPI record (XLOG_FPI_FOR_HINT) not considered a record > to be ignored? This can be generated during reading system tables. Oh, I just missed. Written in comments atop the function, but not added

Implement a column store for pg?

2023-09-15 Thread jacktby jacktby
I’m trying to implement a new column store for pg, is there a good example to reference?

Re: POC: Extension for adding distributed tracing - pg_tracing

2023-09-15 Thread Nikita Malakhov
Hi! Great you continue to work on this patch! I'm checking out the newest changes. On Fri, Sep 15, 2023 at 2:32 PM Aleksander Alekseev < aleksan...@timescale.com> wrote: > Hi, > > > Renaming/Refactoring: > > - All spans are now tracked in the palloced current_trace_spans buffer > > compared to

Re: POC: Extension for adding distributed tracing - pg_tracing

2023-09-15 Thread Aleksander Alekseev
Hi, > Renaming/Refactoring: > - All spans are now tracked in the palloced current_trace_spans buffer > compared to top_span and parse_span being kept in a static variable > before. > - I've renamed query_spans to top_span. A top_span serves as the > parent for all spans in a specific nested

Re: Unlogged relation copy is not fsync'd

2023-09-15 Thread Heikki Linnakangas
On 05/09/2023 21:20, Robert Haas wrote: In other words, somehow it feels like we ought to be trying to defer the fsync here until a clean shutdown actually occurs, instead of performing it immediately. +1 Admittedly, the bookkeeping seems like a problem, so maybe this is the best we can do,

Re: Unlogged relation copy is not fsync'd

2023-09-15 Thread Heikki Linnakangas
On 04/09/2023 16:59, Melanie Plageman wrote: The patch looks reasonable to me. Is this [1] case in hash index build that I reported but didn't take the time to reproduce similar? [1]

Re: pg_upgrade and logical replication

2023-09-15 Thread vignesh C
On Fri, 15 Sept 2023 at 15:08, vignesh C wrote: > > On Tue, 12 Sept 2023 at 14:25, Hayato Kuroda (Fujitsu) > wrote: > > > > Dear Vignesh, > > > > Thank you for updating the patch! Here are some comments. > > > > Sorry if there are duplicate comments - the thread revived recently so I > > might

Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set

2023-09-15 Thread Alvaro Herrera
On 2023-Sep-15, Daniel Gustafsson wrote: > -basic_archive_configured(ArchiveModuleState *state) > +basic_archive_configured(ArchiveModuleState *state, const char **errmsg) > > The variable name errmsg implies that it will contain the errmsg() data when > it > in fact is used for errhint() data,

Re: Speed up transaction completion faster after many relations are accessed in a transaction

2023-09-15 Thread Heikki Linnakangas
On 11/09/2023 15:00, David Rowley wrote: On Wed, 5 Jul 2023 at 21:44, Heikki Linnakangas wrote: index 296dc82d2ee..edb8b6026e5 100644 --- a/src/backend/commands/discard.c +++ b/src/backend/commands/discard.c @@ -71,7 +71,7 @@ DiscardAll(bool isTopLevel) Async_UnlistenAll(); -

Re: psql: Add command to use extended query protocol

2023-09-15 Thread Alvaro Herrera
On 2023-Sep-14, Tobias Bussmann wrote: > In one of my environments, this feature didn't work as expected. > Digging into it, I found that it is incompatible with FETCH_COUNT > being set. Sorry for not recognising this during the betas. > > Attached a simple patch with tests running the cursor

Re: POC PATCH: copy from ... exceptions to: (was Re: VLDB Features)

2023-09-15 Thread Damir Belyalov
> Since v5 patch failed applying anymore, updated the patch. Thank you for updating the patch . I made a little review on it where corrected some formatting. > - COPY with a datatype error that can't be handled as a soft error > > I didn't know proper way to test this, but I've found data type

Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set

2023-09-15 Thread Daniel Gustafsson
> On 15 Sep 2023, at 11:38, bt23nguyent wrote: > > Hi, > > When archive_library is set to 'basic_archive' but > basic_archive.archive_directory is not set, WAL archiving doesn't work and > only the following warning message is logged. > >$ emacs $PGDATA/postgresql.conf >archive_mode

pgBufferUsage.blk_{read|write}_time are zero although there are pgBufferUsage.local_blks_{read|written}

2023-09-15 Thread Nazir Bilal Yavuz
Hi, I found that pgBufferUsage.blk_{read|write}_time are zero although there are pgBufferUsage.local_blks_{read|written}. For example, when you run (track_io_timing should be on): CREATE EXTENSION pg_stat_statements; CREATE TEMP TABLE example_table (id serial PRIMARY KEY, data text); INSERT INTO

Re: pg_upgrade and logical replication

2023-09-15 Thread vignesh C
On Tue, 12 Sept 2023 at 18:52, Zhijie Hou (Fujitsu) wrote: > > On Monday, September 11, 2023 6:32 PM vignesh C wrote: > > > > > > The attached v7 patch has the changes for the same. > > Thanks for updating the patch, here are few comments: > > > 1. > > +/* > + *

Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set

2023-09-15 Thread bt23nguyent
Hi, When archive_library is set to 'basic_archive' but basic_archive.archive_directory is not set, WAL archiving doesn't work and only the following warning message is logged. $ emacs $PGDATA/postgresql.conf archive_mode = on archive_library = 'basic_archive' $ bin/pg_ctl -D

Re: pg_upgrade and logical replication

2023-09-15 Thread vignesh C
On Tue, 12 Sept 2023 at 14:25, Hayato Kuroda (Fujitsu) wrote: > > Dear Vignesh, > > Thank you for updating the patch! Here are some comments. > > Sorry if there are duplicate comments - the thread revived recently so I might > lose my memory. > > 01. General > > Is there a possibility that apply

Re: Possibility to disable `ALTER SYSTEM`

2023-09-15 Thread Daniel Gustafsson
> On 11 Sep 2023, at 15:50, Magnus Hagander wrote: > > On Sat, Sep 9, 2023 at 5:14 PM Alvaro Herrera wrote: >> >> On 2023-Sep-08, Magnus Hagander wrote: >> >>> Now, it might be that you don't care at all about the *security* side >>> of the feature, and only care about the convenience side.

Re: Possibility to disable `ALTER SYSTEM`

2023-09-15 Thread Gabriele Bartolini
Hi Greg, On Wed, 13 Sept 2023 at 19:10, Greg Sabino Mullane wrote: > Seems to be some resistance to getting this in core, so why not just use > an extension? I was able to create a quick POC to do just that. Hook into > PG and look for AlterSystemStmt, throw a "Sorry, ALTER SYSTEM is not >

Re: Synchronizing slots from primary to standby

2023-09-15 Thread Peter Smith
Hi. Here are some review comments for v17-0002. This is a WIP and a long way from complete, but I wanted to send what I have so far (while it is still current with your latest posted patches). == 1. GENERAL - loop variable declaration There are some code examples like below where the loop

Re: bug fix and documentation improvement about vacuumdb

2023-09-15 Thread Daniel Gustafsson
> On 15 Sep 2023, at 04:39, Kyotaro Horiguchi wrote: > At Thu, 14 Sep 2023 07:57:57 -0700, Nathan Bossart > wrote in >> Yeah, I think we can fix the JOIN as you suggest. I quickly put a patch >> together to demonstrate. Looks good from a quick skim. >> We should probably add some

Re: [PATCH] Add inline comments to the pg_hba_file_rules view

2023-09-15 Thread Jim Jones
On 15.09.23 01:28, Michael Paquier wrote: Yes, my suggestion was to define a new set-returning function that takes in input a file path and that returns as one row one comment and its line number from the configuration file. -- Michael Thanks! If reading the file again is an option, perhaps a

Re: BufferUsage counters' values have changed

2023-09-15 Thread Karina Litskevich
Nazir, Andres, thank you both for help! On Wed, Sep 13, 2023 at 10:10 PM Andres Freund wrote: > On 2023-09-13 16:04:00 +0300, Nazir Bilal Yavuz wrote: > > local_blks_read became zero because: > > 1_ One more cache hit. It was supposed to be local_blks_read but it is > > local_blks_hit now. This

Re: make add_paths_to_append_rel aware of startup cost

2023-09-15 Thread David Rowley
On Thu, 7 Sept 2023 at 04:37, Andy Fan wrote: > Currently add_paths_to_append_rel overlooked the startup cost for creating > append path, so it may have lost some optimization chances. After a glance, > the following 4 identifiers can be impacted. > - We shouldn't do the optimization if there

Re: RFC: Logging plan of the running query

2023-09-15 Thread Lepikhov Andrei
On Thu, Sep 7, 2023, at 1:09 PM, torikoshia wrote: > On 2023-09-06 11:17, James Coleman wrote: > It seems that we can know what queries were running from the stack > traces you shared. > As described above, I suspect a lock which was acquired prior to > ProcessLogQueryPlanInterrupt() caused the

Re: Bug fix for psql's meta-command \ev

2023-09-15 Thread Kyotaro Horiguchi
At Fri, 15 Sep 2023 11:37:46 +0900, Ryoga Yoshida wrote in > I think this is a bug in psql's \ev meta-command. Even when \ev fails, > it should not leave the garbage string in psql's query buffer and the > following query should be completed successfully. Good catch! I agree to this. > This

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

2023-09-15 Thread Amit Kapila
On Fri, Sep 15, 2023 at 8:43 AM Hayato Kuroda (Fujitsu) wrote: > Few comments: 1. Why is the FPI record (XLOG_FPI_FOR_HINT) not considered a record to be ignored? This can be generated during reading system tables. 2. +binary_upgrade_validate_wal_record_types_after_lsn(PG_FUNCTION_ARGS) { ... +