void stored procedure does return something?

From: Yan Cheng Cheok <yccheok(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: void stored procedure does return something?
Date: 2010-01-22 01:57:14
Message-ID: 779980.74809.qm@web65715.mail.ac4.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have the following stored procedure return void.

CREATE OR REPLACE FUNCTION sandbox()
RETURNS void AS
$BODY$DECLARE
DECLARE me text;
DECLARE he int;
BEGIN
he = 100;
RAISE NOTICE 'he is %', he;
-- me = "Hello PostgreSQL";
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION sandbox() OWNER TO postgres;

When I perform query :

SELECT * FROM sandbox();

Everything is fine.

"he is 100" is being printed in message area.

However, when I remove "--" from
me = "Hello PostgreSQL";

I get the following error :
================================================
ERROR: column "Hello PostgreSQL" does not exist
LINE 1: SELECT "Hello PostgreSQL"
^
QUERY: SELECT "Hello PostgreSQL"
CONTEXT: PL/pgSQL function "sandbox" line 7 at assignment
================================================

But isn't my stored procedure is void? Isn't it shouldn't return anything?

Thanks and Regards
Yan Cheng CHEOK

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2010-01-22 02:01:39 Re: void stored procedure does return something?
Previous Message Greg Smith 2010-01-22 00:28:20 Re: Changing FS when full