Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id C5083B5DBD6 for ; Fri, 27 May 2011 11:05:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 24341-10 for ; Fri, 27 May 2011 14:05:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 0DC4DB5DBC8 for ; Fri, 27 May 2011 11:05:29 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p4RE5T3B050880 for ; Fri, 27 May 2011 14:05:29 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p4RE5Tid050879; Fri, 27 May 2011 14:05:29 GMT (envelope-from www) Date: Fri, 27 May 2011 14:05:29 GMT Message-Id: <201105271405.p4RE5Tid050879@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6043: Compilation PLpgsql Succesful but execution bad From: "Emanuel" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201105/199 X-Sequence-Number: 30338 The following bug has been logged online: Bug reference: 6043 Logged by: Emanuel Email address: postgres.arg@gmail.com PostgreSQL version: 9.1 beta Operating system: Ubuntu 10.04 2.6.31 Description: Compilation PLpgsql Succesful but execution bad Details: postgres=# CREATE OR REPLACE FUNCTION p_() RETURNS TABLE (i int) AS $$ DECLARE BEGIN SELECT * FROM p; --<<<-- here must ne RETURN QUERY .. END; $$ LANGUAGE plpgsql; CREATE FUNCTION postgres=# select p_(); ERROR: query has no destination for result data HINT: If you want to discard the results of a SELECT, use PERFORM instead. CONTEXT: PL/pgSQL function "p_" line 4 at SQL statement I don't know if it's really a bug or a feature request. But seems that the function compiles well without checking the existence of a RETURN QUERY. I think the best in this cases is raise an error during compilation. Thougths?