Move the built-in conversions into the initial catalog data.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 4 Jan 2019 00:47:53 +0000 (19:47 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 4 Jan 2019 00:47:53 +0000 (19:47 -0500)
commitd33faa285b8f692549c5ec278c8e631786ae4502
treeaec40320c6dd7683a23f614c789969ee8cbb0757
parent814c9019aa7b0ce3a4f19415023a256fdd717b20
Move the built-in conversions into the initial catalog data.

Instead of running a SQL script to create the standard conversion
functions and pg_conversion entries, put those entries into the
initial data in postgres.bki.

This shaves a few percent off the runtime of initdb, and also allows
accurate comments to be attached to the conversion functions; the
previous script labeled them with machine-generated comments that
were not quite right for multi-purpose conversion functions.
Also, we can get rid of the duplicative Makefile and MSVC perl
implementations of the generation code for that SQL script.

A functional change is that these pg_proc and pg_conversion entries
are now "pinned" by initdb.  Leaving them unpinned was perhaps a
good thing back while the conversions feature was under development,
but there seems no valid reason for it now.

Also, the conversion functions are now marked as immutable, where
before they were volatile by virtue of lacking any explicit
specification.  That seems like it was just an oversight.

To avoid using magic constants in pg_conversion.dat, extend
genbki.pl to allow encoding names to be converted, much as it
does for language, access method, etc names.

John Naylor

Discussion: https://postgr.es/m/CAJVSVGWtUqxpfAaxS88vEGvi+jKzWZb2EStu5io-UPc4p9rSJg@mail.gmail.com
13 files changed:
doc/src/sgml/bki.sgml
src/backend/catalog/Makefile
src/backend/catalog/genbki.pl
src/backend/utils/mb/conversion_procs/.gitignore [deleted file]
src/backend/utils/mb/conversion_procs/Makefile
src/bin/initdb/initdb.c
src/include/catalog/catversion.h
src/include/catalog/genbki.h
src/include/catalog/pg_conversion.dat [new file with mode: 0644]
src/include/catalog/pg_conversion.h
src/include/catalog/pg_proc.dat
src/test/regress/expected/misc_sanity.out
src/tools/msvc/Install.pm