Re: Weird test mixup

2024-03-17 Thread Andrey M. Borodin
> On 18 Mar 2024, at 06:04, Michael Paquier wrote: > > new function call injection_points_local() that can > be added on top of a SQL test to make it concurrent-safe. Maybe consider function injection_points_attach_local(‘point name’) instead of static switch? Or even

Re: pg16: XX000: could not find pathkey item to sort

2024-03-17 Thread Ashutosh Bapat
On Thu, Mar 14, 2024 at 3:45 PM David Rowley wrote: > On Thu, 14 Mar 2024 at 18:23, Ashutosh Bapat > wrote: > > I don't understand why root->query_pathkeys has both a and b. "a" is > there because of GROUP BY and ORDER BY clause. But why "b"? > > So that the ORDER BY aggregate function can be

RE: speed up a logical replica setup

2024-03-17 Thread Hayato Kuroda (Fujitsu)
Dear Euler, Thanks for updating the patch. Here are my comments. I used Grammarly to proofread sentences. (The tool strongly recommends to use active voice, but I can ignore for now) 01. "After a successful run, the state of the target server is analagous to a fresh logical replication setup."

Re: RFC: Logging plan of the running query

2024-03-17 Thread torikoshia
On 2024-03-14 04:33, Robert Haas wrote: Thanks for your review! On Wed, Mar 13, 2024 at 1:28 AM torikoshia wrote: - I saw no way to find the next node to be executed from the planstate tree, so the patch wraps all the ExecProcNode of the planstate tree at CHECK_FOR_INTERRUPTS(). I don't

Re: PostgreSQL 17 Release Management Team & Feature Freeze

2024-03-17 Thread Michael Paquier
On Mon, Mar 18, 2024 at 03:49:24AM +, Hayato Kuroda (Fujitsu) wrote: > I think the entry can be closed: > > ``` > pg_upgrade with --link mode failing upgrade of publishers > Commit: 29d0a77fa660 > Owner: Amit Kapila > ``` > > The reported failure was only related with the test script, not

Re: Add new error_action COPY ON_ERROR "log"

2024-03-17 Thread Michael Paquier
On Mon, Mar 18, 2024 at 12:05:17PM +0900, Kyotaro Horiguchi wrote: > And I believe that CONTEXT, if it exists, is augmentation information > to the primary messages. The objective of the precedent for the use of > relname_only was somewhat different, but this use also seems legit. > > In short, I

Re: Fix for timestamp lag issue from emit_log_hook when GUC log_line_prefix has '%m'

2024-03-17 Thread Michael Paquier
On Sun, Mar 17, 2024 at 07:35:57PM +0530, Kambam Vinay wrote: > Thanks Michael for the review. Agree with your comment on the patch. > updated the patch with recommended change. That should be fine. I would suggest to document why the reset is done at this location, aka this is to ensure that

Re: speed up a logical replica setup

2024-03-17 Thread Amit Kapila
On Mon, Mar 18, 2024 at 9:37 AM Amit Kapila wrote: > > On Sat, Mar 16, 2024 at 9:13 PM Euler Taveira wrote: > > > > On Fri, Mar 15, 2024, at 3:34 AM, Amit Kapila wrote: > > > > Did you consider adding options for publication/subscription/slot > > names as mentioned in my previous email? As

Re: remaining sql/json patches

