Changeset 4132

Show
Ignore:
Timestamp:
06/03/09 16:56:23 (3 years ago)
Author:
pramsey
Message:

Fix for issue #189, includes implicit requirement for 8.2+ in DROP AGGREGATE

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/postgis/Makefile.in

    r3552 r4132  
    1414 
    1515# Files to be copied to the contrib/ directory 
    16 DATA_built=postgis.sql 
     16DATA_built=postgis.sql postgis_upgrade.sql 
    1717DATA=../spatial_ref_sys.sql 
    1818 
     
    7676        sed 's,MODULE_PATHNAME,$$libdir/$*-@POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@,g' $< >$@ 
    7777 
     78postgis_upgrade.sql: postgis.sql 
     79        $(PERL) ../utils/postgis_proc_upgrade.pl $< > $@ 
     80 
    7881# Generate any .sql.in files from .sql.in.c files by running them through the C pre-processor  
    7982$(SQL_OBJS): %.in: %.in.c 
  • trunk/utils/postgis_proc_upgrade.pl

    r2214 r4132  
    7777        } 
    7878 
    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        } 
    9898 
    9999}