Doc fixes for MERGE statement
In commit 3d895bc846
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
This commit is contained in:
parent
68b0da6779
commit
5bb88967ed
|
@ -554,18 +554,18 @@ MERGE <replaceable class="parameter">total_count</replaceable>
|
||||||
<title>Examples</title>
|
<title>Examples</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
Perform maintenance on <literal>CustomerAccounts</literal> based
|
Perform maintenance on <literal>customer_accounts</literal> based
|
||||||
upon new <literal>Transactions</literal>.
|
upon new <literal>recent_transactions</literal>.
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
MERGE INTO CustomerAccount CA
|
MERGE INTO customer_account ca
|
||||||
USING RecentTransactions T
|
USING recent_transactions t
|
||||||
ON T.CustomerId = CA.CustomerId
|
ON t.customer_id = ca.customer_id
|
||||||
WHEN MATCHED THEN
|
WHEN MATCHED THEN
|
||||||
UPDATE SET Balance = Balance + TransactionValue
|
UPDATE SET balance = balance + transaction_value
|
||||||
WHEN NOT MATCHED THEN
|
WHEN NOT MATCHED THEN
|
||||||
INSERT (CustomerId, Balance)
|
INSERT (customer_id, balance)
|
||||||
VALUES (T.CustomerId, T.TransactionValue);
|
VALUES (t.customer_id, t.transaction_value);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
@ -575,14 +575,14 @@ WHEN NOT MATCHED THEN
|
||||||
during execution.
|
during execution.
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
MERGE INTO CustomerAccount CA
|
MERGE INTO customer_account ca
|
||||||
USING (Select CustomerId, TransactionValue From RecentTransactions) AS T
|
USING (SELECT customer_id, transaction_value FROM recent_transactions) AS t
|
||||||
ON T.CustomerId = CA.CustomerId
|
ON t.customer_id = ca.customer_id
|
||||||
WHEN MATCHED THEN
|
WHEN MATCHED THEN
|
||||||
UPDATE SET Balance = Balance + TransactionValue;
|
UPDATE SET balance = balance + transaction_value
|
||||||
WHEN NOT MATCHED THEN
|
WHEN NOT MATCHED THEN
|
||||||
INSERT (CustomerId, Balance)
|
INSERT (customer_id, balance)
|
||||||
VALUES (T.CustomerId, T.TransactionValue)
|
VALUES (t.customer_id, t.transaction_value);
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue