Обсуждение: pgsql: Fix doc patch --- pg_options_to_table() returns "setof record".

Поиск
Список
Период
Сортировка

pgsql: Fix doc patch --- pg_options_to_table() returns "setof record".

От
Bruce Momjian
Дата:
Fix doc patch --- pg_options_to_table() returns "setof record".

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/86434afb11093ba4e2893b717858d8ce790f3e2e

Modified Files
--------------
doc/src/sgml/func.sgml |    2 +-
1 files changed, 1 insertions(+), 1 deletions(-)


Re: pgsql: Fix doc patch --- pg_options_to_table() returns "setof record".

От
Andrew Dunstan
Дата:

On 02/26/2011 12:27 PM, Bruce Momjian wrote:
> Fix doc patch --- pg_options_to_table() returns "setof record".

This doesn't strike me as terribly helpful. Why don't we document what
sort of records it returns, since we know perfectly well?:

andrew=# \df pg_options_to_table
                                                         List of functions
    Schema   |        Name         | Result data type
|                        Argument data types                        |  Type

------------+---------------------+------------------+-------------------------------------------------------------------+--------
  pg_catalog | pg_options_to_table | SETOF record     | options_array
text[], OUT option_name text, OUT option_value text | normal
(1 row)


cheers

andrew



Re: pgsql: Fix doc patch --- pg_options_to_table() returns "setof record".

От
Bruce Momjian
Дата:
Andrew Dunstan wrote:
>
>
> On 02/26/2011 12:27 PM, Bruce Momjian wrote:
> > Fix doc patch --- pg_options_to_table() returns "setof record".
>
> This doesn't strike me as terribly helpful. Why don't we document what
> sort of records it returns, since we know perfectly well?:
>
> andrew=# \df pg_options_to_table
>                                                          List of functions
>     Schema   |        Name         | Result data type
> |                        Argument data types                        |  Type
>
------------+---------------------+------------------+-------------------------------------------------------------------+--------
>   pg_catalog | pg_options_to_table | SETOF record     | options_array
> text[], OUT option_name text, OUT option_value text | normal
> (1 row)

Well, other functions don't mention what they return either so I tried
to be consistent.  The mention below does explain their meaning, as does
the text next to it.

Should we fix them all?  I thought that column was just for data types.

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +

Re: pgsql: Fix doc patch --- pg_options_to_table() returns "setof record".

От
Andrew Dunstan
Дата:

On 02/26/2011 12:53 PM, Bruce Momjian wrote:
> Andrew Dunstan wrote:
>>
>> On 02/26/2011 12:27 PM, Bruce Momjian wrote:
>>> Fix doc patch --- pg_options_to_table() returns "setof record".
>> This doesn't strike me as terribly helpful. Why don't we document what
>> sort of records it returns, since we know perfectly well?:
>>
>> andrew=# \df pg_options_to_table
>>                                                           List of functions
>>      Schema   |        Name         | Result data type
>> |                        Argument data types                        |  Type
>>
------------+---------------------+------------------+-------------------------------------------------------------------+--------
>>    pg_catalog | pg_options_to_table | SETOF record     | options_array
>> text[], OUT option_name text, OUT option_value text | normal
>> (1 row)
> Well, other functions don't mention what they return either so I tried
> to be consistent.  The mention below does explain their meaning, as does
> the text next to it.

At least the description of pg_get_keywords() gives the names of the
fields, which I don't see being given for pg_options_to_table(). The
only others I see in a quick search are ts_debug(), ts_stat(),
ts_parse() and ts_token_type().

Meanwhile we seem to have lost the online developer docs at
<http://developer.postgresql.org/pgdocs/postgres/index.html> :-(

> Should we fix them all?


Possibly.

> I thought that column was just for data types.
>

I don't understand this sentence.

Incidentally, your example would possibly be better written as:

     select (pg_options_to_table(reloptions)).* from pg_class;

cheers

andrew

Re: pgsql: Fix doc patch --- pg_options_to_table() returns "setof record".

От
Bruce Momjian
Дата:
Andrew Dunstan wrote:
> > Well, other functions don't mention what they return either so I tried
> > to be consistent.  The mention below does explain their meaning, as does
> > the text next to it.
>
> At least the description of pg_get_keywords() gives the names of the
> fields, which I don't see being given for pg_options_to_table(). The
> only others I see in a quick search are ts_debug(), ts_stat(),
> ts_parse() and ts_token_type().

Ah, good point.  I see you were suggesting this in the paragraph below,
which I have done with the attached patch.

> Meanwhile we seem to have lost the online developer docs at
> <http://developer.postgresql.org/pgdocs/postgres/index.html> :-(

I fixed that in the patch too.

> > Should we fix them all?
>
>
> Possibly.
>
> > I thought that column was just for data types.
> >
>
> I don't understand this sentence.

I thought you were suggesting the table column labled "Return Type".  I
see what you wanted now.

> Incidentally, your example would possibly be better written as:
>
>      select (pg_options_to_table(reloptions)).* from pg_class;

Wow, that looks much better:

    test=> select (pg_options_to_table(reloptions)).* from pg_class;
             option_name         | option_value
    -----------------------------+--------------
     autovacuum_freeze_table_age | 10
    (1 row)

Do I want to know how you figured out how to do that?  :-O

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 9c8e19f..679f856 100644
*** a/doc/src/sgml/func.sgml
--- b/doc/src/sgml/func.sgml
*************** SELECT pg_type_is_visible('myschema.widg
*** 13386,13392 ****
        <row>
         <entry><literal><function>pg_options_to_table(<parameter>reloptions</parameter>)</function></literal></entry>
         <entry><type>setof record</type></entry>
!        <entry>get the set of storage option name/value pairs</></entry>
        </row>
        <row>

<entry><literal><function>pg_tablespace_databases(<parameter>tablespace_oid</parameter>)</function></literal></entry>
--- 13386,13392 ----
        <row>
         <entry><literal><function>pg_options_to_table(<parameter>reloptions</parameter>)</function></literal></entry>
         <entry><type>setof record</type></entry>
!        <entry>get the set of storage option name/value pairs</entry>
        </row>
        <row>

<entry><literal><function>pg_tablespace_databases(<parameter>tablespace_oid</parameter>)</function></literal></entry>
*************** SELECT pg_type_is_visible('myschema.widg
*** 13484,13491 ****
    </para>

    <para>
!    <function>pg_options_to_table</function> returns the set of storage option
!    name/value pairs when passed
     <structname>pg_class</>.<structfield>reloptions</> or
     <structname>pg_attribute</>.<structfield>attoptions</>.
    </para>
--- 13484,13492 ----
    </para>

    <para>
!    <function>pg_options_to_table</function> returns the set of storage
!    option name/value pairs
!    (<literal>option_name</>/<literal>option_value</>) when passed
     <structname>pg_class</>.<structfield>reloptions</> or
     <structname>pg_attribute</>.<structfield>attoptions</>.
    </para>