pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Doc fix and adjustment for MERGE command
4+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2022-09-09 5dcebd10ba 5bb88967ed  Doc fixes for MERGE statement
* Doc fix and adjustment for MERGE command
@ 2022-09-07 20:51 Vitaly Burovoy <vitaly.burovoy@gmail.com>
  2022-09-08 08:14 ` Re: Doc fix and adjustment for MERGE command Vik Fearing <vik@postgresfriends.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Vitaly Burovoy @ 2022-09-07 20:51 UTC (permalink / raw)
  To: pgsql-hackers

Hello hackers!

Reading docs for the MERGE statement I've found a little error: a 
semicolon in middle of a statement and absence of a semicolon in the end 
of it.

Key words in subqueries are written in uppercase everywhere in the docs 
but not in an example for MERGE. I think it should be adjusted too.


Also aliases, table and column names are written in lowercase 
(snake_case) almost all over the docs. I did not dare to fix examples in 
the same patch (may be that style was intentional), but guess that style 
of the first two examples should not differ from the third one and from 
other examples in docs.


Discussions about MERGE was:
https://postgr.es/m/20220801145257.GA15006@telsasoft.com
https://postgr.es/m/20220714162618.GH18011@telsasoft.com

but I did not find there (via quick search) anything about case styling.


Thank all a lot in advance!


-- 
Best regards,
Vitaly Burovoy

Attachments: download all (2 files, .tar.gz)

0001-Doc-fix-for-MERGE-statement.patch (text/x-patch, 1.0K) download From 7f38cd4c5215fd9933557e1805857c10afba097e Mon Sep 17 00:00:00 2001 From: Vitaly Burovoy <vitaly.burovoy@gmail.com> Date: Wed, 7 Sep 2022 19:38:58 +0000 Subject: [PATCH 1/2] Doc fix for MERGE statement --- doc/src/sgml/ref/merge.sgml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/sgml/ref/merge.sgml b/doc/src/sgml/ref/merge.sgml index a129a6edd5..2db6b7e698 100644 --- a/doc/src/sgml/ref/merge.sgml +++ b/doc/src/sgml/ref/merge.sgml @@ -576,13 +576,13 @@ WHEN NOT MATCHED THEN <programlisting> MERGE INTO CustomerAccount CA -USING (Select CustomerId, TransactionValue From RecentTransactions) AS T +USING (SELECT CustomerId, TransactionValue FROM RecentTransactions) AS T ON T.CustomerId = CA.CustomerId WHEN MATCHED THEN - UPDATE SET Balance = Balance + TransactionValue; + UPDATE SET Balance = Balance + TransactionValue WHEN NOT MATCHED THEN INSERT (CustomerId, Balance) - VALUES (T.CustomerId, T.TransactionValue) + VALUES (T.CustomerId, T.TransactionValue); </programlisting> </para> -- 2.35.1
0002-Doc-styling-for-MERGE-statement.patch (text/x-patch, 2.1K) download From f59cc9ef227d96a8e3b22ef993ad79f407be9ec8 Mon Sep 17 00:00:00 2001 From: Vitaly Burovoy <vitaly.burovoy@gmail.com> Date: Wed, 7 Sep 2022 20:30:46 +0000 Subject: [PATCH 2/2] Doc styling for MERGE statement --- doc/src/sgml/ref/merge.sgml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/src/sgml/ref/merge.sgml b/doc/src/sgml/ref/merge.sgml index 2db6b7e698..e07addaea4 100644 --- a/doc/src/sgml/ref/merge.sgml +++ b/doc/src/sgml/ref/merge.sgml @@ -554,18 +554,18 @@ MERGE <replaceable class="parameter">total_count</replaceable> <title>Examples</title> <para> - Perform maintenance on <literal>CustomerAccounts</literal> based - upon new <literal>Transactions</literal>. + Perform maintenance on <literal>customer_accounts</literal> based + upon new <literal>recent_transactions</literal>. <programlisting> -MERGE INTO CustomerAccount CA -USING RecentTransactions T -ON T.CustomerId = CA.CustomerId +MERGE INTO customer_account ca +USING recent_transactions t +ON t.customer_id = ca.customer_id WHEN MATCHED THEN - UPDATE SET Balance = Balance + TransactionValue + UPDATE SET balance = balance + transaction_value WHEN NOT MATCHED THEN - INSERT (CustomerId, Balance) - VALUES (T.CustomerId, T.TransactionValue); + INSERT (customer_id, balance) + VALUES (t.customer_id, t.transaction_value); </programlisting> </para> @@ -575,14 +575,14 @@ WHEN NOT MATCHED THEN during execution. <programlisting> -MERGE INTO CustomerAccount CA -USING (SELECT CustomerId, TransactionValue FROM RecentTransactions) AS T -ON T.CustomerId = CA.CustomerId +MERGE INTO customer_account ca +USING (SELECT customer_id, transaction_value FROM recent_transactions) AS t +ON t.customer_id = ca.customer_id WHEN MATCHED THEN - UPDATE SET Balance = Balance + TransactionValue + UPDATE SET balance = balance + transaction_value WHEN NOT MATCHED THEN - INSERT (CustomerId, Balance) - VALUES (T.CustomerId, T.TransactionValue); + INSERT (customer_id, balance) + VALUES (t.customer_id, t.transaction_value); </programlisting> </para> -- 2.35.1
^ permalink raw reply [nested|flat] 4+ messages in thread

* Re: Doc fix and adjustment for MERGE command
  2022-09-07 20:51 Doc fix and adjustment for MERGE command Vitaly Burovoy <vitaly.burovoy@gmail.com>
@ 2022-09-08 08:14 ` Vik Fearing <vik@postgresfriends.org>
  2022-09-09 11:54   ` Re: Doc fix and adjustment for MERGE command Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Vik Fearing @ 2022-09-08 08:14 UTC (permalink / raw)
  To: Vitaly Burovoy <vitaly.burovoy@gmail.com>; pgsql-hackers

On 9/7/22 22:51, Vitaly Burovoy wrote:
> Hello hackers!
> 
> Reading docs for the MERGE statement I've found a little error: a 
> semicolon in middle of a statement and absence of a semicolon in the end 
> of it.
> 
> Key words in subqueries are written in uppercase everywhere in the docs 
> but not in an example for MERGE. I think it should be adjusted too.
> 
> 
> Also aliases, table and column names are written in lowercase 
> (snake_case) almost all over the docs. I did not dare to fix examples in 
> the same patch (may be that style was intentional), but guess that style 
> of the first two examples should not differ from the third one and from 
> other examples in docs.


I agree with both of these patches (especially the semicolon part which 
is not subjective).
-- 
Vik Fearing





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Doc fix and adjustment for MERGE command
  2022-09-07 20:51 Doc fix and adjustment for MERGE command Vitaly Burovoy <vitaly.burovoy@gmail.com>
  2022-09-08 08:14 ` Re: Doc fix and adjustment for MERGE command Vik Fearing <vik@postgresfriends.org>
