Re: Problem with the semantics of "select into" in a plpgsql function

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Problem with the semantics of "select into" in a plpgsql function
Дата
Msg-id 23224.1356460670@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Problem with the semantics of "select into" in a plpgsql function  (Seref Arikan <serefarikan@kurumsalteknoloji.com>)
Ответы Re: Problem with the semantics of "select into" in a plpgsql function
Список pgsql-general
Seref Arikan <serefarikan@kurumsalteknoloji.com> writes:
> I have a plpython function that returns a set of records.

Is that actually plpython, or plpgsql?  Because what you're showing is
not legal syntax in either bare SQL or plpython, but it would act as
you're reporting in plpgsql:

> SELECT INTO temp_eav_table (valstring,
>                                     featuremappingid,
>                                     featurename,
>                                     rmtypename,
>                                     actualrmtypename,
>                                     path,
>                                     pathstring)
>     select selected_node.valstring,
>                                     selected_node.featuremappingid,
>                                     selected_node.featurename,
>                                     selected_node.rmtypename,
>                                     selected_node.actualrmtypename,
>                                     selected_node.path,
>                                     selected_node.pathstring
>     from py_get_eav_rows_from_pb(payload ) as selected_node;

SELECT INTO in plpgsql is a completely different construct than SELECT
INTO in bare SQL: the INTO target is always a local variable of the
function.  You should use CREATE TABLE AS to get the effect you're
after.  This is covered in the docs page David pointed you to, as
well as in the plpgsql documentation.

            regards, tom lane


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

Предыдущее
От: Philipp Kraus
Дата:
Сообщение: Re: logger table
Следующее
От: Seref Arikan
Дата:
Сообщение: Re: Problem with the semantics of "select into" in a plpgsql function