Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id EB784635292 for ; Thu, 24 Jun 2010 19:13:24 -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 14796-07 for ; Thu, 24 Jun 2010 22:13:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.fmed.uba.ar (mail.fmed.uba.ar [157.92.152.1]) by mail.postgresql.org (Postfix) with ESMTP id CCBC3634CB5 for ; Thu, 24 Jun 2010 19:13:17 -0300 (ADT) Received: from [157.92.152.105] (unknown [157.92.152.105]) by mail.fmed.uba.ar (Postfix) with ESMTP id 18C43492E72 for ; Thu, 24 Jun 2010 18:11:34 -0300 (ART) Message-ID: <4C23DB86.5040805@fmed.uba.ar> Date: Thu, 24 Jun 2010 19:26:14 -0300 From: Gerardo Herzig User-Agent: Thunderbird 2.0.0.6 (X11/20070801) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: differences between function returning 'setof table' and 'table' Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-5 required=5 tests=BAYES_40=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/83 X-Sequence-Number: 34274 Hi all. I dont understand why this is happening. Simple hardcoded function, looking for an id who doesn't exists: REATE FUNCTION pp() returns setof public.pp as $$ select * from public.pp where id=999999; $$ language sql; So there is no id=99999 in table public.pp test=# SELECT * from pp(); id| descripcion| ------------+-------------+ (0 filas) Great Now, when the function is defined to return `returns public.pp', when i execute it... test=# SELECT * from pp(); id | descripcion ------------+------------- | | (1 fila) 1 record? Why? Is this the expected behaviour? this is pg 8.3.11 Thanks! Gerardo