aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2022-09-09 13:51:45 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2022-09-09 13:51:45 +0200
commit5dcebd10baa8ec14a97029ca0bacaf2a9a0f8652 (patch)
tree301a17e1bc33b0d262f4a0062841861e54ba380b
parent8c848cd4b8e9e0fee33eaad33cb44376b9e5b480 (diff)
downloadpostgresql-5dcebd10baa8ec14a97029ca0bacaf2a9a0f8652.tar.gz
postgresql-5dcebd10baa8ec14a97029ca0bacaf2a9a0f8652.zip
Doc fixes for MERGE statement
In commit 3d895bc846f2 I introduced a bogus semicolon mid-statement by careless cut-n-paste; move it. This had already been reported by Justin Pryzby. Also, change the styling a bit by avoiding names in CamelCase. This is more consistent with the style we use elsewhere. Backpatch to 15. Author: Vitaly Burovoy <vitaly.burovoy@gmail.com> Reviewed-by: Vik Fearing <vik@postgresfriends.org> Discussion: https://postgr.es/m/9afe5766-5a61-7860-598c-136867fad065@gmail.com Discussion: https://postgr.es/m/20220819133016.GV26426@telsasoft.com
-rw-r--r--doc/src/sgml/ref/merge.sgml28
1 files changed, 14 insertions, 14 deletions
diff --git a/doc/src/sgml/ref/merge.sgml b/doc/src/sgml/ref/merge.sgml
index a129a6edd5b..e07addaea42 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>