Re: Combine pg_walinspect till_end_of_wal functions with others

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, Julien Rouhaud <rjuju123@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2023-03-15T00:56:10Z
Lists: pgsql-hackers
On Tue, Mar 14, 2023 at 02:54:40PM -0700, Andres Freund wrote:
>                      Object description
>  -----------------------------------------------------------
>   function pg_get_wal_record_info(pg_lsn)
> - function pg_get_wal_records_info(pg_lsn,pg_lsn)
>   function pg_get_wal_records_info_till_end_of_wal(pg_lsn)
> - function pg_get_wal_stats(pg_lsn,pg_lsn,boolean)
> + function pg_get_wal_records_info(pg_lsn,pg_lsn)
>   function pg_get_wal_stats_till_end_of_wal(pg_lsn,boolean)
> + function pg_get_wal_stats(pg_lsn,pg_lsn,boolean)
>  (5 rows)
> 
>  -- Make sure checkpoints don't interfere with the test.
> 
> Looks like it's missing an ORDER BY.

Interesting.  This is "\dx+ pg_walinspect".
listOneExtensionContents() uses pg_describe_object() for that, and
there is already an ORDER BY based on it.  I would not have expected
this part to be that much sensitive.  Is this using a specific ICU
collation, because this is a side-effect of switching ICU as the
default in initdb?

As a solution, this could use pg_identify_object(classid, objid, 0) in
the ORDER BY clause to enforce a better ordering of the objects dealt
with as it decomposes the object name and the object type.  That
should be enough, I assume, as it looks to be parenthesis vs
underscore that switch the order.
--
Michael

Commits

  1. Improve a bit the tests of pg_walinspect

  2. Tweak regression test of pg_walinspect to be less collation-sensitive

  3. Rework design of functions in pg_walinspect

  4. Refactor and improve tests of pg_walinspect

  5. doc: Fix description of pg_get_wal_stats_till_end_of_wal() in pg_walinspect