Re: Inconsistent behavior on select * from void_function()?
От | Gregory Stark |
---|---|
Тема | Re: Inconsistent behavior on select * from void_function()? |
Дата | |
Msg-id | 87ps7eoyaa.fsf@stark.xeocode.com обсуждение исходный текст |
Ответ на | Inconsistent behavior on select * from void_function()? (Josh Berkus <josh@agliodbs.com>) |
Список | pgsql-hackers |
"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
В списке pgsql-hackers по дате отправления: