Re: unused_oids script is broken with bsd sed

From: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>
To: John Naylor <jcnaylor(at)gmail(dot)com>
Cc: andreas(at)proxel(dot)se, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, David Fetter <david(at)fetter(dot)org>
Subject: Re: unused_oids script is broken with bsd sed
Date: 2018-04-25 17:55:08
Message-ID: 26728623-7783-4103-9BED-08D443C1729F@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 25 Apr 2018, at 17:55, John Naylor <jcnaylor(at)gmail(dot)com> wrote:
>
> On 4/25/18, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru> wrote:
>>> On 25 Apr 2018, at 17:18, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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', \(at)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.
>
> -John Naylor
>

New version is attached. I've put iterator into Catalog.pm to avoid copy-pasting
it over two scripts. Also instead of greping through *.dat and *.h files I've
used parsers provided in Catalog module. That way should be more sustainable
to format changes.

Anyone who wanted to help with scripts -- feel free to rewrite.

Attachment Content-Type Size
0001-Rewrite-unused_oids-in-perl.patch application/octet-stream 6.0 KB
unknown_filename text/plain 100 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2018-04-25 17:59:40 Re: Oddity in tuple routing for foreign partitions
Previous Message Merlin Moncure 2018-04-25 17:02:43 Re: Built-in connection pooling