mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Gene Selkov's SEG datatype (GiST example code)
This commit is contained in:
20
contrib/seg/sort-segments.pl
Executable file
20
contrib/seg/sort-segments.pl
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# this script will sort any table with the segment data type in its last column
|
||||
|
||||
while (<>) {
|
||||
chomp;
|
||||
push @rows, $_;
|
||||
}
|
||||
|
||||
foreach ( sort {
|
||||
@ar = split("\t", $a);
|
||||
$valA = pop @ar;
|
||||
$valA =~ s/[~<> ]+//g;
|
||||
@ar = split("\t", $b);
|
||||
$valB = pop @ar;
|
||||
$valB =~ s/[~<> ]+//g;
|
||||
$valA <=> $valB
|
||||
} @rows ) {
|
||||
print "$_\n";;
|
||||
}
|
Reference in New Issue
Block a user