| 79 | | # # This code handles aggregates by dropping and recreating them. |
| 80 | | # # The DROP would fail on aggregates as they would not exist |
| 81 | | # # in old postgis installations, thus we avoid this until we |
| 82 | | # # find a better strategy. |
| 83 | | # |
| 84 | | # if (m/^create aggregate (.*) *\(/i) |
| 85 | | # { |
| 86 | | # my $aggname = $1; |
| 87 | | # my $basetype = 'unknown'; |
| 88 | | # my $def = $_; |
| 89 | | # while(<INPUT>) |
| 90 | | # { |
| 91 | | # $def .= $_; |
| 92 | | # $basetype = $1 if (m/basetype *= *([^,]*) *,/); |
| 93 | | # last if m/\);/; |
| 94 | | # } |
| 95 | | # print "DROP AGGREGATE $aggname($basetype);\n"; |
| 96 | | # print "$def"; |
| 97 | | # } |
| | 79 | # This code handles aggregates by dropping and recreating them. |
| | 80 | # The DROP would fail on aggregates as they would not exist |
| | 81 | # in old postgis installations, thus we avoid this until we |
| | 82 | # find a better strategy. |
| | 83 | |
| | 84 | if (m/^create aggregate (.*) *\(/i) |
| | 85 | { |
| | 86 | my $aggname = $1; |
| | 87 | my $basetype = 'unknown'; |
| | 88 | my $def = $_; |
| | 89 | while(<INPUT>) |
| | 90 | { |
| | 91 | $def .= $_; |
| | 92 | $basetype = $1 if (m/basetype *= *([^,]*) *,/i); |
| | 93 | last if m/\);/; |
| | 94 | } |
| | 95 | print "DROP AGGREGATE IF EXISTS $aggname($basetype);\n"; |
| | 96 | print "$def"; |
| | 97 | } |