Skip to content

Commit 615f679

Browse files
committed
PL/Python: Fix example
Revert "6f6b46c9c0ca3d96acbebc5499c32ee6369e1eec", which was broken. Reported-by: Jonathan Rogers <jrogers@socialserve.com>
1 parent 38cb868 commit 615f679

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

doc/src/sgml/plpython.sgml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,11 @@ rv = plpy.execute(plan, ["name"], 5)
10231023
<xref linkend="plpython-sharing">). For example:
10241024
<programlisting>
10251025
CREATE FUNCTION usesavedplan() RETURNS trigger AS $$
1026-
plan = SD.setdefault("plan", plpy.prepare("SELECT 1"))
1026+
if "plan" in SD:
1027+
plan = SD["plan"]
1028+
else:
1029+
plan = plpy.prepare("SELECT 1")
1030+
SD["plan"] = plan
10271031
# rest of function
10281032
$$ LANGUAGE plpythonu;
10291033
</programlisting>

0 commit comments

Comments
 (0)