Philip Warner <pjw@rhyme.com.au> writes:
> I don't think we have functions that return multiple rows,
We do, although they're a bit unwieldy to use; might be better to avoid
that feature. I'd be inclined to avoid the issue, and just have the
function return one result (which might contain newlines for readability
of course).
> and a 'select'
> without a 'from' is not strictly legal,
It is in postgres, and this is hardly SQL-standard-based anyway...
> Which brings me to my next idea:
> select defn from pg_dump where type='table and name = 'foo'
> or
> select related_items from pg_dump where type='table and name = 'foo'
> where pg_dump can be implemented via a rewrite rule....maybe.
The rewrite rule couldn't do any of the heavy lifting; it'd still end
up calling a function. A view like pg_rules might not be a bad idea,
but you should plan on exposing the underlying function for
flexibility.
regards, tom lane