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:
42
contrib/seg/seg-validate.pl
Executable file
42
contrib/seg/seg-validate.pl
Executable file
@ -0,0 +1,42 @@
|
||||
#!/usr/bin/perl
|
||||
$integer = '[+-]?[0-9]+';
|
||||
$real = '[+-]?[0-9]+\.[0-9]+';
|
||||
|
||||
$RANGE = '(\.\.)(\.)?';
|
||||
$PLUMIN = q(\'\+\-\');
|
||||
$FLOAT = "(($integer)|($real))([eE]($integer))?";
|
||||
$EXTENSION = '<|>|~';
|
||||
|
||||
$boundary = "($EXTENSION)?$FLOAT";
|
||||
$deviation = $FLOAT;
|
||||
|
||||
$rule_1 = $boundary . $PLUMIN . $deviation;
|
||||
$rule_2 = $boundary . $RANGE . $boundary;
|
||||
$rule_3 = $boundary . $RANGE;
|
||||
$rule_4 = $RANGE . $boundary;
|
||||
$rule_5 = $boundary;
|
||||
|
||||
|
||||
print "$rule_5\n";
|
||||
while (<>) {
|
||||
# s/ +//g;
|
||||
if ( /^($rule_1)$/ ) {
|
||||
print;
|
||||
}
|
||||
elsif ( /^($rule_2)$/ ) {
|
||||
print;
|
||||
}
|
||||
elsif ( /^($rule_3)$/ ) {
|
||||
print;
|
||||
}
|
||||
elsif ( /^($rule_4)$/ ) {
|
||||
print;
|
||||
}
|
||||
elsif ( /^($rule_5)$/ ) {
|
||||
print;
|
||||
}
|
||||
else {
|
||||
print STDERR "error in $_\n";
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user