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)',


Reply via email to