Re: WIP: a way forward on bootstrap data - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: WIP: a way forward on bootstrap data
Date
Msg-id 20180322143827.axu6vuehhctkdk7h@alvherre.pgsql
Whole thread Raw
In response to Re: WIP: a way forward on bootstrap data  (John Naylor <jcnaylor@gmail.com>)
Responses Re: WIP: a way forward on bootstrap data  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: WIP: a way forward on bootstrap data  (John Naylor <jcnaylor@gmail.com>)
List pgsql-hackers
John Naylor wrote:

> I've attached an earlier version of pg_proc.h with both formats as I
> understand them. I turned a couple comments into multi-line comments
> to demonstrate. I think without spaces it's just as hard to read as
> with multiple annotations. I'd vote for spaces, but then again I'm not
> the one who has to read these things very often.

how about letting the line go long, with the comment at the right of
each definition, with one blank line between struct members, as in the
sample below?  You normally don't care that these lines are too long
since you seldom edit them -- one mostly adds or remove entire lines
instead, so there's not as much need for side-by-side diffs as with
regular code.  (One issue with this proposal is how to convince pgindent
to leave the long lines alone.)

To me, an important property of these structs is fitting as much as
possible (vertically) in a screenful; the other proposed modes end up
with too many lines.

CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO
{
    NameData    proname;        /* procedure name */

    Oid         pronamespace BKI_DEFAULT(PGNSP); /* OID of namespace containing this proc */

    Oid         proowner BKI_DEFAULT(PGUID); /* procedure owner */

    Oid         prolang BKI_DEFAULT(12); /* OID of pg_language entry */

    float4      procost BKI_DEFAULT(1); /* estimated execution cost */

    float4      prorows BKI_DEFAULT(0); /* estimated # of rows out (if proretset) */

    Oid         provariadic BKI_DEFAULT(0); /* element type of variadic array, or 0 */

    regproc     protransform BKI_DEFAULT(0); /* transforms calls to it during planning */

    bool        proisagg BKI_DEFAULT(f); /* is it an aggregate? */

    bool        proiswindow BKI_DEFAULT(f); /* is it a window function? */

    bool        prosecdef BKI_DEFAULT(f); /* security definer */

    bool        proleakproof BKI_DEFAULT(f); /* is it a leak-proof function? */

    bool        proisstrict BKI_DEFAULT(f); /* strict with respect to NULLs? */

    bool        proretset BKI_DEFAULT(f); /* returns a set? */

    char        provolatile BKI_DEFAULT(v); /* see PROVOLATILE_ categories below */

    char        proparallel BKI_DEFAULT(u); /* see PROPARALLEL_ categories below */

    int16       pronargs; /* number of arguments */

    int16       pronargdefaults BKI_DEFAULT(0); /* number of arguments with defaults */

    Oid         prorettype; /* OID of result type */

    /*
     * variable-length fields start here, but we allow direct access to
     * proargtypes
     */

    oidvector    proargtypes; /* parameter types (excludes OUT params) */

#ifdef CATALOG_VARLEN

    Oid         proallargtypes[1] BKI_DEFAULT(_null_); /* all param types (NULL if IN only) */

    char        proargmodes[1] BKI_DEFAULT(_null_); /* parameter modes (NULL if IN only) */

    text        proargnames[1] BKI_DEFAULT(_null_); /* parameter names (NULL if no names) */

    pg_node_tree proargdefaults BKI_DEFAULT(_null_); /* list of expression trees for argument defaults (NULL if none)
*/

    Oid         protrftypes[1] BKI_DEFAULT(_null_); /* types for which to apply transforms */

    text        prosrc BKI_FORCE_NOT_NULL; /* procedure source text */

    text        probin BKI_DEFAULT(_null_); /* secondary procedure info (can be NULL) */

    text        proconfig[1] BKI_DEFAULT(_null_); /* procedure-local GUC settings */

    aclitem     proacl[1] BKI_DEFAULT(_null_); /* access permissions */
#endif
} FormData_pg_proc;

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: [HACKERS] new function for tsquery creartion
Next
From: Tom Lane
Date:
Subject: Re: WIP: a way forward on bootstrap data