Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf87712d

Browse files
committed
Document that plpgsql upsert example can fail if insert triggers return
unique exception, or if not used in read committed transaction mode.
1 parent732808c commitf87712d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

‎doc/src/sgml/plpgsql.sgml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,7 +2464,7 @@ BEGIN
24642464
INSERT INTO db(a,b) VALUES (key, data);
24652465
RETURN;
24662466
EXCEPTION WHEN unique_violation THEN
2467-
--do nothing, and loop to try the UPDATE again
2467+
--Do nothing, and loop to try the UPDATE again.
24682468
END;
24692469
END LOOP;
24702470
END;
@@ -2474,7 +2474,10 @@ LANGUAGE plpgsql;
24742474
SELECT merge_db(1, 'david');
24752475
SELECT merge_db(1, 'dennis');
24762476
</programlisting>
2477-
2477+
This example assumes the <literal>unique_violation</> error is caused by
2478+
the <command>INSERT</>, and not by an <command>INSERT</> trigger function
2479+
on the table. Also, this example only works in the default Read
2480+
Committed transaction mode.
24782481
</para>
24792482
</example>
24802483
</sect2>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp