From: | Mark Bannister <mark(at)injection-moldings(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-novice(at)lists(dot)postgresql(dot)org |
Subject: | Re: PL/pgsql insert into failing even with returning into clause |
Date: | 2020-04-17 01:05:32 |
Message-ID: | 692F8E79-4E21-4D16-8199-A9A291BCCE25@injection-moldings.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Thanks. No the error is on the line I am posting about. I realize a record is optimal but it doesn't even work in the simple example. Line ~47-49 is the error depending on which version.
Mark B
> On Apr 16, 2020, at 7:39 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Mark Bannister <mark(at)injection-moldings(dot)com> writes:
>> I have a simple insert into query in a PL/pgsql function. I have a
>> returning into clause.
>> I have tried it multiple ways but it always gives me the "query has no
>> destination for result data" error.
>
> It looks like you forgot to include "INTO plpgsql-result-variable"
> in the last UPDATE RETURNING in the function. You do have that
> in the earlier one, maybe you just got confused about which one
> the system was complaining about?
>
>> *Desired version:*
>
>> INSERT INTO __formuilist (formidfkey,uiname,mastertablelistxref_fkey)
>> VALUES(_formidfkey,_uiname, _mastertablelistxref_fkey)
>> RETURNING ROW
>> INTO formlistrow ;
>
> I believe the easiest way to accomplish that is something like
>
> INSERT ... RETURNING __formuilist.* INTO composite_variable
>
> where composite_variable could be declared RECORD, or given
> the table's named rowtype.
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Mark Bannister | 2020-04-17 12:48:58 | Re: PL/pgsql insert into failing even with returning into clause |
Previous Message | Tom Lane | 2020-04-17 00:39:10 | Re: PL/pgsql insert into failing even with returning into clause |