doc: Fix section of functions age(xid) and mxid_age(xid)
[pgsql.git] / contrib / seg / sort-segments.pl
blob44f203a9a9fefc29435fde7801e48766959ab263
1 #!/usr/bin/perl
3 # Copyright (c) 2021-2024, PostgreSQL Global Development Group
5 # this script will sort any table with the segment data type in its last column
7 use strict;
8 use warnings FATAL => 'all';
10 my @rows;
12 while (<>)
14 chomp;
15 push @rows, $_;
18 foreach (
19 sort {
20 my @ar = split("\t", $a);
21 my $valA = pop @ar;
22 $valA =~ s/[~<> ]+//g;
23 @ar = split("\t", $b);
24 my $valB = pop @ar;
25 $valB =~ s/[~<> ]+//g;
26 $valA <=> $valB
27 } @rows)
29 print "$_\n";