From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: John Naylor <jcnaylor@gmail.com>
To: Stas Kelvich <s.kelvich@postgrespro.ru>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: unused_oids script is broken with bsd sed
Date: Wed, 25 Apr 2018 11:48:13 -0400
Message-ID: <25f3ae08-5347-bd63-7866-05c135fdcfa3@2ndQuadrant.com> (raw)
In-Reply-To: <CAJVSVGU2w6rvTXghDe7-Y3x9Ca0833VmnC3HpaYKGLw4xznpJA@mail.gmail.com>
References: <37D774E4-FE1F-437E-B3D2-593F314B7505@postgrespro.ru>
<34a54c54-9132-1254-2bc3-d3489fb79728@2ndQuadrant.com>
<4473.1524665917@sss.pgh.pa.us>
<4DE444D1-DDE9-460F-AC2F-EB1B73D94A2D@postgrespro.ru>
<CAJVSVGU2w6rvTXghDe7-Y3x9Ca0833VmnC3HpaYKGLw4xznpJA@mail.gmail.com>
On 04/25/2018 10:55 AM, John Naylor wrote:
> On 4/25/18, Stas Kelvich <s.kelvich@postgrespro.ru> wrote:
>>> On 25 Apr 2018, at 17:18, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> I think we should rewrite
>>> both of them to use the Catalog.pm infrastructure.
>> Okay, seems reasonable. I'll put shared code in Catalog.pm and
>> update patch.
> I don't think you need any new code in Catalog.pm, I believe the
> suggestion was just to use that module as a stable interface to the
> data. Looking at your patch, I'll mention that we have an idiom for
> extracting #define'd OID symbols, e.g.:
>
> my $FirstBootstrapObjectId = Catalog::FindDefinedSymbol(
> 'access/transam.h', \@include_path, 'FirstBootstrapObjectId');
>
> This is preferred over using awk, which would have its own portability
> issues (Windows for starters).
>
> While I'm thinking out loud, it might be worthwhile to patch genbki.pl
> for the duplicate test, since they're run at the same time anyway (see
> catalog/Makefile), and we've already read all the data.
>
The logic for getting the set of oids should be centralized, if not in
Catalog.pm then in a script which serves both for dup0licate_oids and
unused_oids.
Here is something I cobbled together for the latter approach. It could
probably improve by using Catalog::FindDefinedSymbol()
cheers
andrew
--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachments:
unused_oids.pl (application/x-perl, 1.2K) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: andrew.dunstan@2ndquadrant.com, jcnaylor@gmail.com, s.kelvich@postgrespro.ru, tgl@sss.pgh.pa.us
Subject: Re: unused_oids script is broken with bsd sed
In-Reply-To: <25f3ae08-5347-bd63-7866-05c135fdcfa3@2ndQuadrant.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox