Re: WIP: a way forward on bootstrap data

From: Mark Dilger <hornschnorter(at)gmail(dot)com>
To: Mark Dilger <hornschnorter(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: WIP: a way forward on bootstrap data
Date: 2018-05-06 18:20:03
Message-ID: 1EDFFB89-A303-48CE-832F-606DB9CEB9E9@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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:

diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm
index 7497d9cd9f..58ce24adf0 100644
--- a/src/backend/catalog/Catalog.pm
+++ b/src/backend/catalog/Catalog.pm
@@ -250,6 +250,21 @@ sub ParseData

if ($lcnt == $rcnt)
{
+ # pg_cast constants for castcontext
+ use constant IMPLICIT => 'i';
+ use constant ASSIGNMENT => 'a';
+ use constant EXPLICIT => 'e';
+
+ # pg_cast constants for castmethod
+ use constant FUNCTION => 'f';
+ use constant BINARY => 'b';
+ use constant INOUT => 'i';
+
+ # pg_proc constants for provolatile
+ use constant IMMUTABLE => 'i';
+ use constant STABLE => 's';
+ use constant VOLATILE => 'v';
+
eval '$hash_ref = ' . $_;
if (!ref $hash_ref)
{
diff --git a/src/include/catalog/pg_cast.dat b/src/include/catalog/pg_cast.dat
index cf007528fd..a4ceceb652 100644
--- a/src/include/catalog/pg_cast.dat
+++ b/src/include/catalog/pg_cast.dat
@@ -19,79 +19,79 @@
# int2->int4->int8->numeric->float4->float8, while casts in the
# reverse direction are assignment-only.
{ castsource => 'int8', casttarget => 'int2', castfunc => 'int2(int8)',
- castcontext => 'a', castmethod => 'f' },
+ castcontext => ASSIGNMENT, castmethod => FUNCTION },
{ castsource => 'int8', casttarget => 'int4', castfunc => 'int4(int8)',
- castcontext => 'a', castmethod => 'f' },
+ castcontext => ASSIGNMENT, castmethod => FUNCTION },
{ castsource => 'int8', casttarget => 'float4', castfunc => 'float4(int8)',

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-05-06 18:57:49 Re: WIP: a way forward on bootstrap data
Previous Message Yura Sokolov 2018-05-06 17:56:32 Re: [HACKERS] Clock with Adaptive Replacement