Re: pgsql: Make the pg_stat_activity view call a SRF

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Make the pg_stat_activity view call a SRF
Date: 2008-08-16 05:03:43
Message-ID: 6222.1218863023@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Magnus Hagander wrote:
>> Bruce Momjian wrote:
>>> * Fix system views like pg_stat_all_tables to use set-returning
>>> functions, rather than views of per-column functions
>>
>> Thanks, and while I approve of that TODO, that's not actually the one I
>> was talking about in the email. The one I was talking about was "change
>> builtin set-returning functions to use OUT parameters so you can query
>> them without knowing the result format" or something like that.
>>
>> So, please keep the one you added, but add this one as well.

> Uh, I need more details on this. Can you give an example?

Good:

regression=# select * from pg_get_keywords();
word | catcode | catdesc
-------------------+---------+-----------------------
abort | U | Unreserved
absolute | U | Unreserved
access | U | Unreserved
...

Not so good:

regression=# select * from pg_show_all_settings();
ERROR: a column definition list is required for functions returning "record"

There's no longer any very good reason for built-in SRFs to not define
their own output record type.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Magnus Hagander 2008-08-16 12:42:27 pgsql: probes.h is generated from probes.d, not pg_trace.d.
Previous Message Bruce Momjian 2008-08-16 03:49:37 Re: pgsql: Make the pg_stat_activity view call a SRF

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2008-08-16 06:38:41 Re: proposal sql: labeled function params
Previous Message Tom Raney 2008-08-16 04:15:53 Re: Explain XML patch submitted