@ 2022-09-09 11:54   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  2022-09-09 11:58     ` Re: Doc fix and adjustment for MERGE command Vitaly Burovoy <vitaly.burovoy@gmail.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Alvaro Herrera @ 2022-09-09 11:54 UTC (permalink / raw)
  To: Vik Fearing <vik@postgresfriends.org>; +Cc: Vitaly Burovoy <vitaly.burovoy@gmail.com>; pgsql-hackers

On 2022-Sep-08, Vik Fearing wrote:

> On 9/7/22 22:51, Vitaly Burovoy wrote:
> > Hello hackers!
> > 
> > Reading docs for the MERGE statement I've found a little error: a
> > semicolon in middle of a statement and absence of a semicolon in the end
> > of it.
> > 
> > Key words in subqueries are written in uppercase everywhere in the docs
> > but not in an example for MERGE. I think it should be adjusted too.

> I agree with both of these patches (especially the semicolon part which is
> not subjective).

OK, pushed both together.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"El sabio habla porque tiene algo que decir;
el tonto, porque tiene que decir algo" (Platon).





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Doc fix and adjustment for MERGE command
  2022-09-07 20:51 Doc fix and adjustment for MERGE command Vitaly Burovoy <vitaly.burovoy@gmail.com>
  2022-09-08 08:14 ` Re: Doc fix and adjustment for MERGE command Vik Fearing <vik@postgresfriends.org>
  2022-09-09 11:54   ` Re: Doc fix and adjustment for MERGE command Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2022-09-09 11:58     ` Vitaly Burovoy <vitaly.burovoy@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Vitaly Burovoy @ 2022-09-09 11:58 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; Vik Fearing <vik@postgresfriends.org>; +Cc: pgsql-hackers

On 2022-09-09 11:54Z, Alvaro Herrera wrote:
> On 2022-Sep-08, Vik Fearing wrote:
> 
>> On 9/7/22 22:51, Vitaly Burovoy wrote:
>>> Hello hackers!
>>>
>>> Reading docs for the MERGE statement I've found a little error: a
>>> semicolon in middle of a statement and absence of a semicolon in the end
>>> of it.
>>>
>>> Key words in subqueries are written in uppercase everywhere in the docs
>>> but not in an example for MERGE. I think it should be adjusted too.
> 
>> I agree with both of these patches (especially the semicolon part which is
>> not subjective).
> 
> OK, pushed both together.
> 

Thank you!
=)

-- 
Best regards,
Vitaly Burovoy





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2022-09-09 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-09-07 20:51 Doc fix and adjustment for MERGE command Vitaly Burovoy <vitaly.burovoy@gmail.com>
2022-09-08 08:14 ` Vik Fearing <vik@postgresfriends.org>
2022-09-09 11:54   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2022-09-09 11:58     ` Vitaly Burovoy <vitaly.burovoy@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox