Re: NOT ENFORCED constraint feature

2025-02-02 Thread Amul Sul
On Mon, Feb 3, 2025 at 10:49 AM Ashutosh Bapat wrote: > > On Mon, Feb 3, 2025 at 9:57 AM Amul Sul wrote: > > > > On Fri, Jan 31, 2025 at 7:10 PM Alvaro Herrera > > wrote: > > > > > > On 2025-Jan-31, Ashutosh Bapat wrote: > > > > > > > But if the constraint is NOT VALID and later marked as NOT E

Re: Logging parallel worker draught

2025-02-02 Thread Sami Imseih
> The "story" I have in mind is: I need to audit an instance I know > nothing about. I ask the client to adapt the logging parameters for > pgbadger (including this one), collect the logs and generate a report > for the said period to have a broad overview of what is happenning. Let's see if anyon

Re: NOT ENFORCED constraint feature

2025-02-02 Thread Ashutosh Bapat
On Mon, Feb 3, 2025 at 9:57 AM Amul Sul wrote: > > On Fri, Jan 31, 2025 at 7:10 PM Alvaro Herrera > wrote: > > > > On 2025-Jan-31, Ashutosh Bapat wrote: > > > > > But if the constraint is NOT VALID and later marked as NOT ENFORCED, > > > what is expected behaviour while changing it to ENFORCED?

Re: pg_rewind with --write-recovery-conf option doesn't write dbname to primary_conninfo value.

2025-02-02 Thread Peter Smith
On Mon, Feb 3, 2025 at 4:50 PM Hayato Kuroda (Fujitsu) wrote: > > Dear Sawada-san, > > > I think it's a good idea to support it at least on HEAD. I've attached > > a patch for that. > > +1. I've confirmed that pg_rewind and -R can't output dbname for now, > and your patch allows to do it. > > Few

Re: POC, WIP: OR-clause support for indexes

2025-02-02 Thread Andrei Lepikhov
On 2/3/25 00:57, Alexander Korotkov wrote: On Thu, Jan 30, 2025 at 3:23 PM Pavel Borisov wrote: On Tue, 28 Jan 2025 at 12:42, Andrei Lepikhov wrote: On 1/28/25 11:36, Andrei Lepikhov wrote: On 1/27/25 16:50, Alexander Korotkov wrote: qsort(matches, n, sizeof(OrArgIndexMatch), or_arg_index_m

Re: pgbench with partitioned tables

2025-02-02 Thread Álvaro Herrera
On 2025-Feb-03, Sergey Tatarintsev wrote: > Thanks for the note. I changed the query in the patch (v2 patch attached) > > Btw, an additional benefit from the patch is that we can use foreign tables > (for example, to test postgres_fdw optimizations) Good thought, and maybe it would be better if

Re: why there is not VACUUM FULL CONCURRENTLY?

2025-02-02 Thread Alvaro Herrera
> From bf2ec8c5d753de340140839f1b061044ec4c1149 Mon Sep 17 00:00:00 2001 > From: Antonin Houska > Date: Mon, 13 Jan 2025 14:29:54 +0100 > Subject: [PATCH 4/8] Add CONCURRENTLY option to both VACUUM FULL and CLUSTER > commands. > @@ -950,8 +1412,46 @@ copy_table_data(Relation NewHeap, Relation

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-02 Thread Álvaro Herrera
On 2025-Feb-01, Zhang Mingli wrote: > For example, we use kafka_fdw to produce and consume data from a Kafka > server. In our scenario, we sometimes need to write records from a > local table into Kafka. Here’s a brief outline of our process: > > 1. We already have a wide table, local_wide_table

Re: pgbench with partitioned tables

2025-02-02 Thread Álvaro Herrera
On 2025-Jan-31, Melanie Plageman wrote: > Maybe instead of just not using COPY FREEZE on a table if it is > partitioned, we could add new data generation init_steps. Perhaps one > that is client-side data generation (g) but with no freezing? I'm not > really sure what the letter would be (f? makin

Re: Getting rid of CaseTestExpr (well, partially)

2025-02-02 Thread Tom Lane
I wrote: > Therefore, my proposal here is to leave the parser's usage of > CaseTestExpr alone, and replace CaseTestExprs with Params during > eval_const_expressions, just before any relevant function inlining > could happen. I thought of a nasty defect in this idea: CASE expressions that would hav

Re: POC, WIP: OR-clause support for indexes

2025-02-02 Thread Alexander Korotkov
On Tue, Jan 28, 2025 at 10:42 AM Andrei Lepikhov wrote: > On 1/28/25 11:36, Andrei Lepikhov wrote: > > On 1/27/25 16:50, Alexander Korotkov wrote: > > qsort(matches, n, sizeof(OrArgIndexMatch), or_arg_index_match_cmp); > > > > To fit an index, the order of elements in the target array of the > > `

Re: POC, WIP: OR-clause support for indexes

2025-02-02 Thread Alexander Korotkov
On Thu, Jan 30, 2025 at 3:23 PM Pavel Borisov wrote: > On Tue, 28 Jan 2025 at 12:42, Andrei Lepikhov wrote: > > > > On 1/28/25 11:36, Andrei Lepikhov wrote: > > > On 1/27/25 16:50, Alexander Korotkov wrote: > > > qsort(matches, n, sizeof(OrArgIndexMatch), or_arg_index_match_cmp); > > > > > > To f

Re: POC, WIP: OR-clause support for indexes

2025-02-02 Thread Alexander Korotkov
On Fri, Jan 31, 2025 at 4:31 PM Alena Rybakina wrote: > I started reviewing at the patch and saw some output "ERROR" in the output of > the test and is it okay here? > > SELECT * FROM tenk1 t1 > WHERE t1.thousand = 42 OR t1.thousand = (SELECT t2.tenthous FROM tenk1 t2 > WHERE t2.thousand = t1.te

Re: Allow default \watch interval in psql to be configured

2025-02-02 Thread Daniel Gustafsson
> On 19 Nov 2024, at 11:20, Masahiro Ikeda wrote: > I've tested it and reviewed the patch. I'd like to provide some feedback. Thank you very much for your review and I do apologize for the late response. > I tested with v3 patch and found the following compile error. > It seems that math.h need

Increased work_mem for "logical replication tablesync worker" only?

2025-02-02 Thread Dmitry Koterov
Hi. Trying to monitor perf during the initial tablesync phase (COPY) right after CREATE SUBSCRIPTION. I noticed that the size of 17/main/base/pgsql_tmp on the destination node grows (tens of gigabytes) as the COPY command (running internally on the publisher) progresses. Then in the end (when its

[PATCH] Fix incorrect range in pg_regress comment

2025-02-02 Thread Ilia Evdokimov
Hi hackers, I noticed that a comment in pg_regress incorrectly states that alternative output files can be named filename{_i}.out with 0 < i <= 9. However, the actual valid range is 0 <= i <= 9. This patch corrects the comment. The fix is trivial but ensures that the documentation in the cod

Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)

2025-02-02 Thread jian he
hi. the following reviews based on v10-0001-Introduce-the-ability-to-set-index-visibility-us.patch. in src/test/regress/sql/create_index.sql seems there are no sql tests for "create index ... invisible"? VISIBLE Make the specified index visible. The index will be used fo

Re: [PATCH] Fix incorrect range in pg_regress comment

2025-02-02 Thread Tom Lane
Ilia Evdokimov writes: > I noticed that a comment in pg_regress incorrectly states that > alternative output files can be named filename{_i}.out with 0 < i <= 9. > However, the actual valid range is 0 <= i <= 9. This patch corrects the > comment. Hmm, our convention is definitely that the numb

Re: Pgoutput not capturing the generated columns

2025-02-02 Thread Peter Smith
On Wed, Jan 29, 2025 at 2:48 PM Amit Kapila wrote: > > On Wed, Jan 29, 2025 at 6:03 AM Peter Smith wrote: > > > > On Tue, Jan 28, 2025 at 7:59 PM Amit Kapila wrote: > > > > > > On Thu, Jan 23, 2025 at 9:58 AM vignesh C wrote: > > > > > > > > > > I have pushed the remaining part of this patch. N

DOCS - Generated Column Replication Examples

2025-02-02 Thread Peter Smith
Hi, A recent commit [1] added a new section "29.6. Generated Column Replication" to the documentation [2]. But, no "Examples" were included. I've created this new thread to make a case for adding an "Examples" subsection to that page. (the proposed examples patch is attached) == 1. Reasons

Re: pgbench with partitioned tables

2025-02-02 Thread Sami Imseih
I was looking at the comments [1] for why COPY FREEZE is not allowed on a parent table, and it was mainly due to having to open up partitions to check if they are able to take the optimization (table created or truncated in the current transaction ). Obviously as the number of partitions grow, it w

Re: Using Expanded Objects other than Arrays from plpgsql

2025-02-02 Thread Michel Pelletier
On Sun, Feb 2, 2025 at 1:57 PM Tom Lane wrote: > I wrote: > > Hmm, it seemed to still apply for me. But anyway, I needed to make > > the other changes, so here's v4. > > PFA v5. The new 0001 patch refactors the free_xxx infrastructure > to create plpgsql_statement_tree_walker(), and then in wha

Re: Increased work_mem for "logical replication tablesync worker" only?

2025-02-02 Thread Amit Kapila
On Sun, Feb 2, 2025 at 5:13 PM Dmitry Koterov wrote: > > Trying to monitor perf during the initial tablesync phase (COPY) right after > CREATE SUBSCRIPTION. I noticed that the size of 17/main/base/pgsql_tmp on the > destination node grows (tens of gigabytes) as the COPY command (running > inter

Re: jsonlog missing from logging_collector description

2025-02-02 Thread Michael Paquier
On Fri, Jan 31, 2025 at 09:32:42PM -0500, Tom Lane wrote: > Sure, fine by me. This one has been done as d61b9662b09e. -- Michael signature.asc Description: PGP signature

Re: pg_rewind with --write-recovery-conf option doesn't write dbname to primary_conninfo value.

2025-02-02 Thread Amit Kapila
On Thu, Jan 30, 2025 at 3:17 AM Masahiko Sawada wrote: > > I found that pg_rewind with --write-recovery-conf option doesn't write > the dbname to an auto-generated primary_conninfo value. Therefore, > after a failover, the old primary cannot start if it's rewound by > pg_rewind with --write-recove

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

2025-02-02 Thread Peter Smith
On Fri, Jan 31, 2025 at 8:02 PM Amit Kapila wrote: > > On Fri, Jan 31, 2025 at 10:40 AM Peter Smith wrote: > > > > == > > src/backend/replication/slot.c > > > > ReportSlotInvalidation: > > > > 1. > > + > > + case RS_INVAL_IDLE_TIMEOUT: > > + Assert(inactive_since > 0); > > + /* translator: se

Re: [PATCH] Fix incorrect range in pg_regress comment

2025-02-02 Thread Tom Lane
Michael Paquier writes: > Right, let's adjust the comment to reflect what the docs say, as your > patch does. I presume that Tom will do that.. If I complain about it I gotta fix it, huh? Okay, done. regards, tom lane

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-02 Thread Mingli Zhang
Zhang Mingli www.hashdata.xyz On Feb 2, 2025 at 21:24 +0800, Álvaro Herrera , wrote: Eh yeah, I guess for this use case it makes sense to allow a LIKE clause on CREATE FOREIGN TABLE. Were you going to submit a patch? Hi, Yes, I would like to provide a patch. Glad to see we have come to an agre

Re: Using Expanded Objects other than Arrays from plpgsql

2025-02-02 Thread Tom Lane
I wrote: > Hmm, it seemed to still apply for me. But anyway, I needed to make > the other changes, so here's v4. I decided to see what would happen if we tried to avoid the code duplication in pl_funcs.c by making some "walker" infrastructure akin to expression_tree_walker. While that doesn't se

Re: [PATCH] Fix incorrect range in pg_regress comment

2025-02-02 Thread Jelte Fennema-Nio
On Sun, 2 Feb 2025 at 22:26, Tom Lane wrote: > Hmm, our convention is definitely that the numbers start with 1, > so I do not want to make this change. Maybe we should change > the code instead. That would require any extensions that use the _0.out suffix to update all those files to use _1.out

Re: [PATCH] Fix incorrect range in pg_regress comment

2025-02-02 Thread Tom Lane
Jelte Fennema-Nio writes: > On Sun, 2 Feb 2025 at 22:26, Tom Lane wrote: >> Hmm, our convention is definitely that the numbers start with 1, >> so I do not want to make this change. Maybe we should change >> the code instead. > That would require any extensions that use the _0.out suffix to upd

Re: Proposal to Enable/Disable Index using ALTER INDEX (with patch)

2025-02-02 Thread jian he
hi. modules/test_ddl_deparse/test_ddl_deparse.so.p/test_ddl_deparse.c.o -c ../../Desktop/pg_src/src7/postgres/src/test/modules/test_ddl_deparse/test_ddl_deparse.c ../../Desktop/pg_src/src7/postgres/src/test/modules/test_ddl_deparse/test_ddl_deparse.c: In function ‘get_altertable_subcmdinfo’: .

Re: Issues with 2PC at recovery: CLOG lookups and GlobalTransactionData

2025-02-02 Thread Michael Paquier
On Fri, Jan 31, 2025 at 04:54:17PM +0300, Vitaly Davydov wrote: > I'm looking at the v13 patch. I see, there is the only file for v13: > v2-0002-Fix-issues-with-2PC-file-handling-at-recovery-13.txt Yes. The fixes in 13~16 are simpler. There are so many conflicts across all the branches that I'm

Re: Vacuum statistics

2025-02-02 Thread Alexander Korotkov
On Mon, Jan 13, 2025 at 3:26 PM Alena Rybakina wrote: > I noticed that the cfbot is bad, the reason seems to be related to the lack > of a parameter in src/backend/utils/misc/postgresql.conf.sample. I added it, > it should help. The patch doesn't apply cleanly. Please rebase. I see you introd

Re: Non-text mode for pg_dumpall

2025-02-02 Thread Mahendra Singh Thalor
Thanks Jian for review, testing and delta patches. On Wed, 29 Jan 2025 at 15:09, jian he wrote: > > hi. > > we need to escape the semicolon within the single quotes or double quotes. > I think my patch in [1] is correct. > > we can have "ERROR: role "z" already exists > but > error message like

meson's in-tree libpq header search order vs -Dextra_include_dirs

2025-02-02 Thread Thomas Munro
When I use configure/make and --with-includes=/usr/local/include, I see compile lines like this: ... -I../../src/interfaces/libpq -I../../src/include -I/usr/local/include ... That's important, because if I happen to have libpq headers installed on the system I don't want to be confused by them.

Re: Proposal to CREATE FOREIGN TABLE LIKE

2025-02-02 Thread Michael Paquier
On Mon, Feb 03, 2025 at 06:22:13AM +0800, Mingli Zhang wrote: > Yes, I would like to provide a patch. > > Glad to see we have come to an agreement on this. Just adding my +1 here. FWIW. -- Michael signature.asc Description: PGP signature

Re: [PATCH] Fix incorrect range in pg_regress comment

2025-02-02 Thread Michael Paquier
On Sun, Feb 02, 2025 at 05:01:33PM -0500, Tom Lane wrote: > Oh. I see we did document it as 0-9 in [1], so I guess we're > stuck with that now. Objection withdrawn. Oh. I didn't know that 0 was accepted. We learn new things every day. Right, let's adjust the comment to reflect what the docs s

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

2025-02-02 Thread Peter Smith
Hi Nisha, Some review comments for v66-0001. == src/backend/replication/slot.c ReportSlotInvalidation: 1. StringInfoData err_detail; + StringInfoData err_hint; bool hint = false; initStringInfo(&err_detail); + initStringInfo(&err_hint); I don't think you still need the 'hint' boole

Re: Show WAL write and fsync stats in pg_stat_io

2025-02-02 Thread Michael Paquier
On Fri, Jan 31, 2025 at 11:29:31AM +0300, Nazir Bilal Yavuz wrote: > On Wed, 29 Jan 2025 at 18:16, Bertrand Drouvot > wrote: >> I think that's the main reason why ff99918c625 added this new GUC (looking at >> the commit message). I'd feel more comfortable if we keep it. > > As Michael suggested,

Re: Fix assert failure when decoding XLOG_PARAMETER_CHANGE on primary

2025-02-02 Thread Amit Kapila
On Fri, Jan 24, 2025 at 4:05 AM Masahiko Sawada wrote: > > When a standby replays a XLOG_PARAMETER_CHANGE record that lowers > wal_level from logical, we invalidate all logical slots only when the > standby is in hot standby mode: > > if (InRecovery && InHotStandby && > xlrec.wal_level < WAL_L

Re: NOT ENFORCED constraint feature

2025-02-02 Thread Amul Sul
On Sat, Feb 1, 2025 at 8:31 PM jian he wrote: > > [...] > So the code should only call AlterConstrTriggerDeferrability, > not call ATExecAlterConstrEnforceability? Right. Thank you for the report. We need to know whether the enforceability and/or deferability has actually been set or not before c

Re: NOT ENFORCED constraint feature

2025-02-02 Thread Amul Sul
On Fri, Jan 31, 2025 at 7:10 PM Alvaro Herrera wrote: > > On 2025-Jan-31, Ashutosh Bapat wrote: > > > But if the constraint is NOT VALID and later marked as NOT ENFORCED, > > what is expected behaviour while changing it to ENFORCED? > > I think what you want is a different mode that would be ENFOR

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

2025-02-02 Thread Amit Kapila
On Mon, Feb 3, 2025 at 9:04 AM Peter Smith wrote: > > On Fri, Jan 31, 2025 at 8:02 PM Amit Kapila wrote: > > > > On Fri, Jan 31, 2025 at 10:40 AM Peter Smith wrote: > > > > > > == > > > src/backend/replication/slot.c > > > > > > ReportSlotInvalidation: > > > > > > 1. > > > + > > > + case RS_

Re: why there is not VACUUM FULL CONCURRENTLY?

2025-02-02 Thread Antonin Houska
Alvaro Herrera wrote: > > > > From bf2ec8c5d753de340140839f1b061044ec4c1149 Mon Sep 17 00:00:00 2001 > > From: Antonin Houska > > Date: Mon, 13 Jan 2025 14:29:54 +0100 > > Subject: [PATCH 4/8] Add CONCURRENTLY option to both VACUUM FULL and CLUSTER > > commands. > > > @@ -950,8 +1412,46 @@ c

Re: UUID v7

2025-02-02 Thread Sergey Prokhorenko
Dearcolleagues, I wouldlike to present for discussion my attached new draft documentation on UUIDfunctions (Section 9.14. UUID Functions), which replaces the previouslyproposed draft at https://www.postgresql.org/docs/devel/functions-uuid.html.I have preserved and significantly supplemented t

Optimize scram_SaltedPassword performance

2025-02-02 Thread Zixuan Fu
Hi Hackers, While profiling a program with `perf`, I noticed that `scram_SaltedPassword` consumed more CPU time than expected. After some investigation, I found that the function performs many HMAC iterations (4096 rounds for SCRAM-SHA-256), and each iteration reinitializes the HMAC context, cau

Re: SQL/JSON json_table plan clause

2025-02-02 Thread Vladlen Popolitov
Nikita Malakhov писал(а) 2025-02-03 02:43: Hi hackers! Patch has been rebased onto the current master. -- Regards, Nikita Malakhov Postgres Professional The Russian Postgres Company https://postgrespro.ru/ Hi! Tested on Mac with 'make check', all tests passed OK. -- Best regards, Vladlen P

Re: pgbench with partitioned tables

2025-02-02 Thread Sergey Tatarintsev
02.02.2025 20:45, Álvaro Herrera пишет: On 2025-Jan-31, Melanie Plageman wrote: Maybe instead of just not using COPY FREEZE on a table if it is partitioned, we could add new data generation init_steps. Perhaps one that is client-side data generation (g) but with no freezing? I'm not really sur

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

2025-02-02 Thread Peter Smith
On Mon, Feb 3, 2025 at 4:04 PM Amit Kapila wrote: > > On Mon, Feb 3, 2025 at 9:04 AM Peter Smith wrote: > > > > On Fri, Jan 31, 2025 at 8:02 PM Amit Kapila wrote: > > > > > > On Fri, Jan 31, 2025 at 10:40 AM Peter Smith > > > wrote: > > > > > > > > == > > > > src/backend/replication/slot.c

RE: pg_rewind with --write-recovery-conf option doesn't write dbname to primary_conninfo value.

2025-02-02 Thread Hayato Kuroda (Fujitsu)
Dear Sawada-san, > I think it's a good idea to support it at least on HEAD. I've attached > a patch for that. +1. I've confirmed that pg_rewind and -R can't output dbname for now, and your patch allows to do it. Few comments for your patch. 1. pg_basebackup.sgml has below description. I feel t

Re: Make COPY format extendable: Extract COPY TO format implementations

2025-02-02 Thread Vladlen Popolitov
Sutou Kouhei писал(а) 2025-02-01 17:12: Hi, Hi I would like to inform about the security breach in your design of COPY TO/FROM. You use FORMAT option to add new formats, filling it with routine name in shared library. As result any caller can call any routine in PostgreSQL kernel. I think

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

2025-02-02 Thread Amit Kapila
On Mon, Feb 3, 2025 at 6:16 AM Peter Smith wrote: > > > 2. > + appendStringInfo(&err_hint, "You might need to increase \"%s\".", > + "max_slot_wal_keep_size"); > break; > 2a. > In this case, shouldn't you really be using macro _("You might need to > increase \"%s\".") so that the common format s

Re: Optimize scram_SaltedPassword performance

2025-02-02 Thread Yura Sokolov
03.02.2025 10:11, Zixuan Fu пишет: > Hi Hackers, > > While profiling a program with `perf`, I noticed that `scram_SaltedPassword` > consumed more CPU time than expected. After some investigation, I found > that the function performs many HMAC iterations (4096 rounds for > SCRAM-SHA-256), and eac

Re: NOT ENFORCED constraint feature

2025-02-02 Thread Alvaro Herrera
On 2025-Feb-03, Ashutosh Bapat wrote: > VALID, NOT ENFORCED changed to VALID, ENFORCED - data validation > required, constraint is enforced There's no such thing as a VALID NOT ENFORCED constraint. It just cannot exist. > NOT VALID, NOT ENFORCED changed to NOT_VALID, ENFORCED - no data > valida

Re: UUID v7

2025-02-02 Thread Andrey Borodin
> On 31 Jan 2025, at 23:49, Masahiko Sawada wrote: > > Thank you for the patch! I agree with the basic direction of this fix. > Here are some review comments: > > --- > -static inline int64 get_real_time_ns_ascending(); > +static inline uint64 get_real_time_ns_ascending(); > > IIUC we don't n

Doc fix of aggressive vacuum threshold for multixact members storage

2025-02-02 Thread Alex Friedman
Hi, This patch suggests a correction to the doc page dealing with multixact vacuuming, which, starting with PG 14, says that the multixact members storage threshold for aggressive vacuum is 2 GB. However, I believe the threshold is actually about 10 GB. MultiXactMemberFreezeThreshold() defines th

Re: Cross-type index comparison support in contrib/btree_gin

2025-02-02 Thread Tom Lane
I wrote: > We've had multiple requests for $SUBJECT over the years > ([1][2][3][4][5], and I'm sure my archive search missed some). > I finally decided to look into what it'd take to make that happen. I forgot to mention a couple of questions for review: > ... it turns out that the > compareParti