Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible

2024-11-07 Thread Andres Freund
Hi, On 2024-11-07 09:20:24 -0800, Jacob Champion wrote: > From e755fdccf16cb4fcd3036e1209291750ffecd261 Mon Sep 17 00:00:00 2001 > From: Jacob Champion > Date: Fri, 3 May 2024 15:54:58 -0700 > Subject: [PATCH v5 1/2] pgstat: report in earlier with STATE_STARTING > > Add pgstat_bestart_pre_auth()

Re: Commit Timestamp and LSN Inversion issue

2024-11-07 Thread Andres Freund
Hi, On 2024-11-05 08:58:36 -0500, Jan Wieck wrote: > The attached solution is minimally invasive because it doesn't move the > timestamp generation (clock_gettime() call) into the critical section of > ReserveXLogInsertLocation() that is protected by a spinlock. Instead it > keeps track of the las

Re: New "raw" COPY format

2024-11-07 Thread Joel Jacobson
Thread renamed to: New "single" COPY format [1] [1] https://postgr.es/m/1db18e33-f1cf-4f2c-9d52-b6d7ff242...@app.fastmail.com /Joel

Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible

2024-11-07 Thread Jacob Champion
On Tue, Nov 5, 2024 at 9:48 PM Michael Paquier wrote: > +PAM_ACCT_MGMT "Waiting for the local PAM service to validate the user > account." > +PAM_AUTHENTICATE "Waiting for the local PAM service to authenticate > the user." > > Is "local" required for both? Perhaps just use "the PAM servi

Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row

2024-11-07 Thread Fujii Masao
On 2024/10/26 6:03, Kirill Reshke wrote: when the REJECT LIMIT is set to some non-zero number and the number of row NULL replacements exceeds the limit, is it OK to fail. Because there WAS errors, and we should not tolerate more than $limit errors . I do find this behavior to be consistent.

Re: index prefetching

2024-11-07 Thread Peter Geoghegan
On Thu, Nov 7, 2024 at 10:03 AM Tomas Vondra wrote: > The primary reason why I kept amgettuple() as is, and added a new AM > callback for the "batch" mode is backwards compatibility. I did not want > to force all AMs to do this, I think it should be optional. Not only to > limit the disruption for

Re: Deleting older versions in unique indexes to avoid page splits

2024-11-07 Thread Peter Geoghegan
Hi Andy, On Thu, Nov 7, 2024 at 3:05 AM Andy Fan wrote: > So my questions are: (a) How does the "logically unchanged index" hint > can be helpful for this purpose? It's the main trigger for bottom-up index deletion. It is taken as a signal that the leaf page might have garbage duplicates from no

Re: index prefetching

2024-11-07 Thread Tomas Vondra
On 11/7/24 01:38, Peter Geoghegan wrote: > On Wed, Nov 6, 2024 at 12:25 PM Tomas Vondra wrote: >> Attached is an updated version of this patch series. The first couple >> parts (adding batching + updating built-in index AMs) remain the same, >> the new part is 0007 which switches index scans to re

Re: Popcount optimization using AVX512

2024-11-07 Thread Nathan Bossart
On Thu, Nov 07, 2024 at 11:12:37AM -0500, Andres Freund wrote: > One thing that'd I'd like to see this being used is to elide the indirection > when the current target platform *already* supports the necessary > intrinsics. Adding a bunch of indirection for short & common operations is > decidedly

Re: Add reject_limit option to file_fdw

2024-11-07 Thread Fujii Masao
On 2024/11/05 22:30, torikoshia wrote: Thanks for the patch! Could you add it to the next CommitFest? Added an entry for this patch: https://commitfest.postgresql.org/50/5331/ Thanks! +ALTER FOREIGN TABLE agg_bad OPTIONS (reject_limit '1'); +SELECT * FROM agg_bad; +  a  |   b +-+---

Re: Enable data checksums by default

2024-11-07 Thread Alvaro Herrera
I have just noticed that since this patch was committed as 04bec894a04c, pg_upgrade's "make check" action is unusable when given the "olddump/oldinstall" options. We now need to inject '-k' to the initdb line for old servers, and we don't, so all upgrade tests fail. I think this patch should be e

Re: logical replication: restart_lsn can go backwards (and more), seems broken since 9.4

2024-11-07 Thread Tomas Vondra
Hi, I kept investigating this, but I haven't made much progress. I still don't understand why would it be OK to move any of the LSN fields backwards - certainly for fields like confirm_flush or restart_lsn. I did a simple experiment - added asserts to the couple places in logical.c updating the t

Re: Proposal to remove message length constant from F/B protocol document

2024-11-07 Thread David G. Johnston
On Fri, Nov 1, 2024 at 4:53 AM Tatsuo Ishii wrote: > I think this may bring a misunderstanding to some implementer of the > protocol. i.e. He may wright a code like this to save the work to > interpret the message length field (this is a backend side code). > > if (message_char == 'Z') > { >

Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible

2024-11-07 Thread Jacob Champion
On Thu, Nov 7, 2024 at 10:12 AM Andres Freund wrote: > I don't understand why the pgstat_bestart()/pgstat_bestart_pre_auth() split > makes sense. The latter is going to redo most of the work that the former > did. What's the point of that? > > Why not have a new function that initializes just the

Re: general purpose array_sort

2024-11-07 Thread Junwang Zhao
On Tue, Nov 5, 2024 at 9:13 AM Michael Paquier wrote: > > On Mon, Nov 04, 2024 at 03:16:35PM +0800, jian he wrote: > > drop table if exists t; > > CREATE TABLE t (a int[]); > > insert into t values ('{1,3}'),('{1,2,3}'),('{11}'); > > insert into t values ('{{1,12}}'), ('{{4,3}}'); > > SELECT array

Re: magical eref alias names

2024-11-07 Thread Robert Haas
On Thu, Nov 7, 2024 at 2:05 AM Peter Eisentraut wrote: > On 06.11.24 20:06, Robert Haas wrote: > > I can make nothing of*TLOCRN* or*TROCRN*, even > > after looking at the relevant source code, > > These are from the SQL standard text. So they are more guidance to the > implementer than anything e

Re: magical eref alias names

2024-11-07 Thread Robert Haas
Forgot to attach the patch. v1-0001-POC-Don-t-make-up-fake-eref-names.-Just-use-NULL.patch Description: Binary data

Re: Avoiding superfluous buffer locking during nbtree backwards scans

2024-11-07 Thread Peter Geoghegan
On Thu, Nov 7, 2024 at 5:44 AM Masahiro Ikeda wrote:0-12 08:29, Peter Geoghegan wrote: > > On Thu, Oct 10, 2024 at 1:41 PM Peter Geoghegan wrote: > > * We now reset currPos state (including even its moreLeft/moreRight > > fields) within _bt_parallel_seize, automatically and regardless of any > >

Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible

2024-11-07 Thread Jacob Champion
On Thu, Nov 7, 2024 at 11:41 AM Andres Freund wrote: > I think the patch should not be merged as-is. It's just too ugly and fragile. Understood; I'm trying to find a way forward, and I'm pointing out that the alternatives I've tried seem to me to be _more_ fragile. Are there any items in this li

Re: altering a column's collation leaves an invalid foreign key

2024-11-07 Thread Peter Eisentraut
On 25.10.24 16:26, jian he wrote: drop table if exists pktable, fktable; CREATE TABLE pktable (x text COLLATE "POSIX" PRIMARY KEY); CREATE TABLE fktable (x text COLLATE "C" REFERENCES pktable on update cascade on delete cascade); INSERT INTO pktable VALUES ('A'), ('Å'); INSERT INTO fktable VALUES

Re: Popcount optimization using AVX512

2024-11-07 Thread Nathan Bossart
On Thu, Nov 07, 2024 at 02:03:04PM -0600, Nathan Bossart wrote: > Committed. Of course, as soon as I committed this, I noticed that it's broken. It seems that compilers are rather picky about how multiple target options are specified. AFAICT the commonly supported syntax is to put the entire lis

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Nathan Bossart
+__attribute__((target("sse4.2"))) These need to be surrounded with #if defined(__has_attribute) && __has_attribute (target) so that we still attempt the check on compilers that don't support it (e.g., MSVC). # Check for Intel SSE 4.2 intrinsics to do CRC calculations. # -# First

Re: magical eref alias names

2024-11-07 Thread Tom Lane
Robert Haas writes: > It's quite possible that this patch isn't completely correct and it's > also possible that I'm missing some deeper problem with this idea that > just isn't exercised by the regression tests. But overall I find these > results fairly encouraging -- it just wasn't very hard to

Re: SQL:2023 JSON simplified accessor support

2024-11-07 Thread Alexandra Wang
On Fri, Oct 4, 2024 at 7:33 AM jian he wrote: > > On Thu, Sep 26, 2024 at 11:45 PM Alexandra Wang > wrote: > > > > Hi, > > > > I didn’t run pgindent earlier, so here’s the updated version with the > > correct indentation. Hope this helps! > > > > the attached patch solves the domain type issue, A

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Devulapalli, Raghuveer
Here is the updated patch with the #if defined(__has_attribute) && __has_attribute (target) guard. > Oh, you are right, sorry. No worries! 😊 > Is the idea that we will put both "choose" functions in one file and the > actual > CRC-32C code in another? I'm okay with that. Yup, there can only

Re: Alias of VALUES RTE in explain plan

2024-11-07 Thread Tom Lane
Just to follow up here --- I put this patch on hold for a few days because I had to work on release notes. Now I'm glad I did, because Robert Haas is pushing a proposal that would change the basis of discussion: https://www.postgresql.org/message-id/flat/CA%2BTgmoYSYmDA2GvanzPMci084n%2BmVucv0bJ0H

Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible

2024-11-07 Thread Jacob Champion
On Thu, Nov 7, 2024 at 1:37 PM Andres Freund wrote: > > - the pre-auth step must always initialize the entire pgstat struct > > Correct. And that has to happen exactly once, not twice. What goes wrong if it happens twice? > > - two-step initialization requires two PGSTAT_BEGIN_WRITE_ACTIVITY() >

Re: Avoiding superfluous buffer locking during nbtree backwards scans

2024-11-07 Thread Peter Geoghegan
On Thu, Nov 7, 2024 at 2:19 PM Peter Geoghegan wrote: > It would be weird to depend on the > currPos state from the last _bt_readpage call, even after seizing the > scan for the next page in line. If the scan has already finished > (according to moreLeft/moreRight), then why even try to seize the

Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible

2024-11-07 Thread Andres Freund
Hi, On 2024-11-07 14:29:18 -0800, Jacob Champion wrote: > On Thu, Nov 7, 2024 at 1:37 PM Andres Freund wrote: > > > - the pre-auth step must always initialize the entire pgstat struct > > > > Correct. And that has to happen exactly once, not twice. > > What goes wrong if it happens twice? Prima

Re: [bug fix] prepared transaction might be lost when max_prepared_transactions is zero on the subscriber

2024-11-07 Thread Tom Lane
Amit Kapila writes: > On Tue, Aug 20, 2024 at 2:01 PM shveta malik wrote: >> Looks good to me. Please find backported patches attached. > Pushed. I came across this commit while preparing release notes, and I'm worried about whether it doesn't create more problems than it solves. The intent sta

Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible

2024-11-07 Thread Andres Freund
Hi, On 2024-11-07 10:44:25 -0800, Jacob Champion wrote: > On Thu, Nov 7, 2024 at 10:12 AM Andres Freund wrote: > > I don't understand why the pgstat_bestart()/pgstat_bestart_pre_auth() split > > makes sense. The latter is going to redo most of the work that the former > > did. What's the point of

Re: Popcount optimization using AVX512

2024-11-07 Thread Nathan Bossart
Committed. -- nathan

Re: Commit Timestamp and LSN Inversion issue

2024-11-07 Thread Jan Wieck
On 11/7/24 13:19, Andres Freund wrote: I think it's *completely* unacceptable to call a hook inside ReserveXLogInsertLocation, with the spinlock held, no less. That's the most contended section of code in postgres. Aside from your technical concerns, can we at least agree that the commit-ts vs

Re: Popcount optimization using AVX512

2024-11-07 Thread Nathan Bossart
On Thu, Nov 07, 2024 at 08:38:21PM +, Devulapalli, Raghuveer wrote: > >> Of course, as soon as I committed this, I noticed that it's broken. It >> seems that >> compilers are rather picky about how multiple target options are specified. > > Just curious, which compiler complained? Clang.

RE: Popcount optimization using AVX512

2024-11-07 Thread Devulapalli, Raghuveer
> Of course, as soon as I committed this, I noticed that it's broken. It seems > that > compilers are rather picky about how multiple target options are specified. Just curious, which compiler complained? Raghuveer

Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Devulapalli, Raghuveer
Based on the discussion in PostgreSQL: Re: Proposal for Updating CRC32C with AVX-512 Algorithm., this patch leverages pg_attribute_target to build the SSE42 CRC32C code using function attributes. Raghuveer v1-0001-Use-__attribu

RE: Proposal for Updating CRC32C with AVX-512 Algorithm.

2024-11-07 Thread Devulapalli, Raghuveer
> Would you mind moving the function attribute change for the existing SSE > 4.2 code to its own patch? I think that is pretty straightforward, and IMHO > it'd be > nice to take care of it first so that we can focus on the new stuff. Just submitted a separate patch for this. Will update the CRC3

Re: Add missing tab completion for ALTER TABLE ADD COLUMN IF NOT EXISTS

2024-11-07 Thread Karina Litskevich
I looked through the new set of patches. On Thu, Nov 7, 2024 at 2:42 PM Kirill Reshke wrote: > v3-0002 patch actually mixes two types of completion. First one, which > adds a data type completion for ADD ATTRIBUTE, is pretty useful. > similar to existing tab completion for `ALTER TABLE xxx ADD [I

Re: not null constraints, again

2024-11-07 Thread Alvaro Herrera
On 2024-Nov-07, jian he wrote: > RemoveInheritance > if (copy_con->coninhcount <= 0) /* shouldn't happen */ > elog(ERROR, "relation %u has non-inherited constraint \"%s\"", > RelationGetRelid(child_rel), NameStr(copy_con->conname)); > dropconstraint

Re: per backend I/O statistics

2024-11-07 Thread Bertrand Drouvot
Hi, On Thu, Nov 07, 2024 at 09:50:59AM +0900, Michael Paquier wrote: > On Wed, Nov 06, 2024 at 01:51:02PM +, Bertrand Drouvot wrote: > > That's not needed, the patch I'm working on stores the proc number in the > > objid field of the key. > > Relying on the procnumber for the object ID gets a

Re: doc fail about ALTER TABLE ATTACH re. NO INHERIT

2024-11-07 Thread Alvaro Herrera
On 2024-Nov-07, Amit Langote wrote: > On Wed, Nov 6, 2024 at 9:34 PM Alvaro Herrera wrote: > > Oh, hmm, that makes sense I guess. Still, while this restriction makes > > sense for inheritance, it doesn't IMO for partitioned tables. I would > > even suggest that we drop enforcement of this rest

Re: magical eref alias names

2024-11-07 Thread Robert Haas
On Thu, Nov 7, 2024 at 4:07 PM Tom Lane wrote: > Is there some strong reason to insist on making that core-dump-risking > change, rather than simply assigning the now-one-size-fits-all alias > when creating Alias nodes? What I'm unhappy about is not being able to tell the difference between a nam

RE: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Devulapalli, Raghuveer
> +__attribute__((target("sse4.2"))) > > These need to be surrounded with > > #if defined(__has_attribute) && __has_attribute (target) > > so that we still attempt the check on compilers that don't support it (e.g., > MSVC). I assumed configure was only used on linux and ignored this

Re: index prefetching

2024-11-07 Thread Tomas Vondra
On 11/7/24 18:55, Peter Geoghegan wrote: > On Thu, Nov 7, 2024 at 10:03 AM Tomas Vondra wrote: >> The primary reason why I kept amgettuple() as is, and added a new AM >> callback for the "batch" mode is backwards compatibility. I did not want >> to force all AMs to do this, I think it should be op

Re: magical eref alias names

2024-11-07 Thread Tom Lane
BTW, one aspect of this proposal that needs to be discussed is that it can break existing SQL. An example discussed nearby[1] is regression=# select * from (values (1,7), (3,4) order by "*VALUES*".column2); column1 | column2 -+- 3 | 4 1 | 7 (2 rows) We

Re: Use __attribute__((target(sse4.2))) for SSE42 CRC32C

2024-11-07 Thread Nathan Bossart
On Thu, Nov 07, 2024 at 09:30:32PM +, Devulapalli, Raghuveer wrote: >> # Check for Intel SSE 4.2 intrinsics to do CRC calculations. >> # >> -# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used >> -# >> with the default compiler flags. If not, check if adding the -msse4

Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible

2024-11-07 Thread Andres Freund
Hi, On 2024-11-07 12:11:46 -0800, Jacob Champion wrote: > On Thu, Nov 7, 2024 at 11:41 AM Andres Freund wrote: > > I think the patch should not be merged as-is. It's just too ugly and > > fragile. > > Understood; I'm trying to find a way forward, and I'm pointing out > that the alternatives I'v

Re: Commit Timestamp and LSN Inversion issue

2024-11-07 Thread Andres Freund
Hi, On 2024-11-07 15:05:31 -0500, Jan Wieck wrote: > On 11/7/24 13:19, Andres Freund wrote: > > I think it's *completely* unacceptable to call a hook inside > > ReserveXLogInsertLocation, with the spinlock held, no less. That's the most > > contended section of code in postgres. > > Aside from yo

Re: magical eref alias names

2024-11-07 Thread Tom Lane
Robert Haas writes: > On Thu, Nov 7, 2024 at 4:07 PM Tom Lane wrote: >> Is there some strong reason to insist on making that core-dump-risking >> change, rather than simply assigning the now-one-size-fits-all alias >> when creating Alias nodes? > What I'm unhappy about is not being able to tell

Re: general purpose array_sort

2024-11-07 Thread Michael Paquier
On Thu, Nov 07, 2024 at 09:29:05AM -0500, Robert Haas wrote: > Yes, I think that case needs to error out. It seems best to identify > the ordering operator before you decide whether or not you have >1 > element. +1. -- Michael signature.asc Description: PGP signature

Re: New "single" COPY format

2024-11-07 Thread Masahiko Sawada
Hi, On Thu, Nov 7, 2024 at 8:16 AM Joel Jacobson wrote: > > Hi hackers, > > Thread [1] renamed, since the format name has now been changed from 'raw' to > 'single', as suggested by Andrew Dunstan and Jacob Champion. > > [1] https://postgr.es/m/c12516b1-77dc-4ad3-94a7-88527360a...@app.fastmail.com

Re: Deleting older versions in unique indexes to avoid page splits

2024-11-07 Thread Andy Fan
Peter Geoghegan writes: Hi Peter, I think I understand the main idea now with your help, I'd like to repeat my understanding for your double check. > On Thu, Nov 7, 2024 at 3:05 AM Andy Fan wrote: >> So my questions are: (a) How does the "logically unchanged index" hint >> can be helpful for

Re: Virtual generated columns

2024-11-07 Thread Dean Rasheed
On Tue, 5 Nov 2024 at 16:17, Peter Eisentraut wrote: > > New patch version. In expand_generated_columns_in_expr(): +/* + * XXX For the benefit of triggers, make two passes, so it covers + * PRS2_OLD_VARNO and PRS2_NEW_VARNO. + */ +node = expand_generated_c

Re: doc fail about ALTER TABLE ATTACH re. NO INHERIT

2024-11-07 Thread Amit Langote
On Wed, Nov 6, 2024 at 9:34 PM Alvaro Herrera wrote: > On 2024-Nov-06, Amit Langote wrote: > > On Tue, Nov 5, 2024 at 9:01 PM Alvaro Herrera > > wrote: > > > While doing final review for not-null constraints, I noticed that the > > > ALTER TABLE ATTACH PARTITION have this phrase: > > > > > >

failed optimization attempt for ProcArrayGroupClearXid(): using custom PGSemaphores that use __atomics and futexes batching via IO_URING

2024-11-07 Thread Jakub Wartak
Having little energy boost after meeting some VSP (Very Smart People) on recent PGConfEu, I've attempted to pursue optimization about apparently minor (?) inefficiency that I've spotted while researching extremely high active backends on extreme max_connections (measured in thousands active backend

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

2024-11-07 Thread Nisha Moond
On Mon, Sep 16, 2024 at 3:31 PM Bharath Rupireddy wrote: > > Please find the attached v46 patch having changes for the above review > comments and your test review comments and Shveta's review comments. > Hi, I’ve reviewed this thread and am interested in working on the remaining tasks and commen

Re: Virtual generated columns

2024-11-07 Thread Dean Rasheed
On Tue, 5 Nov 2024 at 16:17, Peter Eisentraut wrote: > > New patch version. What happened with the RLS support? It looks like you moved the code to expand virtual generated columns back to the first loop in fireRIRrules(), which doesn't work because RLS policies might contain references to virtua

Re: Pgoutput not capturing the generated columns

2024-11-07 Thread Amit Kapila
On Thu, Nov 7, 2024 at 12:03 PM Peter Eisentraut wrote: > > On 07.11.24 05:13, Amit Kapila wrote: > > On Wed, Nov 6, 2024 at 4:18 PM vignesh C wrote: > >> > >> The attached v50 version patch has the changes for the same. > > Could you (everybody on this thread) please provide guidance how this >

Re: pg_stat_statements: Avoid holding excessive lock

2024-11-07 Thread Karina Litskevich
On Thu, Nov 7, 2024 at 11:17 AM Michael Paquier wrote: > The comment could be simpler, say a "The spinlock is not required when > reading these two as they are always updated when holding pgss->lock > exclusively.". Or something like that. Thank you for your feedback and the shorter wording of t

Re: Adding NetBSD and OpenBSD to Postgres CI

2024-11-07 Thread Nazir Bilal Yavuz
Hi, Thanks for the feedback! On Fri, 1 Nov 2024 at 14:16, Peter Eisentraut wrote: > > On 01.11.24 10:17, Nazir Bilal Yavuz wrote: > > NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks > > are not added to the upstream Postgres yet. The attached patch adds > > NetBSD and Ope

Re: Slot's restart_lsn may point to removed WAL segment after hard restart unexpectedly

2024-11-07 Thread Vitaly Davydov
Dear Hackers,   I'd like to introduce an improved version of my patch (see the attached file). My original idea was to take into account saved on disk restart_lsn (slot→restart_lsn_flushed) for persistent slots when removing WAL segment files. It helps tackle errors like: ERROR: requested WAL s

Re: Add parallel columns for pg_stat_statements

2024-11-07 Thread Guillaume Lelarge
Le jeu. 7 nov. 2024 à 04:19, Michael Paquier a écrit : > On Wed, Oct 09, 2024 at 08:32:52AM +0900, Michael Paquier wrote: > > Okay, applied 0001 and 0002 then after a second lookup. I'll spend > > some more time thinking about 0003 and the other threads. > > Considered 0003, and I'm still not su

Re: altering a column's collation leaves an invalid foreign key

2024-11-07 Thread Peter Eisentraut
Here is a new patch that addresses all of your review comments. I also added an example of a problem in the commit message. On 25.10.24 08:27, jian he wrote: + * Note that we require that the collations of the referencing and the + * referenced column have the some notion of equality: Either

Re: general purpose array_sort

2024-11-07 Thread Robert Haas
On Thu, Nov 7, 2024 at 8:56 AM Junwang Zhao wrote: > Yeah, this is reasonable but one case I can't be sure: > > SELECT array_sort('{{2,3,4}}'::xid[]); > > This will return the array as is, but xid doesn't have a LT_OPR, should > I error out in this case? like: > > could not identify ordering opera

Re: Add missing tab completion for ALTER TABLE ADD COLUMN IF NOT EXISTS

2024-11-07 Thread Kirill Reshke
Hi, thank you for your feedback. On Wed, 6 Nov 2024 at 20:09, Karina Litskevich wrote: > > Hi Kirill, > > I looked through your patches. First of all, please note that TAB > completion doesn't have to complete all valid grammatical > constructions. See the comment on the top of tab-complete.in.c:

Re: Proposal for Updating CRC32C with AVX-512 Algorithm.

2024-11-07 Thread Andres Freund
Hi, On 2024-10-30 21:03:20 +, Devulapalli, Raghuveer wrote: > v6: Fixing build failure on Windows/MSVC. > > Raghuveer > From b601e7b4ee9f25fd32e9d8d056bb20a03d755a8a Mon Sep 17 00:00:00 2001 > From: Paul Amonson > Date: Mon, 6 May 2024 08:34:17 -0700 > Subject: [PATCH v6 1/6] Add a Postgre

Unsafe access BufferDescriptors array in BufferGetLSNAtomic()

2024-11-07 Thread Tender Wang
Hi, While learning gist index insert codes, I find a little issue with BufferGetLSNAtomic(). At first, it wants to get bufHdr by accessing the buffer descriptor array, as below: BufferDesc *bufHdr = GetBufferDescriptor(buffer - 1); However, it doesn't check whether the passed buffer is a local o

Re: Incremental Sort Cost Estimation Instability

2024-11-07 Thread Alena Rybakina
Hi! On 07.11.2024 08:57, Andrei Lepikhov wrote: On 10/8/24 11:33, Andrei Lepikhov wrote: On 9/23/24 20:02, Andrei Lepikhov wrote: On 12/9/2024 12:12, David Rowley wrote: On Thu, 12 Sept 2024 at 21:51, Andrei Lepikhov Minor change to make compiler and cfbot happy Now, this thread looks conne

Re: Linkify mentions of the primary/subscriber's max_replication_slots

2024-11-07 Thread Amit Kapila
On Thu, Nov 7, 2024 at 9:36 AM Tristan Partin wrote: > > > Here is a patch which does so. > Note that this parameter also applies on the subscriber side, but with - a different meaning. + a different meaning. See + in for more + details.

Re: Adding NetBSD and OpenBSD to Postgres CI

2024-11-07 Thread Andres Freund
Hi, On 2024-11-07 16:05:43 +0100, Peter Eisentraut wrote: > On 07.11.24 14:40, Nazir Bilal Yavuz wrote: > > > I noticed that neither the existing FreeBSD task nor the new OpenBSD one > > > find the bsd_auth.h header. I thought this would be good to get more > > > testing of that code. Do you kno

Re: altering a column's collation leaves an invalid foreign key

2024-11-07 Thread Peter Eisentraut
On 25.10.24 08:23, jian he wrote: ri_KeysEqual definitely deserves some comments. for rel_is_pk, the equality is collation agnostic; for rel_is_pk is false, the equality is collation aware. for example: DROP TABLE IF EXISTS fktable, pktable; CREATE TABLE pktable (x text COLLATE case_insensitive

Re: Fix for Extra Parenthesis in pgbench progress message

2024-11-07 Thread Fujii Masao
On 2024/11/07 10:41, Tatsuo Ishii wrote: The patch works perfectly for the case that there is one extra brace as shown in your example. However I think it will not work if there are two or more extra braces. Are you suggesting adding more space characters before the carriage return in the pro

Re: Eagerly scan all-visible pages to amortize aggressive vacuum

2024-11-07 Thread Andres Freund
Hi, On 2024-11-01 19:35:22 -0400, Melanie Plageman wrote: > It implements a new "semi-aggressive" vacuum. Semi-aggressive vacuums > eagerly scan some number of all-visible but not all-frozen pages in > hopes of freezing them. All-visible pages that are eagerly scanned and > set all-frozen in the v

Re: RFC: Extension Packaging & Lookup

2024-11-07 Thread David E. Wheeler
Hackers, On Oct 31, 2024, at 16:12, David E. Wheeler wrote: > I just thought of another one: Last week I tried to integrate all the ideas into this thread and the previous[1] into a single proposal that attempts to work through all the implications and issues. I’ve drafted it as a blog post[2

Re: Proposal for Updating CRC32C with AVX-512 Algorithm.

2024-11-07 Thread Nathan Bossart
On Tue, Oct 29, 2024 at 09:00:17PM +, Devulapalli, Raghuveer wrote: > (1) The SSE42 and AVX-512 CRC32C also use function attributes to build > with ISA specific flag.. Would you mind moving the function attribute change for the existing SSE 4.2 code to its own patch? I think that is pretty st

RE: Pgoutput not capturing the generated columns

2024-11-07 Thread Shinoda, Noriyoshi (SXD Japan FSIP)
Hi, Hackers. Thanks for developing this great feature. There seems to be a missing description of the "pubgencols" column added to the "pg_publication" catalog. The attached patch adds the description to the catalog.sgml file. Please fix the patch if you have a better explanation. Regards, Nori

Re: Adding NetBSD and OpenBSD to Postgres CI

2024-11-07 Thread Daniel Gustafsson
> On 1 Nov 2024, at 12:16, Peter Eisentraut wrote: > > On 01.11.24 10:17, Nazir Bilal Yavuz wrote: >> NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks are >> not added to the upstream Postgres yet. The attached patch adds NetBSD and >> OpenBSD tasks to the Postgres CI. >>

Re: Disallow UPDATE/DELETE on table with unpublished generated column as REPLICA IDENTITY

2024-11-07 Thread Amit Kapila
On Thu, Nov 7, 2024 at 11:04 AM Amit Kapila wrote: > > On Wed, Nov 6, 2024 at 5:48 PM Aleksander Alekseev > wrote: > > We should fix this in the HEAD and back branches. > BTW, I was thinking as to how to fix it on back branches and it seems we should restrict to define REPLICA IDENTITY on stored

Re: general purpose array_sort

2024-11-07 Thread Junwang Zhao
On Thu, Nov 7, 2024 at 10:29 PM Robert Haas wrote: > > On Thu, Nov 7, 2024 at 8:56 AM Junwang Zhao wrote: > > Yeah, this is reasonable but one case I can't be sure: > > > > SELECT array_sort('{{2,3,4}}'::xid[]); > > > > This will return the array as is, but xid doesn't have a LT_OPR, should > > I

Re: Vacuum statistics

2024-11-07 Thread Ilia Evdokimov
On 22.10.2024 22:30, Alena Rybakina wrote: Hi! On 16.10.2024 14:01, Alena Rybakina wrote: Thank you for rebasing. I have noticed that when I create a table or an index on this table, there is no information about the table or index in pg_stat_vacuum_tables and pg_stat_vacuum_indexes until

Re: Test to dump and restore objects left behind by regression

2024-11-07 Thread Ashutosh Bapat
Hi Tom and Michael, Thanks for your inputs. I am replying to all the comments in a single email arranging related comments together. On Thu, Oct 31, 2024 at 11:26 AM Michael Paquier wrote: > > On my laptop, testing the plain format adds roughly 12s, in a test > that now takes 1m20s to run vs 1m

Re: Avoiding superfluous buffer locking during nbtree backwards scans

2024-11-07 Thread Masahiro Ikeda
Hi, thanks for working on these improvements. I noticed an unexpected behavior where the index scan continues instead of stopping, even when it detects that there are no tuples that match the conditions. (I observed this while reviewing the skip scan patch, though it isn't directly related to

Re: Pgoutput not capturing the generated columns

2024-11-07 Thread Amit Kapila
On Thu, Nov 7, 2024 at 2:45 PM Shinoda, Noriyoshi (SXD Japan FSIP) wrote: > > Hi, Hackers. > > Thanks for developing this great feature. > There seems to be a missing description of the "pubgencols" column added to > the "pg_publication" catalog. The attached patch adds the description to the >

Re: general purpose array_sort

2024-11-07 Thread Junwang Zhao
Hi Michael, On Mon, Nov 4, 2024 at 1:46 PM Michael Paquier wrote: > > On Sun, Nov 03, 2024 at 11:33:05AM +0800, Junwang Zhao wrote: > > Rebase needed due to array_reverse committed, PFA v11. > > There has been another conflict since you have posted this version > (noticed that after my business i

Re: general purpose array_sort

2024-11-07 Thread Junwang Zhao
Hi jian, On Tue, Nov 5, 2024 at 3:13 PM jian he wrote: > > On Mon, Nov 4, 2024 at 7:34 PM Dean Rasheed wrote: > > > > Testing this with an array with non-default lower bounds, it fails to > > preserve the array bounds, which I think it should (note: > > array_reverse() and array_shuffle() do pre

Re: Proposal for Updating CRC32C with AVX-512 Algorithm.

2024-11-07 Thread Nathan Bossart
On Thu, Nov 07, 2024 at 11:05:14AM -0500, Andres Freund wrote: > On 2024-10-30 21:03:20 +, Devulapalli, Raghuveer wrote: >> From a495124ee42cb8f9f206f719b9f2235aff715963 Mon Sep 17 00:00:00 2001 >> From: Nathan Bossart >> Date: Wed, 16 Oct 2024 15:57:55 -0500 >> Subject: [PATCH v6 5/6] use __a

Re: Popcount optimization using AVX512

2024-11-07 Thread Andres Freund
Hi, On 2024-11-06 20:26:47 -0600, Nathan Bossart wrote: > From d0fb7e0e375f7b76d4df90910c21e9448dd3b380 Mon Sep 17 00:00:00 2001 > From: Nathan Bossart > Date: Wed, 16 Oct 2024 15:57:55 -0500 > Subject: [PATCH v3 1/1] use __attribute__((target(...))) for AVX-512 stuff One thing that'd I'd like t

Re: Commit Timestamp and LSN Inversion issue

2024-11-07 Thread Jan Wieck
On 11/6/24 21:30, Zhijie Hou (Fujitsu) wrote: Thanks for the patch! I am reading the patch and noticed few minor things. 1. + /* +* This is a local transaction. Make sure that the xact_time +* higher than any timestamp we have seen thus far. +* +* TODO: Thi

New "single" COPY format

2024-11-07 Thread Joel Jacobson
Hi hackers, Thread [1] renamed, since the format name has now been changed from 'raw' to 'single', as suggested by Andrew Dunstan and Jacob Champion. [1] https://postgr.es/m/c12516b1-77dc-4ad3-94a7-88527360a...@app.fastmail.com Recap: This is about adding support to import/export text-based form

Re: Deleting older versions in unique indexes to avoid page splits

2024-11-07 Thread Andy Fan
Hi Peter, Sorry for bringing up so old thread since I have some troubles to understand what is going on here. I'd start with something I can understand then raise my question I have right now. > > The difference here is that we're simply making an intelligent guess > -- there have been no index

Re: doc: pgevent.dll location

2024-11-07 Thread Dave Page
Hi On Wed, 6 Nov 2024 at 16:11, Peter Eisentraut wrote: > On 06.11.24 13:57, Ryohei Takahashi (Fujitsu) wrote: > > The dll install paths are changed as follows on Windows. > > > > (1) pgevent.dll > > PG16: lib/ > > PG17: bin/ > > > > (2) dll for user (like libpq.dll, libecpg.dll) > > PG16: Both

Re: pg_stat_statements: Avoid holding excessive lock

2024-11-07 Thread Michael Paquier
On Tue, Nov 05, 2024 at 08:37:08PM +0300, Karina Litskevich wrote: > I suggest eliminating holding the excessive lock. See the attached patch. > This would also restore the consistency between the code and the comments > about entry's mutex spinlock usage. You are right. minmax_stats_since and st

Re: UUID v7

2024-11-07 Thread Andrey M. Borodin
> On 7 Nov 2024, at 12:42, Masahiko Sawada wrote: > > On Wed, Nov 6, 2024 at 10:14 AM Andrey M. Borodin > wrote: >> >> >> >>> On 5 Nov 2024, at 23:56, Andrey M. Borodin wrote: >>> >>> >> >> Some more thoughts on this patch version: >> >> 0. Comment mentioning nanoseconds, while we do

Re: define pg_structiszero(addr, s, r)

2024-11-07 Thread Bertrand Drouvot
Hi, On Thu, Nov 07, 2024 at 09:44:32AM +0900, Michael Paquier wrote: > On Thu, Nov 07, 2024 at 08:10:17AM +1300, David Rowley wrote: > > Did you try with a size where there's a decent remainder, say 124 > > bytes? FWIW, one of the cases has 112 bytes, and I think that is > > aligned memory meaning

Re: define pg_structiszero(addr, s, r)

2024-11-07 Thread Bertrand Drouvot
Hi, On Thu, Nov 07, 2024 at 09:45:44AM +0900, Michael Paquier wrote: > On Thu, Nov 07, 2024 at 08:05:10AM +1300, David Rowley wrote: > > That might be quite good for small lengths or for use cases where the > > memory is always or almost always zero. The problem is there's no > > early exit when y

PoC: Simplify recovery after dropping a table by LOGGING the restore LSN

2024-11-07 Thread Kirk Wolak
Hackers, The concept was driven by an all too common support request. A user accidentally dropped the wrong table. (this could also be applied to dropping a database, etc). If we had the LSN before the drop, this would be easier. So we actually log the LSN when the lock is required so that

Re: not null constraints, again

2024-11-07 Thread jian he
> > Here's v11, which I intended to commit today, but didn't get around to. > CI is happy with it, so I'll probably do it tomorrow first thing. > CREATE TABLE notnull_tbl2 (a INTEGER CONSTRAINT blah NOT NULL, b INTEGER CONSTRAINT blah NOT NULL); RelationGetNotNullConstraints, StoreRelNotNull will

Re: Deleting older versions in unique indexes to avoid page splits

2024-11-07 Thread Andy Fan
Peter Geoghegan writes: > On Thu, Nov 7, 2024 at 7:38 PM Andy Fan wrote: >> If the delete goes with Index Scan of t_b_idx, we still have the chances >> to mark hints on t_b_idx, so that it can be useful during index split? > > The exact rules for when LP_DEAD bits are set are a bit complicated,

Re: Incremental Sort Cost Estimation Instability

2024-11-07 Thread Andrei Lepikhov
On 11/7/24 18:06, Alena Rybakina wrote: On 07.11.2024 08:57, Andrei Lepikhov wrote: That happens because when estimating the number of groups, Postgres doesn't consider EquivalenceClass, which can let him correct group estimation at a low price. It may be done inside the make_pathkeys_for_sortc

Re: Parallel workers stats in pg_stat_database

2024-11-07 Thread Michael Paquier
On Thu, Nov 07, 2024 at 02:36:58PM +0900, Michael Paquier wrote: > Incorrect comment format, about which pgindent does not complain.. > > .. But pgindent complains in execMain.c and pgstat_database.c. These > are only nits, the patch is fine. If anybody has objections or > comments, feel free.

  1   2   >