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

Commit6f6b46c

Browse files
committed
PL/Python: Update example
Change the usesavedplan() example to use a more modern Python styleusing the .setdefault() function.
1 parent326b922 commit6f6b46c

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

‎doc/src/sgml/plpython.sgml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -955,11 +955,7 @@ rv = plpy.execute(plan, [ "name" ], 5)
955955
<xref linkend="plpython-sharing">). For example:
956956
<programlisting>
957957
CREATE FUNCTION usesavedplan() RETURNS trigger AS $$
958-
if SD.has_key("plan"):
959-
plan = SD["plan"]
960-
else:
961-
plan = plpy.prepare("SELECT 1")
962-
SD["plan"] = plan
958+
plan = SD.setdefault("plan", plpy.prepare("SELECT 1"))
963959
# rest of function
964960
$$ LANGUAGE plpythonu;
965961
</programlisting>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp