Thread: Merge statement

Merge statement

From
PG Doc comments form
Date:
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/15/sql-merge.html
Description:

From the description it looks like a single WHEN clause is accepted, which
is definitely not true.
Please let us know how many WHEN clauses are accepted for each of WNEM
MATCHED and WHEN NOT MATCHED.

Kindly please see the below description of the "when_clause" as it is now in
the documentation:

and when_clause is:

{ WHEN MATCHED [ AND condition ] THEN { merge_update | merge_delete | DO
NOTHING } |
  WHEN NOT MATCHED [ AND condition ] THEN { merge_insert | DO NOTHING } }

Re: Merge statement

From
Alvaro Herrera
Date:
On 2022-Nov-17, PG Doc comments form wrote:

> The following documentation comment has been logged on the website:
> 
> Page: https://www.postgresql.org/docs/15/sql-merge.html
> Description:
> 
> From the description it looks like a single WHEN clause is accepted, which
> is definitely not true.

Hmm, the main synopsis has 

  when_clause [...]

where the [...] is there to indicate that when_clause can appear an
arbitrary number of times.

> Please let us know how many WHEN clauses are accepted for each of WNEM
> MATCHED and WHEN NOT MATCHED.

There's no specific restriction, although I didn't try to find a
limit.  I wonder what happens if you have a few hundred thousand ...
Time to experiment, I guess.

-- 
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"No deja de ser humillante para una persona de ingenio saber
que no hay tonto que no le pueda enseñar algo." (Jean B. Say)



Re: Merge statement

From
Boboc Cristi
Date:
Hello!
Thank you. I was fooled by the fact that sometimes it is marked with [...] and other times with [,...]

I think that consistency might worth attention, since [...] may indicate "anything", while [,...] are more likely to indicate a specific thing that may be repeated.

Best regards, Cristi Boboc


On Thursday, November 17, 2022 at 07:47:41 PM GMT+2, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:


On 2022-Nov-17, PG Doc comments form wrote:

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/15/sql-merge.html
> Description:
>
> From the description it looks like a single WHEN clause is accepted, which
> is definitely not true.

Hmm, the main synopsis has

  when_clause [...]

where the [...] is there to indicate that when_clause can appear an
arbitrary number of times.


> Please let us know how many WHEN clauses are accepted for each of WNEM
> MATCHED and WHEN NOT MATCHED.


There's no specific restriction, although I didn't try to find a
limit.  I wonder what happens if you have a few hundred thousand ...
Time to experiment, I guess.

--
Álvaro Herrera        Breisgau, Deutschland  —  https://www.EnterpriseDB.com/
"No deja de ser humillante para una persona de ingenio saber
que no hay tonto que no le pueda enseñar algo." (Jean B. Say)

Re: Merge statement

From
"David G. Johnston"
Date:
On Thu, Nov 17, 2022 at 11:20 AM Boboc Cristi <bobocc@yahoo.com> wrote:
Hello!
Thank you. I was fooled by the fact that sometimes it is marked with [...] and other times with [,...]

I think that consistency might worth attention, since [...] may indicate "anything", while [,...] are more likely to indicate a specific thing that may be repeated.


That isn't how that works.  The former means you don't have to add a comma between each of the multiples, the later means you do.

David J.

Re: Merge statement

From
Boboc Cristi
Date:
I agree that your statement is true, but it is still not quite self sufficient.

For the time being I have no idea how to make it easier to be understood. As I have said, for me it is a little confusing.

I would pay attention to Kirk Parker <khp@equatoria.us> idea: when_clause [ when_clause [...]] to indicate repetitions without commas and xyz [, xyz[, ...]] to indicate repetitions that require commas.

I'll be back if some worthy idea will hit my mind.

Best regards, Cristi Boboc


On Thursday, November 17, 2022 at 08:48:19 PM GMT+2, David G. Johnston <david.g.johnston@gmail.com> wrote:


On Thu, Nov 17, 2022 at 11:20 AM Boboc Cristi <bobocc@yahoo.com> wrote:
Hello!
Thank you. I was fooled by the fact that sometimes it is marked with [...] and other times with [,...]

I think that consistency might worth attention, since [...] may indicate "anything", while [,...] are more likely to indicate a specific thing that may be repeated.


That isn't how that works.  The former means you don't have to add a comma between each of the multiples, the later means you do.

David J.

Re: Merge statement

From
"David G. Johnston"
Date:
On Thu, Nov 17, 2022 at 12:06 PM Boboc Cristi <bobocc@yahoo.com> wrote:
I agree that your statement is true, but it is still not quite self sufficient.

For the time being I have no idea how to make it easier to be understood. As I have said, for me it is a little confusing.

I would pay attention to Kirk Parker <khp@equatoria.us> idea: when_clause [ when_clause [...]] to indicate repetitions without commas and xyz [, xyz[, ...]] to indicate repetitions that require commas.


Please don't top-post.  The convention here is inline and bottom posting.

The convention for the documentation is to display repetition the way it is shown on this page.  Having this page deviate from convention is undesirable, as is changing the convention.  100% satisfaction is not a goal - and as evidenced here the mailing lists are in place to handle rare cases of reader confusion.

David J.

Re: Merge statement

From
Boboc Cristi
Date:
OK, I agree. I'll do my best to adopt the site conventions for every specific type of site within the corresponding pages.

Top-posting is not by my choice, it is how the email client works.

Since you have good reasons to keep the conventions of yours, then please accept that email clients have the same or very similar good reasons to keep their conventions too and stop criticize those.

Best regards, Cristi Boboc


On Thursday, November 17, 2022 at 09:21:21 PM GMT+2, David G. Johnston <david.g.johnston@gmail.com> wrote:


On Thu, Nov 17, 2022 at 12:06 PM Boboc Cristi <bobocc@yahoo.com> wrote:
I agree that your statement is true, but it is still not quite self sufficient.

For the time being I have no idea how to make it easier to be understood. As I have said, for me it is a little confusing.

I would pay attention to Kirk Parker <khp@equatoria.us> idea: when_clause [ when_clause [...]] to indicate repetitions without commas and xyz [, xyz[, ...]] to indicate repetitions that require commas.


Please don't top-post.  The convention here is inline and bottom posting.

The convention for the documentation is to display repetition the way it is shown on this page.  Having this page deviate from convention is undesirable, as is changing the convention.  100% satisfaction is not a goal - and as evidenced here the mailing lists are in place to handle rare cases of reader confusion.

David J.

Re: Merge statement

From
"David G. Johnston"
Date:
On Thu, Nov 17, 2022 at 12:48 PM Boboc Cristi <bobocc@yahoo.com> wrote:
OK, I agree. I'll do my best to adopt the site conventions for every specific type of site within the corresponding pages.

Top-posting is not by my choice, it is how the email client works.


Mine has the same default/convention.  It is not difficult to choose to behave differently if one wishes.  Given that these messages are read in archive by many people and usually with fairly long threads, most of which are indeed done to the bottom-posting convention, the wisdom of "when in Rome, do as the Romans do" is suggested.

David J.

Re: Merge statement

From
Tom Lane
Date:
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Thu, Nov 17, 2022 at 12:48 PM Boboc Cristi <bobocc@yahoo.com> wrote:
>> *Top-posting is not by my choice, it is how the email client works.*

> Mine has the same default/convention.  It is not difficult to choose to
> behave differently if one wishes.  Given that these messages are read in
> archive by many people and usually with fairly long threads, most of which
> are indeed done to the bottom-posting convention, the wisdom of "when in
> Rome, do as the Romans do" is suggested.

Right.  The point of quoting in a sensible order and trimming irrelevant
material is to make it easier on the readers.  Failing to do that is
discourteous: it shows that you consider a few seconds of your time
to be worth more than a similar amount of time expended by each of
(possibly) thousands of other people.

            regards, tom lane



Re: Merge statement

From
Boboc Cristi
Date:
    Dear David, your suggestion would be good if it could be applied.
I have not found the setting you are talking about. I attach here a screenshot of the settings page. Since obviously you are more experimented than me about the mail clients, please help.
I mention I am using Yahoo's web client.


Inline image


Best regards, Cristi Boboc


On Thursday, November 17, 2022 at 09:54:55 PM GMT+2, David G. Johnston <david.g.johnston@gmail.com> wrote:


On Thu, Nov 17, 2022 at 12:48 PM Boboc Cristi <bobocc@yahoo.com> wrote:
OK, I agree. I'll do my best to adopt the site conventions for every specific type of site within the corresponding pages.

Top-posting is not by my choice, it is how the email client works.


Mine has the same default/convention.  It is not difficult to choose to behave differently if one wishes.  Given that these messages are read in archive by many people and usually with fairly long threads, most of which are indeed done to the bottom-posting convention, the wisdom of "when in Rome, do as the Romans do" is suggested.

David J.

Attachment

Re: Merge statement

From
Alvaro Herrera
Date:
On 2022-Nov-18, Boboc Cristi wrote:

>     Dear David, your suggestion would be good if it could be applied.
>
> I have not found the setting you are talking about. I attach here a
> screenshot of the settings page. Since obviously you are more
> experimented than me about the mail clients, please help.I mention I
> am using Yahoo's web client.

Hello,

Kindly take this conversation off-list.

Regards

-- 
Álvaro Herrera