Re: Proposal: manipulating pg_control file from Perl

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Cc: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Subject: Re: Proposal: manipulating pg_control file from Perl
Date: 2025-03-14 14:39:11
Message-ID: CAJ7c6TOUjObRGi=3LnpmuFGi_c43pgXCagnmPhGia21myJWpVQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> > It is my understanding that Perl is not extremely aware of alignment.
> > For instance if I want to modify the checksum of the file and the
> > offset of the checksum is let's say 200 bytes on one platform, 204 on
> > another and 208 on a third, pack/unpack will not help me.
> >
> > Or did I miss something?
>
> You have to specify alignment manually using the `x![$type]` notation.
> I actually wrote up a pack template for the entire control file
> (assuming all types have alignof==sizeof), and it seems to work. Run
> the attached with a Postgres 17 data directory as the arguemnt, and it
> should show all the fields.

Oh that's neat. Thanks for sharing!

--
Best regards,
Aleksander Alekseev

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-03-14 15:07:25 Re: Add “FOR UPDATE NOWAIT” lock details to the log.
Previous Message Nathan Bossart 2025-03-14 14:36:46 Re: dsm_registry: Add detach and destroy features