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

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re: Problem with the semantics of "select into" in a plpgsql function
Дата
Msg-id 50D9D873.4010709@gmail.com
обсуждение исходный текст
Ответ на Problem with the semantics of "select into" in a plpgsql function  (Seref Arikan <serefarikan@kurumsalteknoloji.com>)
Список pgsql-general
On 12/25/2012 07:20 AM, Seref Arikan wrote:
> Greetings,
> I have a plpython function that returns a set of records. I loop over
> them to insert them into a temp table created by another function.
> I wanted to test
> select into temp_eav_table (column) select a.column from tbl as a where....
> approach to see if it performs better than the loop. However, I'm not
> able to compile the function due to an error that says "temp_eav_table
> is not a known variable"


Probably going to have to show the actual plpython code. The message
looks like you used temp_eav_table as a variable before defining it.

>
> So the context assumes this is supposed to be a variable. If I try
> execute '...', then I have trouble passing a bytea parameter to the
> python function. This is what I have at the moment:
>
> 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;
>
> any thoughts?

I think you may be reading the plpgsql docs. The SELECT INTO syntax
there only exists within plpgsql. You are using plpythonu and it will
not work there. It follows the syntax here:

http://www.postgresql.org/docs/9.2/interactive/sql-selectinto.html

>
> Best regards
> Seref
>


--
Adrian Klaver
adrian.klaver@gmail.com


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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: check user in group
Следующее
От: Philipp Kraus
Дата:
Сообщение: Re: logger table