Execute ignoring cursor?

From: nummervet nummervet <nummervet(at)mail(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Execute ignoring cursor?
Date: 2016-04-08 14:17:33
Message-ID: 1460125053.527934741@f386.i.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello. Didn't find dedicated plpgsql list, so decided to post question here.
I am trying to create a  function that will pick up some values from cursor and execute them as a dynamic query.
However, once i use EXECUTE, its seems to be ignoring the existence of cursor and try to pick up values from table.
Basically:

insert into mytable ( value, attribute_id, set_id ) (select rec."151", '201', '1')

works, but

execute 'insert into mytable ( value, attribute_id, set_id ) (select rec."151", ''201'', ''1'')'

fails with

ERROR:  missing FROM-clause entry for table "rec"
LINE 1: ...ibute_id, set_id ) (select rec."151",...

Is there any way around it? Or should i just give up and do it some other way?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2016-04-08 14:25:48 Re: Execute ignoring cursor?
Previous Message Magnus Hagander 2016-04-08 14:16:57 Re: VS 2015 support in src/tools/msvc