2024-03-17 Thread Amit Langote
On Wed, Mar 13, 2024 at 5:47 AM Alvaro Herrera wrote: > About 0002: > > I think we should just drop it. Look at the changes it produces in the > plans for aliases XMLTABLE: > > > @@ -1556,7 +1556,7 @@ SELECT f.* FROM xmldata, LATERAL > > xmltable('/ROWS/ROW[COUNTRY_NAME="Japan" or COU > >

Re: SQL:2011 application time

2024-03-17 Thread jian he
one more minor issue related to error reporting. I've only applied v28, 0001 to 0005. -- (parent_id, valid_at) REFERENCES [implicit] -- FOREIGN KEY part should specify PERIOD CREATE TABLE temporal_fk_rng2rng ( id int4range, valid_at daterange, parent_id int4range, CONSTRAINT

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-17 Thread Amit Kapila
On Mon, Mar 18, 2024 at 9:58 AM Bharath Rupireddy wrote: > > On Sat, Mar 16, 2024 at 3:55 PM Amit Kapila wrote: > > > > > What's proposed with max_slot_xid_age is that during checkpoint we > > > look at slot's xmin and catalog_xmin, and the current system txn id. > > > Then, if the XID age of

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-17 Thread Bharath Rupireddy
On Sat, Mar 16, 2024 at 3:55 PM Amit Kapila wrote: > > > What's proposed with max_slot_xid_age is that during checkpoint we > > look at slot's xmin and catalog_xmin, and the current system txn id. > > Then, if the XID age of (xmin, catalog_xmin) and current_xid crosses > > max_slot_xid_age, we

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

2024-03-17 Thread Masahiko Sawada
On Sun, Mar 17, 2024 at 11:46 AM John Naylor wrote: > > On Fri, Mar 15, 2024 at 9:17 PM Masahiko Sawada wrote: > > > > On Fri, Mar 15, 2024 at 4:36 PM John Naylor wrote: > > > > > > On Thu, Mar 14, 2024 at 7:04 PM Masahiko Sawada > > > wrote: > > > > > Given TidStoreSetBlockOffsets() is

Re: speed up a logical replica setup

2024-03-17 Thread Amit Kapila
On Sat, Mar 16, 2024 at 9:13 PM Euler Taveira wrote: > > On Fri, Mar 15, 2024, at 3:34 AM, Amit Kapila wrote: > > Did you consider adding options for publication/subscription/slot > names as mentioned in my previous email? As discussed in a few emails > above, it would be quite confusing for

RE: PostgreSQL 17 Release Management Team & Feature Freeze

2024-03-17 Thread Hayato Kuroda (Fujitsu)
Dear Michael, > We are pleased to announce the Release Management Team (RMT) (cc'd) > for the PostgreSQL 17 release: > - Robert Haas > - Heikki Linnakangas > - Michael Paquier Thanks for managing the release of PostgreSQL to proceed the right direction! > You can track open items for the

Re: Statistics Import and Export

2024-03-17 Thread Corey Huinker
> > > * pg_set_relation_stats() needs to do an ACL check so you can't set the > stats on someone else's table. I suggest honoring the new MAINTAIN > privilege as well. > Added. > > * If possible, reading from pg_stats (instead of pg_statistic) would be > ideal because pg_stats already does the

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-17 Thread Amit Kapila
On Sun, Mar 17, 2024 at 2:03 PM Bharath Rupireddy wrote: > > On Sat, Mar 16, 2024 at 3:55 PM Amit Kapila wrote: > > > > procArray->replication_slot_catalog_xmin) but then don't adjust it for > > 'max_slot_xid_age'. I could be missing something in this but it is > > better to keep discussing this

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-03-17 Thread Amit Kapila
On Sun, Mar 17, 2024 at 7:40 PM Alexander Korotkov wrote: > > On Sat, Mar 16, 2024 at 5:05 PM Bharath Rupireddy > wrote: > > On Sat, Mar 16, 2024 at 4:26 PM Amit Kapila wrote: > > > In general, it seems this patch has been stuck for a long time on the > > > decision to choose an appropriate UI

Re: Add new error_action COPY ON_ERROR "log"

2024-03-17 Thread Kyotaro Horiguchi
At Fri, 15 Mar 2024 16:57:25 +0900, Michael Paquier wrote in > On Wed, Mar 13, 2024 at 07:32:37PM +0530, Bharath Rupireddy wrote: > > I'm attaching the v8 patch set implementing the above idea. With this, > > [1] is sent to the client, [2] is sent to the server log. This > > approach not only

PostgreSQL 17 Release Management Team & Feature Freeze

2024-03-17 Thread Michael Paquier
Hi, We are pleased to announce the Release Management Team (RMT) (cc'd) for the PostgreSQL 17 release: - Robert Haas - Heikki Linnakangas - Michael Paquier You can find information about the responsibilities of the RMT here: https://wiki.postgresql.org/wiki/Release_Management_Team Additionally,

Re: Autogenerate some wait events code and documentation

2024-03-17 Thread Noah Misch
On Mon, Mar 18, 2024 at 08:02:24AM +0900, Michael Paquier wrote: > > 1. Don't back-patch wait events to v17+. Use the closest existing event. > > 2. Let wait_event_names.txt back-patches control the enum order. For > > example, > >a line could have an annotation that controls its position

Re: Weird test mixup

2024-03-17 Thread Michael Paquier
On Sat, Mar 16, 2024 at 08:40:21AM +0900, Michael Paquier wrote: > Linking all the points to a PID with a injection_points_attach_local() > that switches a static flag while registering a before_shmem_exit() to > do an automated cleanup sounds like the simplest approach to me based > on what I'm

Re: Regarding the order of the header file includes

2024-03-17 Thread Richard Guo
On Wed, Mar 13, 2024 at 10:07 PM Peter Eisentraut wrote: > On 12.03.24 12:47, Richard Guo wrote: > > > > On Wed, Mar 6, 2024 at 5:32 PM Richard Guo > > wrote: > > > > Please note that this patch only addresses the order of header file > > includes in

Re: Support json_errdetail in FRONTEND builds

2024-03-17 Thread Tom Lane
Daniel Gustafsson writes: > I took another look at this tonight and committed it with some mostly cosmetic > changes. Since then, tamandua failed the SSL test on this commit but I am > unable to reproduce any error both on older OpenSSL and matching the 3.1 > version on tamandua, so not sure if

Re: Q: Escapes in jsonpath Idents

2024-03-17 Thread Erik Wienhold
On 2024-03-17 20:50 +0100, David E. Wheeler wrote: > On Mar 17, 2024, at 15:12, Erik Wienhold wrote: > > So I think it makes sense to reword the entire backslash part of the > > paragraph and remove references to JSON entirely. The attached patch > > does that and also formats the backslash

Re: Add pg_basetype() function to obtain a DOMAIN base type

2024-03-17 Thread jian he
looking at it again. I found out we can just simply do ` Datum pg_basetype(PG_FUNCTION_ARGS) { Oid oid; oid = get_fn_expr_argtype(fcinfo->flinfo, 0); PG_RETURN_OID(getBaseType(oid)); } ` if the type is not a domain, work the same as pg_typeof. if the type is domain, pg_typeof return as is,

Re: Support json_errdetail in FRONTEND builds

2024-03-17 Thread Daniel Gustafsson
> On 17 Mar 2024, at 00:00, Daniel Gustafsson wrote: > >> On 16 Mar 2024, at 00:59, Andrew Dunstan wrote: >>> On Mar 16, 2024, at 8:53 AM, Daniel Gustafsson wrote: On 15 Mar 2024, at 21:56, Andrew Dunstan wrote: > I'd like to get this done ASAP so I can rebase my incremental parse

Re: SQL:2011 application time

2024-03-17 Thread jian he
Hi, minor issues from 1 to 0005. + + referencedagg + aggregates referenced rows' WITHOUT OVERLAPS +part + 13 + comparing with surrounding items, maybe need to add `(optional)`? I think the explanation is not good as explained in referencedagg entry below:

Re: Combine Prune and Freeze records emitted by vacuum

2024-03-17 Thread Heikki Linnakangas
On 15/03/2024 02:56, Melanie Plageman wrote: Okay, so I was going to start using xl_heap_prune for vacuum here too, but I realized it would be bigger because of the snapshotConflictHorizon. Do you think there is a non-terrible way to make the snapshotConflictHorizon optional? Like with a flag?

Re: Autogenerate some wait events code and documentation

2024-03-17 Thread Michael Paquier
On Sun, Mar 17, 2024 at 11:31:14AM -0700, Noah Misch wrote: > I like the new developer experience of adding a wait event. After release of > v17, how should we approach back-patching an event, like was done in commits > 8fa4a1a 1396b5c 78c0f85? Each of those commits put the new event at the end

Re: Built-in CTYPE provider

2024-03-17 Thread Tom Lane
Jeff Davis writes: > New series attached. Coverity thinks there's something wrong with builtin_validate_locale, and as far as I can tell it's right: the last ereport is unreachable, because required_encoding is never changed from its initial -1 value. It looks like there's a chunk of logic

Re: Popcount optimization using AVX512

2024-03-17 Thread David Rowley
On Sat, 16 Mar 2024 at 04:06, Nathan Bossart wrote: > I ran John Naylor's test_popcount module [0] with the following command on > an i7-1195G7: > > time psql postgres -c 'select drive_popcount(1000, 1024)' > > Without your patches, this seems to take somewhere around 8.8 seconds. >

Re: broken JIT support on Fedora 40

2024-03-17 Thread Dmitry Dolgov
> On Fri, Mar 15, 2024 at 01:54:38PM +1300, Thomas Munro wrote: > For me it seems that the LLVMRunPasses() call, new in > > commit 76200e5ee469e4a9db5f9514b9d0c6a31b496bff > Author: Thomas Munro > Date: Wed Oct 18 22:15:54 2023 +1300 > > jit: Changes for LLVM 17. > > is reaching code that

Re: Q: Escapes in jsonpath Idents

2024-03-17 Thread David E. Wheeler
On Mar 17, 2024, at 15:12, Erik Wienhold wrote: > Hi David, Hey Erik. Thanks for the detailed reply and patch! > So I think it makes sense to reword the entire backslash part of the > paragraph and remove references to JSON entirely. The attached patch > does that and also formats the

Re: Improving EXPLAIN's display of SubPlan nodes

2024-03-17 Thread Tom Lane
I wrote: > Dean Rasheed writes: >> Overall, I think this is heading in the right direction. I think we >> just need a good way to say "the n'th output column of the subplan", >> that can't be confused with anything else in the output. > We could consider notations like "(SubPlan 1 column 2)",

Re: BitmapHeapScan streaming read user and prelim refactoring

2024-03-17 Thread Tomas Vondra
On 3/17/24 17:38, Andres Freund wrote: > Hi, > > On 2024-03-16 21:25:18 +0100, Tomas Vondra wrote: >> On 3/16/24 20:12, Andres Freund wrote: >>> That would address some of the worst behaviour, but it doesn't really seem >>> to >>> address the underlying problem of the two iterators being

Re: Make attstattarget nullable

2024-03-17 Thread Nathan Bossart
On Sun, Mar 17, 2024 at 01:51:39PM +0100, Peter Eisentraut wrote: > I have committed this patch series. Thanks. My compiler is worried that "newtarget" might be getting used uninitialized. AFAICT there's no actual risk here, so I think initializing it to 0 is sufficient. I'll commit the

Re: Q: Escapes in jsonpath Idents

2024-03-17 Thread Erik Wienhold
Hi David, On 2024-03-16 19:39 +0100, David E. Wheeler wrote: > The jsonpath doc[1] has an excellent description of the format of > strings, but for unquoted path keys, it simply says: > > > Member accessor that returns an object member with the specified > > key. If the key name matches some

Re: Autogenerate some wait events code and documentation

2024-03-17 Thread Noah Misch
On Wed, Jul 05, 2023 at 10:57:19AM +0900, Michael Paquier wrote: > I have applied it. I like the new developer experience of adding a wait event. After release of v17, how should we approach back-patching an event, like was done in commits 8fa4a1a 1396b5c 78c0f85? Each of those commits put the

Re: pg_upgrade failing for 200+ million Large Objects

2024-03-17 Thread Laurenz Albe
On Sat, 2024-03-16 at 18:46 -0400, Tom Lane wrote: > > Without the patch: > > Runtime: 74.5 minutes > > > With the patch: > > Runtime: 70 minutes > > Hm, I'd have hoped for a bit more runtime improvement. I did a second run with the patch, and that finished in 66 minutes, so there is some

Re: BitmapHeapScan streaming read user and prelim refactoring

2024-03-17 Thread Andres Freund
Hi, On 2024-03-16 21:25:18 +0100, Tomas Vondra wrote: > On 3/16/24 20:12, Andres Freund wrote: > > That would address some of the worst behaviour, but it doesn't really seem > > to > > address the underlying problem of the two iterators being modified > > independently. ISTM the proper fix would

Re: Improving EXPLAIN's display of SubPlan nodes

2024-03-17 Thread Tom Lane
Dean Rasheed writes: > On Sat, 16 Mar 2024 at 17:25, Tom Lane wrote: >> After looking at your draft some more, it occurred to me that we're >> not that far from getting rid of showing "$n" entirely in this >> context. Instead of (subplan_name).$n, we could write something like >>

Re: [HACKERS] make async slave to wait for lsn to be replayed

2024-03-17 Thread Alexander Korotkov
Hi Amit, Hi Bharath, On Sat, Mar 16, 2024 at 5:05 PM Bharath Rupireddy wrote: > On Sat, Mar 16, 2024 at 4:26 PM Amit Kapila wrote: > > In general, it seems this patch has been stuck for a long time on the > > decision to choose an appropriate UI (syntax), and we thought of > > moving it further

Re: Fix for timestamp lag issue from emit_log_hook when GUC log_line_prefix has '%m'

2024-03-17 Thread Kambam Vinay
Thanks Michael for the review. Agree with your comment on the patch. updated the patch with recommended change. Thanks, Vinay On Mon, Mar 11, 2024 at 1:13 PM Michael Paquier wrote: > On Sat, Mar 09, 2024 at 09:09:39PM +0530, Kambam Vinay wrote: > > We observed a slight lag in timestamp for a

Re: Simplify backtrace_functions GUC code

2024-03-17 Thread Alvaro Herrera
On 2024-Mar-17, Bharath Rupireddy wrote: > I think the code can be simplified a bit by using > SplitIdentifierString like in the attached patch. With this, > backtrace_function_list variable and assign_backtrace_functions() will > go away. Did you read the discussion that led to the current

Re: Make attstattarget nullable

2024-03-17 Thread Peter Eisentraut
On 14.03.24 15:46, Tomas Vondra wrote: 2) The newtarget handling in AlterStatistics seems rather confusing. Why does it get set to -1 just to ignore the value later? For a while I was 99% sure ALTER STATISTICS ... SET STATISTICS DEFAULT will set the field to -1. Maybe ditching the first if block

Re: Improving EXPLAIN's display of SubPlan nodes

2024-03-17 Thread Dean Rasheed
On Sat, 16 Mar 2024 at 17:25, Tom Lane wrote: > > After looking at your draft some more, it occurred to me that we're > not that far from getting rid of showing "$n" entirely in this > context. Instead of (subplan_name).$n, we could write something like > (subplan_name).colN or

Re: Introduce XID age and inactive timeout based replication slot invalidation

2024-03-17 Thread Bharath Rupireddy
On Sat, Mar 16, 2024 at 3:55 PM Amit Kapila wrote: > > procArray->replication_slot_catalog_xmin) but then don't adjust it for > 'max_slot_xid_age'. I could be missing something in this but it is > better to keep discussing this and try to move with another parameter >

Re: Confine vacuum skip logic to lazy_scan_skip

2024-03-17 Thread Thomas Munro
On Tue, Mar 12, 2024 at 10:03 AM Melanie Plageman wrote: > I've rebased the attached v10 over top of the changes to > lazy_scan_heap() Heikki just committed and over the v6 streaming read > patch set. I started testing them and see that you are right, we no > longer pin too many buffers. However,

Simplify backtrace_functions GUC code

2024-03-17 Thread Bharath Rupireddy
Hi, While working on [1], I noticed that the backtrace_functions GUC code does its own string parsing and uses another extra variable backtrace_function_list to store the processed form of backtrace_functions GUC. I think the code can be simplified a bit by using SplitIdentifierString like in

Re: clarify equalTupleDescs()

2024-03-17 Thread Peter Eisentraut
On 13.03.24 19:43, Tomas Vondra wrote: I looked at this patch today. I went through all the calls switched to equalRowTypes, and AFAIK all of them are correct - all the places switched to equalRowTypes() only need the weaker checks. There's only two places still calling equalTupleDescs() -

Re: Switching XLog source from archive to streaming when primary available

2024-03-17 Thread Bharath Rupireddy
On Wed, Mar 6, 2024 at 9:49 PM Nathan Bossart wrote: > > > I played with that idea and it came out very nice. Please see the > > attached v22 patch. Note that personally I didn't like "FORCE" being > > there in the names, so I've simplified them a bit. > > Thanks. I'd like to spend some time