mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
MERGE docs adjustments
Per Justin Pryzby Discussion: https://postgr.es/m/20220801145257.GA15006@telsasoft.com Discussion: https://postgr.es/m/20220714162618.GH18011@telsasoft.com
This commit is contained in:
parent
92af9143f1
commit
3d895bc846
@ -402,7 +402,8 @@
|
|||||||
and a unique index is present and a duplicate row is concurrently
|
and a unique index is present and a duplicate row is concurrently
|
||||||
inserted, then a uniqueness violation error is raised;
|
inserted, then a uniqueness violation error is raised;
|
||||||
<command>MERGE</command> does not attempt to avoid such
|
<command>MERGE</command> does not attempt to avoid such
|
||||||
errors by evaluating <literal>MATCHED</literal> conditions.
|
errors by restarting evaluation of <literal>MATCHED</literal>
|
||||||
|
conditions.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
@ -266,10 +266,6 @@ DELETE
|
|||||||
filled with a default value, either its declared default value
|
filled with a default value, either its declared default value
|
||||||
or null if there is none.
|
or null if there is none.
|
||||||
</para>
|
</para>
|
||||||
<para>
|
|
||||||
If the expression for any column is not of the correct data type,
|
|
||||||
automatic type conversion will be attempted.
|
|
||||||
</para>
|
|
||||||
<para>
|
<para>
|
||||||
If <replaceable class="parameter">target_table_name</replaceable>
|
If <replaceable class="parameter">target_table_name</replaceable>
|
||||||
is a partitioned table, each row is routed to the appropriate partition
|
is a partitioned table, each row is routed to the appropriate partition
|
||||||
@ -581,12 +577,12 @@ WHEN NOT MATCHED THEN
|
|||||||
<programlisting>
|
<programlisting>
|
||||||
MERGE INTO CustomerAccount CA
|
MERGE INTO CustomerAccount CA
|
||||||
USING (Select CustomerId, TransactionValue From RecentTransactions) AS T
|
USING (Select CustomerId, TransactionValue From RecentTransactions) AS T
|
||||||
ON CA.CustomerId = T.CustomerId
|
ON T.CustomerId = CA.CustomerId
|
||||||
|
WHEN MATCHED THEN
|
||||||
|
UPDATE SET Balance = Balance + TransactionValue;
|
||||||
WHEN NOT MATCHED THEN
|
WHEN NOT MATCHED THEN
|
||||||
INSERT (CustomerId, Balance)
|
INSERT (CustomerId, Balance)
|
||||||
VALUES (T.CustomerId, T.TransactionValue)
|
VALUES (T.CustomerId, T.TransactionValue)
|
||||||
WHEN MATCHED THEN
|
|
||||||
UPDATE SET Balance = Balance + TransactionValue;
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user