pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerardo Herzig <gherzig@fmed.uba.ar>
To: pgsql-sql@postgresql.org
Subject: differences between function returning 'setof table' and 'table'
Date: Thu, 24 Jun 2010 19:26:14 -0300
Message-ID: <4C23DB86.5040805@fmed.uba.ar> (raw)

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



Message-ID: <4C23DB86.5040805@fmed.uba.ar>
Permalink:  ../4C23DB86.5040805@fmed.uba.ar/
Also on:    postgresql.org/message-id/4C23DB86.5040805@fmed.uba.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: gherzig@fmed.uba.ar
  Subject: Re: differences between function returning 'setof table' and 'table'
  In-Reply-To: <4C23DB86.5040805@fmed.uba.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox