aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2022-08-12 13:16:50 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2022-08-12 13:16:50 +0200
commit3d895bc846f25859bd6dd242fbf204e6c5166e6f (patch)
tree891d5ae4b99ba94695a582b3bc003e6d75c402d1
parent92af9143f13df8c54362ebbd4397cb53f207ff2d (diff)
downloadpostgresql-3d895bc846f25859bd6dd242fbf204e6c5166e6f.tar.gz
postgresql-3d895bc846f25859bd6dd242fbf204e6c5166e6f.zip
MERGE docs adjustments
Per Justin Pryzby Discussion: https://postgr.es/m/20220801145257.GA15006@telsasoft.com Discussion: https://postgr.es/m/20220714162618.GH18011@telsasoft.com
-rw-r--r--doc/src/sgml/mvcc.sgml3
-rw-r--r--doc/src/sgml/ref/merge.sgml10
2 files changed, 5 insertions, 8 deletions
diff --git a/doc/src/sgml/mvcc.sgml b/doc/src/sgml/mvcc.sgml
index 14b51db55e3..337f6dd4294 100644
--- a/doc/src/sgml/mvcc.sgml
+++ b/doc/src/sgml/mvcc.sgml
@@ -402,7 +402,8 @@
and a unique index is present and a duplicate row is concurrently
inserted, then a uniqueness violation error is raised;
<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>
diff --git a/doc/src/sgml/ref/merge.sgml b/doc/src/sgml/ref/merge.sgml
index 7f73f3d89c5..a129a6edd5b 100644
--- a/doc/src/sgml/ref/merge.sgml
+++ b/doc/src/sgml/ref/merge.sgml
@@ -267,10 +267,6 @@ DELETE
or null if there is none.
</para>
<para>
- If the expression for any column is not of the correct data type,
- automatic type conversion will be attempted.
- </para>
- <para>
If <replaceable class="parameter">target_table_name</replaceable>
is a partitioned table, each row is routed to the appropriate partition
and inserted into it.
@@ -581,12 +577,12 @@ WHEN NOT MATCHED THEN
<programlisting>
MERGE INTO CustomerAccount CA
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
INSERT (CustomerId, Balance)
VALUES (T.CustomerId, T.TransactionValue)
-WHEN MATCHED THEN
- UPDATE SET Balance = Balance + TransactionValue;
</programlisting>
</para>