Skip to content

Commit 42a7856

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

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
@@ -1034,7 +1034,11 @@ rv = plpy.execute(plan, ["name"], 5)
10341034
<xref linkend="plpython-sharing">). For example:
10351035
<programlisting>
10361036
CREATE FUNCTION usesavedplan() RETURNS trigger AS $$
1037-
plan = SD.setdefault("plan", plpy.prepare("SELECT 1"))
1037+
if "plan" in SD:
1038+
plan = SD["plan"]
1039+
else:
1040+
plan = plpy.prepare("SELECT 1")
1041+
SD["plan"] = plan
10381042
# rest of function
10391043
$$ LANGUAGE plpythonu;
10401044
</programlisting>

0 commit comments

Comments
 (0)