Thread: Have postgres.bki self-identify

Have postgres.bki self-identify

From
"David G. Johnston"
Date:
Hi!

While trying to find postgres.bki in my build directory searching for the file name didn't work because there is no comment in the file containing the file name; like there is in every other file we write or generate, including the related *_d.h files.  Add it.

It probably belongs before the version identifier but wasn't sure if that placement would be considered something worth retaining.

diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl
index 2501307c92..175fde4acc 100644
--- a/src/backend/catalog/genbki.pl
+++ b/src/backend/catalog/genbki.pl
@@ -458,6 +458,9 @@ open my $syscache_info_fh, '>', $syscache_info_file . $tmpext
 # version marker for .bki file
 print $bki "# PostgreSQL $major_version\n";
 
+# self-identify file in comment per code policies.
+print $bki "# postgres.bki\n";
+
 # vars to hold data needed for schemapg.h
 my %schemapg_entries;
 my @tables_needing_macros;

David J.

Re: Have postgres.bki self-identify

From
Robert Haas
Date:
On Thu, Mar 20, 2025 at 3:47 PM David G. Johnston
<david.g.johnston@gmail.com> wrote:
> While trying to find postgres.bki in my build directory searching for the file name didn't work because there is no
commentin the file containing the file name; like there is in every other file we write or generate, including the
related*_d.h files.  Add it. 

I'm not a fan of making it a policy that everyone has to do this. I'd
rather see us remove filenames from some places where they cause
maintenance overhead for little benefit. If somebody wants to find
postgres.bki, I guess you can just "find . -name postgres.bki -print"

--
Robert Haas
EDB: http://www.enterprisedb.com



Re: Have postgres.bki self-identify

From
Tom Lane
Date:
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Mar 20, 2025 at 3:47 PM David G. Johnston
> <david.g.johnston@gmail.com> wrote:
>> While trying to find postgres.bki in my build directory searching for the file name didn't work because there is no
commentin the file containing the file name; like there is in every other file we write or generate, including the
related*_d.h files.  Add it. 

> I'm not a fan of making it a policy that everyone has to do this. I'd
> rather see us remove filenames from some places where they cause
> maintenance overhead for little benefit. If somebody wants to find
> postgres.bki, I guess you can just "find . -name postgres.bki -print"

While I don't care much about the filename per se, I do note that
we embed copyright notices into most generated files.  Why
not this one?

            regards, tom lane



Re: Have postgres.bki self-identify

From
Robert Haas
Date:
On Thu, Mar 20, 2025 at 4:33 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> While I don't care much about the filename per se, I do note that
> we embed copyright notices into most generated files.  Why
> not this one?

I don't care enough to argue about it. I suppose one can make an
argument for a variety of things.

--
Robert Haas
EDB: http://www.enterprisedb.com