mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-03 11:47:20 +02:00
PL/Python: Fix example
Revert "6f6b46c9c0ca3d96acbebc5499c32ee6369e1eec", which was broken. Reported-by: Jonathan Rogers <jrogers@socialserve.com>
This commit is contained in:
parent
f41ed7b66a
commit
4ffa8806ee
@ -1044,7 +1044,11 @@ rv = plpy.execute(plan, ["name"], 5)
|
|||||||
<xref linkend="plpython-sharing">). For example:
|
<xref linkend="plpython-sharing">). For example:
|
||||||
<programlisting>
|
<programlisting>
|
||||||
CREATE FUNCTION usesavedplan() RETURNS trigger AS $$
|
CREATE FUNCTION usesavedplan() RETURNS trigger AS $$
|
||||||
plan = SD.setdefault("plan", plpy.prepare("SELECT 1"))
|
if "plan" in SD:
|
||||||
|
plan = SD["plan"]
|
||||||
|
else:
|
||||||
|
plan = plpy.prepare("SELECT 1")
|
||||||
|
SD["plan"] = plan
|
||||||
# rest of function
|
# rest of function
|
||||||
$$ LANGUAGE plpythonu;
|
$$ LANGUAGE plpythonu;
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
Loading…
Reference in New Issue
Block a user