"Josh Berkus" <josh@agliodbs.com> writes:

> postgres=# select * from void_func2(19);
>  void_func2
> ------------
>
> (1 row)
>
>
> postgres=# select void_func2(19) is null;
>  ?column?
> ----------
>  f
> (1 row)
>
>
> Why is a function which returns void returning a row?   Why is that row 
> NULL if it's a SQL function and empty if it's a PLPGSQL function?

Generally you can treat functions that return a data type as if they returned
a set of rows of that data type. I get the impression this is a considered a
quirk of the implementation and not an advertised feature though: 


postgres=# create function foo() returns integer as 'select 1' language sql;
CREATE FUNCTION
postgres=# select foo();
 foo 
-----
   1
(1 row)

postgres=# select * from foo();
 foo 
-----
   1
(1 row)



I can't speak to the handling of IS NULL though. It is a bit curious.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faq

Reply via email to