Re: Proposal: manipulating pg_control file from Perl - Mailing list pgsql-hackers

From Aleksander Alekseev
Subject Re: Proposal: manipulating pg_control file from Perl
Date
Msg-id CAJ7c6TOUjObRGi=3LnpmuFGi_c43pgXCagnmPhGia21myJWpVQ@mail.gmail.com
Whole thread Raw
In response to Re: Proposal: manipulating pg_control file from Perl  (Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>)
List 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



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: dsm_registry: Add detach and destroy features
Next
From: Fujii Masao
Date:
Subject: Re: Add “FOR UPDATE NOWAIT” lock details to the log.