[PATCH] Using named captures in Catalog::ParseHeader()

From: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>
Subject: [PATCH] Using named captures in Catalog::ParseHeader()
Date: 2023-06-01 12:12:22
Message-ID: 87y1l3s7o9.fsf@wibble.ilmari.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Hackers,

Peter's patch set for autogenerating syscache info
touched on one of my least favourite parts of Catalog.pm: the
parenthesis-counting nightmare that is the parsing of catalog header

However, now that we require Perl 5.14, we can use the named capture
feature (introduced in Perl 5.10) to make that a lot clearer, as in the
attached patch.

While I was rewriting the regexes I noticed that they were inconsistent
about whether they accepted whitespace in the parameter lists, so I took
the liberty to make them consistently allow whitespace after the opening
paren and the commas, which is what most of them already did.

I've verified that the generated postgres.bki is identical to before,
and all tests pass.

- ilmari

Attachment Content-Type Size
0001-Use-named-captures-in-Catalog-ParseHeader.patch text/x-diff 3.9 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2023-06-01 12:14:28 Re: Avoiding another needless ERROR during nbtree page deletion
Previous Message Melih Mutlu 2023-06-01 11:22:30 Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication