Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2024-03-26 Thread Dean Rasheed
On Thu, 21 Mar 2024 at 09:35, Dean Rasheed wrote: > > Trivial rebase forced by 6185c9737c. > I think it would be good to get this committed. It has had a decent amount of review, at least up to v9, but a number of things have changed since then: 1). Concurrent update behaviour -- now if a

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2024-03-13 Thread Dean Rasheed
Rebased version attached. Regards, Dean diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml new file mode 100644 index f8f83d4..380d0c9 --- a/doc/src/sgml/mvcc.sgml +++ b/doc/src/sgml/mvcc.sgml @@ -394,10 +394,14 @@ conditions for each action are re-evaluated on the updated version

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2024-01-29 Thread Dean Rasheed
On Fri, 26 Jan 2024 at 15:57, Alvaro Herrera wrote: > > Well, firstly this is clearly a feature we want to have, even though > it's non-standard, because people use it and other implementations have > it. (Eh, so maybe somebody should be talking to the SQL standard > committee about it). As for

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2024-01-26 Thread Alvaro Herrera
On 2024-Jan-26, Dean Rasheed wrote: > I think it has had a decent amount of review and all the review > comments have been addressed. I'm not quite sure from Alvaro's last > comment whether he was implying that he thought it was ready for > commit. Well, firstly this is clearly a feature we want

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2024-01-26 Thread Dean Rasheed
n Fri, 26 Jan 2024 at 14:59, vignesh C wrote: > > CFBot shows that the patch does not apply anymore as in [1]: > Rebased version attached. Regards, Dean diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml new file mode 100644 index f8f83d4..6ef0c2b --- a/doc/src/sgml/mvcc.sgml +++

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2024-01-26 Thread Dean Rasheed
On Mon, 22 Jan 2024 at 02:10, Peter Smith wrote: > > Hi, this patch was marked in CF as "Needs Review" [1], but there has > been no activity on this thread for 6+ months. > > Is anything else planned? Can you post something to elicit more > interest in the latest patch? Otherwise, if nothing

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2024-01-26 Thread vignesh C
ibility, and to be > SQL-standard-compliant. If there are any WHEN NOT MATCHED BY SOURCE > actions though, I think it's preferable to output explicit "BY SOURCE" > and "BY TARGET" qualifiers for all not-matched actions, to make the > meaning clearer. CFBot shows that the

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2024-01-21 Thread Peter Smith
Hi, this patch was marked in CF as "Needs Review" [1], but there has been no activity on this thread for 6+ months. Is anything else planned? Can you post something to elicit more interest in the latest patch? Otherwise, if nothing happens then the CF entry will be closed ("Returned with

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-07-01 Thread Dean Rasheed
On Tue, 21 Mar 2023 at 12:26, Alvaro Herrera wrote: > > On 2023-Mar-21, Dean Rasheed wrote: > > > Looking at it with fresh eyes though, I realise that I could have just > > written > > > > action->qual = make_and_qual((Node *) ntest, action->qual); > > > > which is equivalent, but more

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-03-21 Thread Alvaro Herrera
On 2023-Mar-21, Dean Rasheed wrote: > Looking at it with fresh eyes though, I realise that I could have just written > > action->qual = make_and_qual((Node *) ntest, action->qual); > > which is equivalent, but more concise. Nice. I have no further observations about this patch. --

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-03-21 Thread Dean Rasheed
On Tue, 21 Mar 2023 at 10:28, Alvaro Herrera wrote: > > > + /* Combine it with the action's WHEN condition */ > > + if (action->qual == NULL) > > + action->qual = (Node *) ntest; > > + else > > +

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-03-21 Thread Alvaro Herrera
On 2023-Mar-19, Dean Rasheed wrote: > diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y > new file mode 100644 > index efe88cc..e1ebc8d > --- a/src/backend/parser/gram.y > +++ b/src/backend/parser/gram.y > +merge_when_tgt_matched: > + WHEN MATCHED

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-03-19 Thread Dean Rasheed
I see the PlaceHolderVar issue turned out to be a pre-existing bug after all. Rebased version attached. Regards, Dean diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml new file mode 100644 index b87ad5c..1482ede --- a/doc/src/sgml/mvcc.sgml +++ b/doc/src/sgml/mvcc.sgml @@ -396,8 +396,8

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-02-25 Thread Vik Fearing
On 1/4/23 12:57, Alvaro Herrera wrote: I haven't read this patch other than superficially; I suppose the feature it's introducing is an OK one to have as an extension to the standard. (I hope the community members that are committee members will propose this extension to become part of the

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-02-07 Thread Dean Rasheed
On Sat, 21 Jan 2023 at 14:18, Ted Yu wrote: > > On Sat, Jan 21, 2023 at 3:05 AM Dean Rasheed wrote: >> >> Rebased version, following 8eba3e3f02 and 5d29d525ff. >> Another rebased version attached. > In transform_MERGE_to_join : > > + if (action->matchKind == >

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-01-21 Thread Ted Yu
On Sat, Jan 21, 2023 at 3:05 AM Dean Rasheed wrote: > On Tue, 10 Jan 2023 at 14:43, Dean Rasheed > wrote: > > > > Rebased version attached. > > > > Rebased version, following 8eba3e3f02 and 5d29d525ff. > > Regards, > Dean > Hi, In transform_MERGE_to_join : + if

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-01-21 Thread Dean Rasheed
On Tue, 10 Jan 2023 at 14:43, Dean Rasheed wrote: > > Rebased version attached. > Rebased version, following 8eba3e3f02 and 5d29d525ff. Regards, Dean diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml new file mode 100644 index b87ad5c..1482ede --- a/doc/src/sgml/mvcc.sgml +++

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-01-10 Thread Dean Rasheed
Rebased version attached. Regards, Dean diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml new file mode 100644 index b87ad5c..1482ede --- a/doc/src/sgml/mvcc.sgml +++ b/doc/src/sgml/mvcc.sgml @@ -396,8 +396,8 @@ originally matched appears later in the list of actions. On the

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-01-07 Thread Dean Rasheed
On Thu, 5 Jan 2023 at 13:21, Dean Rasheed wrote: > > On Thu, 5 Jan 2023 at 11:03, Alvaro Herrera wrote: > > > > > + /* Join type required */ > > > + if (left_join && right_join) > > > + qry->mergeJoinType = JOIN_FULL; > > > + else if (left_join) > > > +

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-01-05 Thread Dean Rasheed
On Thu, 5 Jan 2023 at 11:03, Alvaro Herrera wrote: > > I haven't read this patch other than superficially; I suppose the > feature it's introducing is an OK one to have as an extension to the > standard. (I hope the community members that are committee members > will propose this extension to

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-01-05 Thread Alvaro Herrera
I haven't read this patch other than superficially; I suppose the feature it's introducing is an OK one to have as an extension to the standard. (I hope the community members that are committee members will propose this extension to become part of the standard.) On 2023-Jan-02, Dean Rasheed

Re: MERGE ... WHEN NOT MATCHED BY SOURCE

2023-01-02 Thread Dean Rasheed
On Fri, 30 Dec 2022 at 16:56, Dean Rasheed wrote: > > Attached is a WIP patch. > Updated patch attached, now with updated docs and some other minor tidying up. Regards, Dean diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml new file mode 100644 index b87ad5c..1482ede ---

MERGE ... WHEN NOT MATCHED BY SOURCE

2022-12-30 Thread Dean Rasheed
This allows MERGE to UPDATE or DELETE target rows where there is no matching source row. In addition, it allows the existing "WHEN NOT MATCHED" syntax to include an optional "BY TARGET" to make its meaning more explicit. E.g., MERGE INTO tgt USING src ON ... WHEN NOT MATCHED BY SOURCE THEN