differences between function returning 'setof table' and 'table' - Mailing list pgsql-sql

From Gerardo Herzig
Subject differences between function returning 'setof table' and 'table'
Date
Msg-id 4C23DB86.5040805@fmed.uba.ar
Whole thread Raw
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Petru Ghita
Date:
Subject: Re: question about partitioning
Next
From: Thom Brown
Date:
Subject: Re: [GENERAL] How to Insert and retrieve multilingual (Hindi "an Indian language") into PostgreSQL