Inconsistent behavior on select * from void_function()? - Mailing list pgsql-hackers

From Josh Berkus
Subject Inconsistent behavior on select * from void_function()?
Date
Msg-id 200703121454.10140.josh@agliodbs.com
Whole thread Raw
Responses Re: Inconsistent behavior on select * from void_function()?  (Gregory Stark <stark@enterprisedb.com>)
Re: Inconsistent behavior on select * from void_function()?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Folks,

This seems wrong to me:

postgres=# create table test1 ( testy int );
CREATE TABLE
postgres=# insert into test1 values ( 5 );
INSERT 0 1

postgres=# create function void_func ( IN theval int ) returns void as $f$
postgres$# update test1 set testy = $1;
postgres$# $f$ language sql;
CREATE FUNCTION                     ^
postgres=# select * from void_func( 9 );void_func
-----------

(1 row)

postgres=# select void_func( 10 ) is null;?column?
----------t
(1 row)

postgres=# create function void_func2( IN theval int )
postgres-# returns void as $f$
postgres$# begin
postgres$# update test1 set testy = theval;
postgres$# return;
postgres$# end;$f$ language plpgsql;
CREATE FUNCTION
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?

(version 8.2.3)

-- 
--Josh

Josh Berkus
PostgreSQL @ Sun
San Francisco


pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: CLUSTER and MVCC
Next
From: Josh Berkus
Date:
Subject: possible de-optimization of multi-column index plans in 8.3