Re: can a function return a virtual table?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: can a function return a virtual table?
Дата
Msg-id 200504231100.56375.josh@agliodbs.com
обсуждение исходный текст
Ответ на can a function return a virtual table?  (Kai Hessing <kai.hessing@hobsons.de>)
Список pgsql-sql
Kai,

> It would be much nicer to have to write something like: SELECT xyz, abc
> FROM active(tablex); where the function 'active(x)' returns a virtual
> table with all entries from table x where status is > -1. But sadly I
> have no idea how write such a function. Good old O'reilly can't help (or
> i'm to dumb *g*).

http://techdocs.postgresql.org/guides/SetReturningFunctions

Beware, though, that query plan estimation for SRFs is less accurate than for 
regular subqueries, so you could end up with unnecessarily slow query 
execution.  Test!

-- 
Josh Berkus
Aglio Database Solutions
San Francisco


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

Предыдущее
От: "Tadej Kanizar"
Дата:
Сообщение: weird SQL statement question
Следующее
От: Frank Bax
Дата:
Сообщение: Re: weird SQL statement question