Re: How can I create null value from function call with no results?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How can I create null value from function call with no results?
Дата
Msg-id 11466.1406746451@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How can I create null value from function call with no results?  (Seref Arikan <serefarikan@gmail.com>)
Ответы Re: How can I create null value from function call with no results?
Список pgsql-general
Seref Arikan <serefarikan@gmail.com> writes:
> I want to call a function using a column of a table as the parameter and
> return the parameter and function results together.
> The problem is, when the function returns an empty row my select statement
> that uses the function returns an empty row as well.

This function isn't actually returning an empty row; it's returning no
rows, which is possible because RETURNS TABLE is really RETURNS SETOF
some-record-type.  It's not entirely clear what you're trying to
accomplish, so the first thing is to get clear on that.  Perhaps you
want it to always return one row?  If so, don't use the TABLE notation
(just list some OUT parameters instead).  If you actually do want it
to return zero rows, then the problem is not with the function but with
the query you're using it in.  Set-returning functions in a SELECT's
targetlist are often a bad idea.

            regards, tom lane


В списке pgsql-general по дате отправления:

Предыдущее
От: Merlin Moncure
Дата:
Сообщение: Re: free RAM not being used for page cache
Следующее
От: Kevin Goess
Дата:
Сообщение: Re: free RAM not being used for page cache