Re: Proposal: manipulating pg_control file from Perl

2025-03-15 Thread Christoph Berg
Re: Aleksander Alekseev > 1) Provide a tool written in C that allows changing pg_control, e.g. > `pg_writecontoldata` or maybe a flat like `pg_controldata -w`. I thought we already had pg_resetwal for that. Christoph

Re: Proposal: manipulating pg_control file from Perl

2025-03-15 Thread Dagfinn Ilmari Mannsåker
Aleksander Alekseev writes: > Hi, > > Previously it was pointed out [1] that manipulating the pg_control > file from Cluster.pm may be beneficial under certain conditions. [...] > Unfortunately this can't be done at the moment. One of the reasons is > that the ControlFileData structure stores pla

Re: Proposal: manipulating pg_control file from Perl

2025-03-14 Thread Aleksander Alekseev
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

Re: Proposal: manipulating pg_control file from Perl

2025-03-14 Thread Dagfinn Ilmari Mannsåker
Aleksander Alekseev writes: > Hi Dagfinn, > >> Notwitstanding Tom's objections, these are not reasons for not being >> able to manipulate these values from Perl. The `i` and `I` formats for >> pack/unpack (see https://perldoc.perl.org/functions/pack) use what the C >> compiler calls `int`, in te

Re: Proposal: manipulating pg_control file from Perl

2025-03-14 Thread Christoph Berg
Re: Aleksander Alekseev > Do you think pg_resetwall should be able to do more than it currently > does, or merely pointing out that we already have a tool for editing > pg_control file? I don't know if being able to mess with these fields makes sense, but if so, pg_resetwal seems like the correct

Re: Proposal: manipulating pg_control file from Perl

2025-03-14 Thread Aleksander Alekseev
Hi Christoph, > Re: Aleksander Alekseev > > 1) Provide a tool written in C that allows changing pg_control, e.g. > > `pg_writecontoldata` or maybe a flat like `pg_controldata -w`. > > I thought we already had pg_resetwal for that. That's a good point. In the case I referred to [1] however I want

Re: Proposal: manipulating pg_control file from Perl

2025-03-14 Thread Aleksander Alekseev
Hi Dagfinn, > Notwitstanding Tom's objections, these are not reasons for not being > able to manipulate these values from Perl. The `i` and `I` formats for > pack/unpack (see https://perldoc.perl.org/functions/pack) use what the C > compiler calls `int`, in terms of both endianness and size. > >

Re: Proposal: manipulating pg_control file from Perl

2025-03-13 Thread Tom Lane
Aleksander Alekseev writes: > Previously it was pointed out [1] that manipulating the pg_control > file from Cluster.pm may be beneficial under certain conditions. > As an example, one can downgrade the catalog version in pg_control, > place input files for pg_upgrade, execute pg_upgrade and chec