aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2011-02-17 13:36:36 -0500
committerBruce Momjian <bruce@momjian.us>2011-02-17 13:36:36 -0500
commitf87712d208f7dbe447cd27e92a99f49fd19afe94 (patch)
tree8ed88de64f2e2b02628e7d58f3b58e9d830b4b40
parent732808c087a84feed4749ab1e8a63ceeefcf449f (diff)
downloadpostgresql-f87712d208f7dbe447cd27e92a99f49fd19afe94.tar.gz
postgresql-f87712d208f7dbe447cd27e92a99f49fd19afe94.zip
Document that plpgsql upsert example can fail if insert triggers return
unique exception, or if not used in read committed transaction mode.
-rw-r--r--doc/src/sgml/plpgsql.sgml7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index c342916ff36..d2e74dca81e 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -2464,7 +2464,7 @@ BEGIN
INSERT INTO db(a,b) VALUES (key, data);
RETURN;
EXCEPTION WHEN unique_violation THEN
- -- do nothing, and loop to try the UPDATE again
+ -- Do nothing, and loop to try the UPDATE again.
END;
END LOOP;
END;
@@ -2474,7 +2474,10 @@ LANGUAGE plpgsql;
SELECT merge_db(1, 'david');
SELECT merge_db(1, 'dennis');
</programlisting>
-
+ This example assumes the <literal>unique_violation</> error is caused by
+ the <command>INSERT</>, and not by an <command>INSERT</> trigger function
+ on the table. Also, this example only works in the default Read
+ Committed transaction mode.
</para>
</example>
</sect2>