Re: PL/Python prepare example's use of setdefault

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: PL/Python prepare example's use of setdefault
Дата
Msg-id 545506B1.6070608@gmx.net
обсуждение исходный текст
Ответ на Re: PL/Python prepare example's use of setdefault  (Jonathan Rogers <jrogers@socialserve.com>)
Ответы Re: PL/Python prepare example's use of setdefault  (Jonathan Rogers <jrogers@socialserve.com>)
Список pgsql-general
On 10/15/14 5:58 PM, Jonathan Rogers wrote:
> BTW, I would rewrite the 9.1 example to be shorter while
> behaving the same:
>
>
> CREATE FUNCTION usesavedplan() RETURNS trigger AS $$
>     plan = SD.get("plan")
>     if plan is None:

If we're going for shortness, how about

    if not plan:

?

>         SD["plan"] = plan = plpy.prepare("SELECT 1")

and here maybe

    plan = SD["plan"] = plpy.prepare("SELECT 1")

to emphasize the assignment to "plan"?

>     # rest of function
> $$ LANGUAGE plpythonu;



В списке pgsql-general по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: PL/Python prepare example's use of setdefault
Следующее
От: "Andrus"
Дата:
Сообщение: Re: Converting char to varchar automatically