Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Seref Arikan <serefarikan@xxxxxxxxxxxxxxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux