Re: WIP: a way forward on bootstrap data
Mark Dilger <hornschnorter@gmail.com>
From: Mark Dilger <hornschnorter@gmail.com>
To: John Naylor <jcnaylor@gmail.com>,
Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2018-05-06T20:25:34Z
Lists: pgsql-hackers
> On May 6, 2018, at 12:08 PM, John Naylor <jcnaylor@gmail.com> wrote: > > On 5/7/18, Mark Dilger <hornschnorter@gmail.com> wrote: >> Hackers, >> >> Have you already considered and rejected the idea of having >> genbki.pl/Catalog.pm define constants that can be used in >> the catalog .dat files? I'm mostly curious if people think >> the resulting .dat files are better or worse using constants >> of this sort. For example: > ... >> + # pg_cast constants for castcontext >> + use constant IMPLICIT => 'i'; >> + use constant ASSIGNMENT => 'a'; >> + use constant EXPLICIT => 'e'; > > The comment refers to pg_cast, but these constants apply globally. > It's also not the right place from a maintainability perspective, and > if it was, now these values have different macros defined in two > places. This is not good. > >> - castcontext => 'a', castmethod => 'f' }, >> + castcontext => ASSIGNMENT, castmethod => FUNCTION }, > > For one, this breaks convention that the values are always > single-quoted. If you had a use case for something like this, I would > instead use the existing lookup infrastructure and teach genbki.pl to > parse the enums (or #defines as the case might be) in the relevant > header file. You'd need some improvement in readability to justify > that additional code, though. I don't think this example quite passes > (it's pretty obvious locally what the letters refer to), but others > may feel differently. John, Tom, thanks for the feedback. I share your concerns about my straw-man proposal. But.... In the catalogs, 'f' usually means 'false', not 'function'. A person reading pg_cast.dat could see: castmethod => 'f' and think that meant a binary conversion, since castmethod is false. That's almost exactly wrong. Hence my desire to write castmethod => FUNCTION I don't have any better proposal, though. mark
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