Re: BUG #2914: SELECT query has no destination for result data - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #2914: SELECT query has no destination for result data
Date
Msg-id 10554.1169531641@sss.pgh.pa.us
Whole thread Raw
In response to BUG #2914: SELECT query has no destination for result data  ("prasad" <prasad05_qs@yahoo.co.in>)
List pgsql-bugs
"prasad" <prasad05_qs@yahoo.co.in> writes:
> i'm created a function
> ...
> Select *
> from "vw_getAllMessages"
> where "Message_Posted_To" = $1
> order by "Message_ID" desc;
> ...
> i get error
> ERROR:  SELECT query has no destination for result data
> HINT:  If you want to discard the results, use PERFORM instead.
> CONTEXT:  PL/pgSQL function "Get_Inbox" line 5 at SQL statement

This is not a bug.

SELECT in plpgsql should always be a SELECT INTO.  Like the hint
says, if you aren't wanting to send the results anywhere, use PERFORM.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Adriaan van Os
Date:
Subject: Re: BUG #2905: min and max return incorrect text type
Next
From: Tom Lane
Date:
Subject: Re: BUG #2915: Not working: GRANT * TO GROUP *