From: | Peter Kroon <plakroon(at)gmail(dot)com> |
---|---|
To: | John R Pierce <pierce(at)hogranch(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: ERROR: query has no destination for result data |
Date: | 2012-11-23 11:25:10 |
Message-ID: | CAOh+DO=mS=vSudhCroNgP0fZ+B1VCMR3v+r2cKwKKiOyXMyO9g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Yes, but this means I have to create a function which is something I don't
want.
I just want to debug some of my code in the related function.
So what I want is in pgAdmin declare some vars and run the sql and get the
result.
2012/11/23 John R Pierce <pierce(at)hogranch(dot)com>
> On 11/23/12 2:53 AM, Peter Kroon wrote:
>
>> I get another error:
>> ERROR: cannot use RETURN QUERY in a non-SETOF function
>>
>>
> what is your function deined to return?
>
> a query returns a set of records, even if that set is 1 record of 1 field
> (like, select 'some text';)
>
> you could declare a record variable, and use SELECT ... INTO myrecordvar
> [FROM ...];
> http://www.postgresql.org/**docs/current/static/plpgsql-**
> statements.html#PLPGSQL-**STATEMENTS-SQL-ONEROW<http://www.postgresql.org/docs/current/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-SQL-ONEROW>
> then return a field of that record variable.
>
> see this example...
> http://www.postgresql.org/**docs/current/static/plpgsql-**
> control-structures.html#**PLPGSQL-RECORDS-ITERATING<http://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-RECORDS-ITERATING>
> ... for how you would loop through query results
>
>
> --
> john r pierce N 37, W 122
> santa cruz ca mid-left coast
>
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/**mailpref/pgsql-general<http://www.postgresql.org/mailpref/pgsql-general>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Kroon | 2012-11-23 11:25:42 | Re: ERROR: query has no destination for result data |
Previous Message | John R Pierce | 2012-11-23 11:19:15 | Re: ERROR: query has no destination for result data |