Re: unused_oids script is broken with bsd sed

From: John Naylor <jcnaylor(at)gmail(dot)com>
To: Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru>
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 19:09:47
Message-ID: CAJVSVGU0cPPwMhCfVz5PvpTDrjZzeT=0QHUhMbg=MjaMO_Gr+A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 4/26/18, Stas Kelvich <s(dot)kelvich(at)postgrespro(dot)ru> wrote:
> 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.

Looks pretty good. Some comments:

Just after you posted, I sent a patch that tweaks the API of
Catalog.pm for toast and index oids. If you use that API in your
patch, you can get rid of the extra bookkeeping you added for those
oids.

The original scripts skipped the relation and rowtype oids for
bootstrap catalogs. You've replaced that with two data-level tests for
pg_class plus pg_type composite types. I think the original test was a
bit cleaner in this regard.

For this type of call:

+my @oids = @{ Catalog::FindAllOidsFromHeaders(@input_files) };
+foreach my $oid (@oids)

this style is used by other callers of the module:

+my $oids = Catalog::FindAllOidsFromHeaders(@input_files);
+foreach my $oid (@{ $oids })

For those following along, these scripts still assume we're in the
catalog directory. I can hack on that part tomorrow if no one else
has.

-John Naylor

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kefan Yang 2018-04-25 19:12:05 GSoC 2018: Sorting Algorithm and Benchmarking
Previous Message Teodor Sigaev 2018-04-25 19:06:33 Re: Corrupted btree index on HEAD because of covering indexes