| From: | Josh Berkus <josh(at)agliodbs(dot)com> |
|---|---|
| To: | Kai Hessing <kai(dot)hessing(at)hobsons(dot)de> |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: can a function return a virtual table? |
| Date: | 2005-04-23 18:00:56 |
| Message-ID: | 200504231100.56375.josh@agliodbs.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Christopher Browne | 2005-04-23 18:18:30 | Re: How to select from many database ?? |
| Previous Message | Tadej Kanizar | 2005-04-23 17:55:29 | weird SQL statement question |