Re: SQL/JSON query functions context_item doc entry and type requirement

2024-06-16 Thread Amit Langote
Hi, On Tue, Jun 4, 2024 at 12:11 AM jian he wrote: > > hi > based on gram.y and function transformJsonValueExpr. > > gram.y: > | JSON_QUERY '(' > json_value_expr ',' a_expr json_passing_clause_opt > json_returning_clause_opt > json_wrapper_behavior > json_quotes_clause_opt > json_behavior_clause_

Re: Pgoutput not capturing the generated columns

2024-06-16 Thread vignesh C
On Fri, 14 Jun 2024 at 15:52, Shubham Khanna wrote: > > > Thanks for the updated patch, few comments: > > 1) The option name seems wrong here: > > In one place include_generated_column is specified and other place > > include_generated_columns is specified: > > > > + else if (IsSet(s

Re: Pgoutput not capturing the generated columns

2024-06-16 Thread Shlok Kyal
On Fri, 14 Jun 2024 at 15:52, Shubham Khanna wrote: > > The attached Patch contains the suggested changes. > Hi Shubham, thanks for providing a patch. I have some comments for v6-0001. 1. create_subscription.sgml There is repetition of the same line. + + Specifies whether the

Separate HEAP WAL replay logic into its own file

2024-06-16 Thread Li, Yong
Hi PostgreSQL hackers, For most access methods in PostgreSQL, the implementation of the access method itself and the implementation of its WAL replay logic are organized in separate source files. However, the HEAP access method is an exception. Both the access method and the WAL replay logic

Re: ON ERROR in json_query and the like

2024-06-16 Thread Amit Langote
Hi, (apologies for not replying to this thread sooner) On Tue, May 28, 2024 at 6:57 PM Pavel Stehule wrote: > út 28. 5. 2024 v 11:29 odesílatel Markus Winand > napsal: >> >> Hi! >> >> I’ve noticed two “surprising” (to me) behaviors related to >> the “ON ERROR” clause of the new JSON query func

Re: Conflict Detection and Resolution

2024-06-16 Thread Amit Kapila
On Mon, Jun 17, 2024 at 4:18 AM Tomas Vondra wrote: > > On 6/14/24 13:29, Amit Kapila wrote: > > On Fri, Jun 14, 2024 at 12:10 AM Robert Haas wrote: > >> > >> On Thu, May 23, 2024 at 2:37 AM shveta malik > >> wrote: > >>> c) update_deleted: The row with the same value as that incoming > >>> upd

Re: minor doc change in src/sgml/xfunc.sgml

2024-06-16 Thread Michael Paquier
On Mon, Jun 17, 2024 at 11:24:09AM +0800, jian he wrote: > in > https://www.postgresql.org/docs/devel//xfunc-c.html#XFUNC-ADDIN-INJECTION-POINTS > do we need to add a sentence like " An injections points usage example > can be found in src/test/modules/injection_points in the PostgreSQL > source t

Re: BF mamba failure

2024-06-16 Thread Michael Paquier
On Fri, Jun 14, 2024 at 02:31:37PM +0900, Michael Paquier wrote: > I don't think that this is going to fly far except if we introduce a > concept of "generation" or "age" in the stats entries. The idea is > simple: when a stats entry is reinitialized because of a drop&create, > increment a counter

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

2024-06-16 Thread Andrei Lepikhov
On 6/14/24 19:00, Alexander Korotkov wrote: This patch could use some polishing, but I'd like to first hear some feedback on general design. Thanks for your time and efforts. I have skimmed through the code—there is a minor fix in the attachment. First and foremost, I think this approach can su

minor doc change in src/sgml/xfunc.sgml

2024-06-16 Thread jian he
hi. simlar to https://www.postgresql.org/docs/devel//xfunc-c.html#XFUNC-ADDIN-WAIT-EVENTS in https://www.postgresql.org/docs/devel//xfunc-c.html#XFUNC-ADDIN-INJECTION-POINTS do we need to add a sentence like " An injections points usage example can be found in src/test/modules/injection_points

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Thomas Munro
On Mon, Jun 17, 2024 at 1:36 PM Thomas Munro wrote: > Perhaps it's technically possible to build Python without the ctypes > module, but I'm not sure and I don't see anywhere that describes it > explicitly as optional. One clue is that they used to bundle their own copy of libffi before Python 3.

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Thomas Munro
On Mon, Jun 17, 2024 at 12:34 PM Tom Lane wrote: > Thomas Munro writes: > > Really this is mostly about libffi, which is > > super widely ported, and it is required by Python > > BTW, what form does that "requirement" take exactly? I see no > evidence that the core python3 executable is linked t

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Tom Lane
I wrote: > Andres Freund writes: >> macports even has a platypus package, so that should be easy. > Less easy if you don't want to depend on macports or homebrew. I tried "sudo cpan install FFI::Platypus" against macOS Sonoma's base-system perl. It seemed to compile all right, but a nontrivial

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Tom Lane
Thomas Munro writes: > Really this is mostly about libffi, which is > super widely ported, and it is required by Python BTW, what form does that "requirement" take exactly? I see no evidence that the core python3 executable is linked to libffi on any of the machines I checked.

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Tom Lane
Andres Freund writes: > On 2024-06-17 12:03:28 +1200, Thomas Munro wrote: >> And then maybe Macs if Tom doesn't beat me to it. > macports even has a platypus package, so that should be easy. Less easy if you don't want to depend on macports or homebrew. However, I see something a bit promising-l

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Andres Freund
Hi, On 2024-06-17 12:03:28 +1200, Thomas Munro wrote: > And then maybe Macs if Tom doesn't beat me to it. macports even has a platypus package, so that should be easy. For CI it should suffice to add p5.34-ffi-platypus to the list of packages in macos' setup_additional_packages_script, they then

Re: Conflict Detection and Resolution

2024-06-16 Thread Tomas Vondra
On 6/13/24 06:52, Dilip Kumar wrote: > On Wed, Jun 12, 2024 at 5:26 PM Tomas Vondra > wrote: >> I agree having a separate update_deleted conflict would be beneficial, I'm not arguing against that - my point is actually that I think this conflict type is required, and that it need

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Thomas Munro
On Mon, Jun 17, 2024 at 10:57 AM Thomas Munro wrote: > I'm personally willing to test/validate on the full set of non-Linux > Unixen and write up the install instructions to help eg build farm > animal owners adjust. I created a page where we can log "works/doesn't work" and "installed how" infor

ecdh support causes unnecessary roundtrips

2024-06-16 Thread Andres Freund
Hi, When connecting with a libpq based client, the TLS establishment ends up like this in many configurations; C->S: TLSv1 393 Client Hello S->C: TLSv1.3 167 Hello Retry Request, Change Cipher Spec C->S: TLSv1.3 432 Change Cipher Spec, Client Hello S->C: TLSv1.3 1407 Server Hello, Application Dat

Re: assertion failure at cost_memoize_rescan()

2024-06-16 Thread David Rowley
On Mon, 17 Jun 2024 at 10:23, Tomas Vondra wrote: > Interesting. Seems like a bug due to the two places clamping the values > inconsistently. It probably does not matter in other contexts because we > don't subtract the values like this, but here it triggers the assert. > > I guess the simplest fi

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Andres Freund
Hi, On 2024-06-16 19:07:49 -0400, Tom Lane wrote: > Thomas Munro writes: > > On Mon, Jun 17, 2024 at 10:38 AM Andres Freund wrote: > >> I'm somewhat doubtful we'll just agree on making FFI::Platypus a hard > >> dependency, but if we agree to do so... > > > Why can't we just do that? I mean, do

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Tom Lane
Thomas Munro writes: > On Mon, Jun 17, 2024 at 10:38 AM Andres Freund wrote: >> I'm somewhat doubtful we'll just agree on making FFI::Platypus a hard >> dependency, but if we agree to do so... > Why can't we just do that? I mean, do we have any concrete reason to > think that it'll block a supp

Re: race condition in pg_class

2024-06-16 Thread Michael Paquier
On Sun, Jun 16, 2024 at 07:07:08AM -0700, Noah Misch wrote: > It would be odd to detect exactly 0x0B00U and not other invalid inputs, > like 0x0A01U where only 0x0B01U is valid. I'm attaching roughly what > it would take. Shall I squash this into inplace031? Agreed that merging both

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Thomas Munro
On Mon, Jun 17, 2024 at 10:38 AM Andres Freund wrote: > before: > > [19:40:47.468] 135/296 postgresql:pg_amcheck / pg_amcheck/004_verify_heapam > OK7.70s 32 subtests passed > [19:43:40.853] 232/296 postgresql:amcheck / amcheck/001_verify_heapam

Re: Conflict Detection and Resolution

2024-06-16 Thread Tomas Vondra
On 6/14/24 13:29, Amit Kapila wrote: > On Fri, Jun 14, 2024 at 12:10 AM Robert Haas wrote: >> >> On Thu, May 23, 2024 at 2:37 AM shveta malik wrote: >>> c) update_deleted: The row with the same value as that incoming >>> update's key does not exist. The row is already deleted. This conflict >>

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Andres Freund
Hi, On 2024-06-16 17:43:05 -0400, Andrew Dunstan wrote: > On Fri, Jun 14, 2024 at 12:25 PM Andres Freund wrote: > I guess it's a question of how widely available FFI::Platypus is. I know > it's available pretty much out of the box on Strawberry Perl and Msys2' > ucrt perl. FWIW I hacked a bit on

Re: assertion failure at cost_memoize_rescan()

2024-06-16 Thread Tomas Vondra
On 6/14/24 14:54, Kohei KaiGai wrote: > ... > > I tracked the behavior of estimate_num_groups() using gdb line-by-line to > observe how 'input_rows' is changed > and how it affects the result value. > According to the call trace, the problematic estimate_num_groups() > invocation is called with "in

Re: Inval reliability, especially for inplace updates

2024-06-16 Thread Noah Misch
On Sat, Jun 15, 2024 at 03:37:18PM -0700, Noah Misch wrote: > I'm attaching the implementation. I'm withdrawing inplace150-inval-durability-atcommit-v1.patch, having found two major problems so far: 1. It sends transactional invalidation messages before ProcArrayEndTransaction(), so other back

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Andrew Dunstan
On Fri, Jun 14, 2024 at 12:25 PM Andres Freund wrote: > Hi, > > On 2024-06-14 11:11:38 -0400, Andrew Dunstan wrote: > > On 2024-06-14 Fr 11:09, Andrew Dunstan wrote: > > > Over at [1] Andres expressed enthusiasm for enabling TAP tests to call > > > LibPQ directly via FFI, and there was some suppo

Re: RFC: adding pytest as a supported test framework

2024-06-16 Thread Robert Haas
On Sat, Jun 15, 2024 at 6:00 PM Melanie Plageman wrote: > > Those young-uns are also the same group who hold their nose when coding in > > C, and are always clamoring for rewriting Postgres in Rust. And before > > that, C++. And next year, some other popular language that is clearly > > better

