Re: WIP: a way forward on bootstrap data
Alvaro Herrera <alvherre@alvh.no-ip.org>
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: John Naylor <jcnaylor@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2018-03-22T14:38:27Z
Lists: 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
Commits
-
Clarify handling of special-case values in bootstrap catalog data.
- 45c6d75f8cd2 11.0 landed
-
Replace our traditional initial-catalog-data format with a better design.
- 372728b0d495 11.0 landed
-
Faster partition pruning
- 9fdb675fc5d2 11.0 cited
-
Minor cleanup in genbki.pl.
- 8d90b4d01a61 11.0 landed
-
Trivial adjustments in preparation for bootstrap data conversion.
- a351679c806e 11.0 landed
-
Remove hard-coded schema knowledge about pg_attribute from genbki.pl
- 49c784ece766 11.0 landed
-
Minor edits to catalog files and scripts
- 9373baa0f764 11.0 landed
-
Hide most variable-length fields from Form_pg_* structs
- 8137f2c32322 9.2.0 cited