Skip site navigation (1) Skip section navigation (2)

BUG #6043: Compilation PLpgsql Succesful but execution bad

From: "Emanuel" <postgres(dot)arg(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #6043: Compilation PLpgsql Succesful but execution bad
Date: 2011-05-27 14:05:29
Message-ID: 201105271405.p4RE5Tid050879@wwwmaster.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      6043
Logged by:          Emanuel
Email address:      postgres(dot)arg(at)gmail(dot)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?

Responses

pgsql-bugs by date

Next:From: Heikki LinnakangasDate: 2011-05-27 14:18:11
Subject: Re: BUG #6043: Compilation PLpgsql Succesful but execution bad
Previous:From: Simon RiggsDate: 2011-05-27 10:27:54
Subject: Re: BUG #6042: unlogged table with Streaming Replication

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group