Re: Remove distprep

2024-06-16 Thread Alvaro Herrera
On 2024-Jun-16, Noah Misch wrote: > These broke the > https://www.postgresql.org/docs/17/installation-platform-notes.html#INSTALLATION-NOTES-MINGW > build, where LN_S='cp -pR'. On other platforms, "make LN_S='cp -pR'" > reproduces this. Reverting the above lines fixes things. The buildfarm has

Re: Remove distprep

2024-06-16 Thread Noah Misch
On Thu, Oct 05, 2023 at 05:46:46PM +0200, Peter Eisentraut wrote: > --- a/src/backend/Makefile > +++ b/src/backend/Makefile > $(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h > - prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ > - cd '$(dir $@)' && rm -f $

Re: proposal: plpgsql, new check for extra_errors - strict_expr_check

2024-06-16 Thread Pavel Stehule
ne 16. 6. 2024 v 19:36 odesílatel Marcos Pegoraro napsal: > Em dom., 16 de jun. de 2024 às 12:11, Pavel Stehule < > pavel.steh...@gmail.com> escreveu: > >> I don't follow this idea - when it does not make sense, then why do you >> use it? It can be a signal of some issue in your code. >> >>> > I

Re: Bugfix and improvements in multixact.c

2024-06-16 Thread Heikki Linnakangas
On 14/06/2024 16:56, Maxim Orlov wrote: +static inline int +MXOffsetToFlagsOffset(MultiXactOffset offset) +{ + int flagsoff; + + offset /= MULTIXACT_MEMBERS_PER_MEMBERGROUP; + offset %= MULTIXACT_MEMBERGROUPS_PER_PAGE; + flagsoff = offset * MULTIXACT_MEMBERGROU

Re: proposal: plpgsql, new check for extra_errors - strict_expr_check

2024-06-16 Thread Marcos Pegoraro
Em dom., 16 de jun. de 2024 às 12:11, Pavel Stehule escreveu: > I don't follow this idea - when it does not make sense, then why do you > use it? It can be a signal of some issue in your code. > >> I don't use it, but sometimes it occurs, and there are lots of languages which ignore it, so it wo

Re: Removing unneeded self joins

2024-06-16 Thread Alexander Korotkov
Hi! On Thu, Jun 13, 2024 at 6:45 AM Andrei Lepikhov wrote: > On 5/7/24 02:59, Robert Haas wrote: > > On Mon, May 6, 2024 at 3:27 PM Alexander Korotkov > > wrote: > >> I agree it was a hurry to put the plan into commit message. I think > >> Tom already gave valuable feedback [1] and probably we

Re: The content of the column_name field in the error response for a constraint violation

2024-06-16 Thread Tom Lane
arkhipov...@gmail.com writes: > I noticed that the error response for a constraint violation only contains > the column name for not-null constraints. I'm confused because the field > isn't present when other types of constraints are triggered, such as unique, > foreign keys, and check constrain

Re: jsonpath: Missing regex_like && starts with Errors?

2024-06-16 Thread David E. Wheeler
On Jun 15, 2024, at 12:23, Chapman Flack wrote: > I see. Yes, that documentation now says "predicate check expressions return > the single three-valued result of the predicate: true, false, or unknown". It has been there since jsonpath was introduced in v12[1]: > A path expression can be a Bool

Re: proposal: plpgsql, new check for extra_errors - strict_expr_check

2024-06-16 Thread Pavel Stehule
ne 16. 6. 2024 v 16:43 odesílatel Marcos Pegoraro napsal: > Em dom., 16 de jun. de 2024 às 11:37, Pavel Stehule < > pavel.steh...@gmail.com> escreveu: > >> >> What is the expected benefit? Generally PL/pgSQL has very strict syntax - >> and using double semicolons makes no sense. >> >> exactly, ma

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Andrew Dunstan
On Fri, Jun 14, 2024 at 7:42 PM Thomas Munro wrote: > On Sat, Jun 15, 2024 at 3:33 AM Robert Haas wrote: > > I haven't reviewed the patch, but a big +1 for the idea. Not only this > > might cut down on the resource costs of running the tests in CI, as > > It would be good to keep some context be

Re: Using LibPq in TAP tests via FFI

2024-06-16 Thread Andrew Dunstan
On Fri, Jun 14, 2024 at 11:40 AM Andres Freund wrote: > Hi, > > On June 14, 2024 8:09:43 AM PDT, Andrew Dunstan > wrote: > >Over at [1] Andres expressed enthusiasm for enabling TAP tests to call > LibPQ directly via FFI, and there was some support from others as well. > Attached is a very rough

Re: proposal: plpgsql, new check for extra_errors - strict_expr_check

2024-06-16 Thread Marcos Pegoraro
Em dom., 16 de jun. de 2024 às 11:37, Pavel Stehule escreveu: > > What is the expected benefit? Generally PL/pgSQL has very strict syntax - > and using double semicolons makes no sense. > > exactly, makes no sense. That is because it should be ignored, right ? But ok, if this is a different issue

Re: proposal: plpgsql, new check for extra_errors - strict_expr_check

2024-06-16 Thread Pavel Stehule
Hi ne 16. 6. 2024 v 16:22 odesílatel Marcos Pegoraro napsal: > Can you remove or just ignore double ; too ? > I don't know - it is a different issue. PLpgSQL allows zero statements inside block, so you can write BEGIN END or IF 1 THEN END IF but it doesn't allow empty statement like ;; proba

Re: proposal: plpgsql, new check for extra_errors - strict_expr_check

2024-06-16 Thread Marcos Pegoraro
Can you remove or just ignore double ; too ? postgres=# do $$ declare var_x integer; begin var_x = 99;; delete from x where x = var_x; end; $$; ERROR: syntax error at or near ";" LINE 1: do $$ declare var_x integer; begin var_x = 99;; delete from ... Atenciosamente, Em dom., 16 de jun. d

proposal: plpgsql, new check for extra_errors - strict_expr_check

2024-06-16 Thread Pavel Stehule
Hi, assigned patch try to solve issue reported by Mor Lehr (Missing semicolon in anonymous plpgsql block does not raise syntax error). https://www.postgresql.org/message-id/CALyvM2bp_CXMH_Gyq87pmHJRuZDEhV40u9VP8rX=canet2w...@mail.gmail.com by introducing a new extra error check. With this check

Re: race condition in pg_class

2024-06-16 Thread Noah Misch
On Sun, Jun 16, 2024 at 09:28:05AM +0900, Michael Paquier wrote: > On Thu, Jun 13, 2024 at 07:42:25PM -0700, Noah Misch wrote: > > On Fri, Jun 14, 2024 at 09:58:59AM +0900, Michael Paquier wrote: > >> GetWaitEventCustomIdentifier() is incorrect, and should return > >> "InjectionPoint" in the defaul

Re: Backup and Restore of Partitioned Table in PG-15

2024-06-16 Thread Muhammad Ikram
Hi Gayatri Singh, Could you try pgBackRest ? Its advantages are speed, support for incremental backups, minimal locking, and robust point in time recovery options besides several advanced features. Best suites for large-scale and critical PostgreSQL deployments. Regards, Muhammad Ikram Bitnine G

Re: create role manual

2024-06-16 Thread Tatsuo Ishii
> On Sat, Jun 15, 2024 at 7:25 PM Tatsuo Ishii wrote: > >>The rules for which initial >>role membership options are enabled described below in the >>IN ROLE, ROLE, and >>ADMIN clauses. >> >> Maybe we need "are" in front of "described"? >> >> > Agreed. Thank you for the confirmati