From 6f6b46c9c0ca3d96acbebc5499c32ee6369e1eec Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 18 Jan 2012 21:02:09 +0200 Subject: [PATCH] PL/Python: Update example Change the usesavedplan() example to use a more modern Python style using the .setdefault() function. --- doc/src/sgml/plpython.sgml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml index 618f8d055e..5a3c8caa68 100644 --- a/doc/src/sgml/plpython.sgml +++ b/doc/src/sgml/plpython.sgml @@ -955,11 +955,7 @@ rv = plpy.execute(plan, [ "name" ], 5) ). For example: CREATE FUNCTION usesavedplan() RETURNS trigger AS $$ - if SD.has_key("plan"): - plan = SD["plan"] - else: - plan = plpy.prepare("SELECT 1") - SD["plan"] = plan + plan = SD.setdefault("plan", plpy.prepare("SELECT 1")) # rest of function $$ LANGUAGE plpythonu;