BUG #2916: SELECT query has no destination for result data

From: "prasad mahit" <prasad05_qs(at)yahoo(dot)co(dot)in>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2916: SELECT query has no destination for result data
Date: 2007-01-22 04:54:20
Message-ID: 200701220454.l0M4sKAU063783@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2916
Logged by: prasad mahit
Email address: prasad05_qs(at)yahoo(dot)co(dot)in
PostgreSQL version: 8.1
Operating system: windows
Description: SELECT query has no destination for result data
Details:

Hi have created a function

CREATE OR REPLACE FUNCTION "Get_Inbox"("Message_Posted_To" "varchar",
"Message_Posted_By" "varchar")
RETURNS SETOF "vw_getAllMessages" AS
$BODY$DECLARE
Message_Inbox_Type alias for $2;
BEGIN
IF Message_Inbox_Type = ' ' OR Message_Inbox_Type = null THEN
Select *
from "vw_getAllMessages"
where "Message_Posted_To" = $1
order by "Message_ID" desc;
ELSE
Select *
from "vw_getAllMessages"
where "Message_Posted_To" = $1
and "Message_Posted_By" = Message_Inbox_Type
order by "Message_ID" desc;
END IF;
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE;
ALTER FUNCTION "Get_Inbox"("Message_Posted_To" "varchar",
"Message_Posted_By" "varchar") OWNER TO postgres;

where vw_getAllMessages is a view

CREATE OR REPLACE VIEW "vw_getAllMessages" AS
SELECT "Messages"."Message_ID", "Messages"."Message_Text",
"Messages"."Message_Date", ("Client"."Client_First_Name"::text || ' '::text)
|| "Client"."Client_Last_Name"::text AS "Sender Name",
("Portfolio_Manager"."PM_User_Name"::text || ' '::text) ||
"Portfolio_Manager"."PM_Last_Name"::text AS "Receiver Name",
"Messages"."Message_Posted_By", "Messages"."Message_Posted_To",
"Messages"."Message_Context", "Messages"."Message_Reply_To",
"Messages"."Message_Replied_Date", "Messages"."Message_Subject",
"Messages"."Message_InboxReadFlag", "Messages"."Message_SentReadFlag",
"Messages"."Message_Inbox_DeleteFlag", "Messages"."Message_Sent_DeleteFlag"
FROM "Messages"
JOIN "Client" ON "Messages"."Message_Posted_By"::text =
"Client"."Client_Depository_Client_ID"::text
JOIN "Portfolio_Manager" ON "Messages"."Message_Posted_To"::text =
"Portfolio_Manager"."PM_Registration_No"::text
ORDER BY "Messages"."Message_ID" DESC;

ALTER TABLE "vw_getAllMessages" OWNER TO postgres;

when i try to run this

select * from "Get_Inbox" ('INC00000000', ' ')

i get an 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

pls Help....

Browse pgsql-bugs by date

  From Date Subject
Next Message Vlad Dan Dascalescu 2007-01-22 07:28:19 BUG #2917: spi_prepare doesn't accept typename aliases such as 'integer'
Previous Message Alvaro Alvarez 2007-01-22 01:27:23 BUG #2915: Not working: GRANT * TO GROUP *