relfilenode statistics

2024-05-25 Thread Bertrand Drouvot
Hi hackers, Please find attached a POC patch to implement $SUBJECT. Adding relfilenode statistics has been proposed in [1]. The idea is to allow tracking dirtied blocks, written blocks,... on a per relation basis. The attached patch is not in a fully "polished" state yet: there is more places we

Re: Schema variables - new implementation for Postgres 15

2024-05-25 Thread walther
Pavel Stehule: Sure there is more possibilities, but I don't want to lost the possibility to write code like CREATE TEMP VARIABLE _x; LET _x = 'hello'; DO $$ BEGIN   RAISE NOTICE '%', _x; END; $$; So I am searching for a way to do it safely, but still intuitive and user friendly. Maybe a

Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs

2024-05-25 Thread Jelte Fennema-Nio
On Thu, 23 May 2024 at 20:40, Tom Lane wrote: > > Jacob Champion writes: > > Would it be good to expand on that idea of criticality? IIRC one of > > Jelte's complaints earlier was that middleware has to know all the > > extension types anyway, to be able to figure out whether it has to do > > som

[PATCH]A minor improvement to the error-report in SimpleLruWriteAll()

2024-05-25 Thread Long Song
Hi hackers, When I read the code, I noticed that in SimpleLruWriteAll(), only the last error is recorded when the file fails to close. Like the following, ```void SimpleLruWriteAll(SlruCtl ctl, bool allow_redirtied) { SlruShared shared = ctl->shared; SlruWriteAllData fdata;

Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs

2024-05-25 Thread Jelte Fennema-Nio
On Thu, 23 May 2024 at 20:12, Tom Lane wrote: > > Jelte Fennema-Nio writes: > > On Fri, 17 May 2024 at 21:24, Robert Haas wrote: > >> Perhaps these are all minority positions, but I can't tell you what > >> everyone thinks, only what I think. > > > I'd love to hear some opinions from others on t

Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs

2024-05-25 Thread Jelte Fennema-Nio
(pressed send to early) On Sat, 25 May 2024 at 12:39, Jelte Fennema-Nio wrote: > But again if I'm alone in this, then I don't ... mind budging on this to move this decision along. Using _pq_.xxx parameters for all protocol changes would totally be acceptable to me.

Re: Schema variables - new implementation for Postgres 15

2024-05-25 Thread Pavel Stehule
so 25. 5. 2024 v 10:24 odesílatel napsal: > Pavel Stehule: > > Sure there is more possibilities, but I don't want to lost the > > possibility to write code like > > > > CREATE TEMP VARIABLE _x; > > > > LET _x = 'hello'; > > > > DO $$ > > BEGIN > >RAISE NOTICE '%', _x; > > END; > > $$; > > > >

Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs

2024-05-25 Thread Dave Cramer
On Sat, 25 May 2024 at 06:40, Jelte Fennema-Nio wrote: > On Thu, 23 May 2024 at 20:12, Tom Lane wrote: > > > > Jelte Fennema-Nio writes: > > > On Fri, 17 May 2024 at 21:24, Robert Haas > wrote: > > >> Perhaps these are all minority positions, but I can't tell you what > > >> everyone thinks, o

Re: Volatile write caches on macOS and Windows, redux

2024-05-25 Thread Jelte Fennema-Nio
On Tue, 18 Jul 2023 at 05:29, Thomas Munro wrote: > It's possible that fcntl(F_FULLFSYNC) might fail with ENOSUPP or other > errors in obscure cases (eg unusual file systems). In that case, you > could manually lower fsync to just "on" and do your own research on > whether power loss can toast yo

Re: Improving tracking/processing of buildfarm test failures

2024-05-25 Thread Alexander Lakhin
Hello Amit and Noah, 24.05.2024 14:15, Amit Kapila wrote: I feel it is a good idea to do something about this. It makes sense to start with something simple and see how it works. I think this can also help us whether we need to chase a particular BF failure immediately after committing. 24.05.

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2024-05-25 Thread Alexander Korotkov
On Fri, May 24, 2024 at 11:00 PM Alexander Lakhin wrote: > > 24.05.2024 22:29, Tom Lane wrote: > > The partition_split test has unstable results, as shown at [1]. > > I suggest adding "ORDER BY conname" to the two queries shown > > to fail there. Better look at other queries in the test for > > p

Re: DROP OWNED BY fails to clean out pg_init_privs grants

2024-05-25 Thread Hannu Krosing
On Fri, May 24, 2024 at 10:00 PM Tom Lane wrote: > > Robert Haas writes: > > On Fri, May 24, 2024 at 2:57 PM Tom Lane wrote: > >> Doesn't seem right to me. That will give pg_dump the wrong idea > >> of what the initial privileges actually were, and I don't see how > >> it can construct correct

Re: DROP OWNED BY fails to clean out pg_init_privs grants

2024-05-25 Thread Tom Lane
Hannu Krosing writes: > Having an pg_init_privs entry referencing a non-existing user is > certainly of no practical use. Sure, that's not up for debate. What I think we're discussing right now is 1. What other cases are badly handled by the pg_init_privs mechanisms. 2. How much of that is pra

Fix an incorrect assertion condition in mdwritev().

2024-05-25 Thread Xing Guo
Hi hackers, In commit 4908c58[^1], a vectored variant of smgrwrite() is added and the assertion condition in mdwritev() no longer matches the comment. This patch helps fix it. [^1]: https://github.com/postgres/postgres/commit/4908c5872059c409aa647bcde758dfeffe07996e Best Regards, Xing From c77d

Reg - pg_background async triggers

2024-05-25 Thread _sanjiv_ SK
Hi Postgres gurus, I try to perform DELETE and INSERT queries in the Trigger function, BEGIN IF (TG_OP = 'DELETE') THEN DELETE FROM…; INSERT INTO….; RETURN OLD; ELSIF (TG_OP = 'UPDATE' OR TG_OP = 'INSERT') THEN DELETE FROM…; INSERT INTO….; RETURN NEW; END IF; RETURN NULL; -- result

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2024-05-25 Thread Justin Pryzby
On Fri, May 03, 2024 at 04:32:25PM +0300, Alexander Korotkov wrote: > On Fri, May 3, 2024 at 4:23 PM Justin Pryzby wrote: > > Note that the error that led to "EXCLUDING IDENTITY" is being discused > > over here: > > https://www.postgresql.org/message-id/3b8a9dc1-bbc7-0ef5-6863-c432afac7...@gmail.c

Re: DROP OWNED BY fails to clean out pg_init_privs grants

2024-05-25 Thread Hannu Krosing
On Sat, May 25, 2024 at 4:48 PM Tom Lane wrote: > > Hannu Krosing writes: > > Having an pg_init_privs entry referencing a non-existing user is > > certainly of no practical use. > > Sure, that's not up for debate. What I think we're discussing > right now is > > 1. What other cases are badly han

Re: Fix an incorrect assertion condition in mdwritev().

2024-05-25 Thread Michael Paquier
On Sat, May 25, 2024 at 11:52:22PM +0800, Xing Guo wrote: > In commit 4908c58[^1], a vectored variant of smgrwrite() is added and > the assertion condition in mdwritev() no longer matches the comment. > This patch helps fix it. > > /* This assert is too expensive to have on normally ... */ >

Re: First draft of PG 17 release notes

2024-05-25 Thread Bruce Momjian
On Fri, May 24, 2024 at 10:50:28AM -0700, Andres Freund wrote: > Hi, > > On 2024-05-23 23:27:04 -0400, Bruce Momjian wrote: > > On Thu, May 23, 2024 at 11:11:10PM -0400, Tom Lane wrote: > > > Bruce Momjian writes: > > > I am not sure Bruce that you realize that your disregard for > > > performanc

Re: First draft of PG 17 release notes

2024-05-25 Thread Bruce Momjian
On Fri, May 24, 2024 at 11:23:29AM -0700, Andres Freund wrote: > Hi, > > On 2024-05-22 18:33:03 -0400, Bruce Momjian wrote: > > On Tue, May 21, 2024 at 09:40:28AM -0700, Andres Freund wrote: > > > On 2024-05-18 11:13:54 -0400, Bruce Momjian wrote: > > > I agree keeping things reasonably short is i

Re: First draft of PG 17 release notes

2024-05-25 Thread Bruce Momjian
On Thu, May 23, 2024 at 01:22:51PM +0200, Álvaro Herrera wrote: > Hello, > > Regarding this item > > : Allow the SLRU cache sizes to be configured (Andrey Borodin, Dilip Kumar) > : > : The new server variables are commit_timestamp_buffers, > : multixact_member_buffers, multixact_offset_buffers,

Re: First draft of PG 17 release notes

2024-05-25 Thread Bruce Momjian
On Thu, May 23, 2024 at 04:54:28PM -0300, Marcos Pegoraro wrote: > • Rename SLRU columns in system view pg_stat_slru (Alvaro Herrera) > > The column names accepted by pg_stat_slru_rest() are also changed. > > Is pg_stat_slru_rest() correct ?  Oops, typo, fixed, thanks. -- Bruce Momjian

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2024-05-25 Thread Alexander Korotkov
On Sat, May 25, 2024 at 8:53 PM Justin Pryzby wrote: > On Fri, May 03, 2024 at 04:32:25PM +0300, Alexander Korotkov wrote: > > On Fri, May 3, 2024 at 4:23 PM Justin Pryzby wrote: > > > Note that the error that led to "EXCLUDING IDENTITY" is being discused > > > over here: > > > https://www.postgr

Re: First draft of PG 17 release notes

2024-05-25 Thread Bruce Momjian
On Thu, May 23, 2024 at 08:19:15PM -0400, Peter Geoghegan wrote: > On Wed, May 22, 2024 at 6:50 PM Bruce Momjian wrote: > > Agreed, patch applied, thanks. > > The item for my commit 5bf748b8 currently reads: > > "Allow btree indexes to more efficiently find array matches" > > I think that this

Re: Add SPLIT PARTITION/MERGE PARTITIONS commands

2024-05-25 Thread Alexander Korotkov
On Sat, May 25, 2024 at 3:53 PM Alexander Korotkov wrote: > On Fri, May 24, 2024 at 11:00 PM Alexander Lakhin wrote: > > > > 24.05.2024 22:29, Tom Lane wrote: > > > The partition_split test has unstable results, as shown at [1]. > > > I suggest adding "ORDER BY conname" to the two queries shown >

Re: Fix an incorrect assertion condition in mdwritev().

2024-05-25 Thread Tom Lane
Michael Paquier writes: > On Sat, May 25, 2024 at 11:52:22PM +0800, Xing Guo wrote: >> #ifdef CHECK_WRITE_VS_EXTEND >> -Assert(blocknum < mdnblocks(reln, forknum)); >> +Assert(blocknum + nblocks <= mdnblocks(reln, forknum)); >> #endif > Yes, it looks like you're right that this can be mad

Re: AIX support

2024-05-25 Thread Bruce Momjian
On Thu, May 23, 2024 at 07:03:20PM +0300, Heikki Linnakangas wrote: > > Can you provide some more details on the expectations here? > > Smallest possible patch that makes Postgres work on AIX again. > > Perhaps start with the patch you posted yesterday, but remove hunks from it > one by one, to s

Re: Fix an incorrect assertion condition in mdwritev().

2024-05-25 Thread Tom Lane
I wrote: > Hmm ... I agree that this is better normally. But there's an > edge case where it would fail to notice a problem that the > existing code does notice: if blocknum is close to UINT32_MAX > and adding nblocks causes it to wrap around to a small value. > Is there an inexpensive way to catc