]> granicus.if.org Git - postgis/commitdiff
Enhance DEFAULT specification stripper
authorSandro Santilli <strk@keybit.net>
Sat, 24 Dec 2011 09:57:52 +0000 (09:57 +0000)
committerSandro Santilli <strk@keybit.net>
Sat, 24 Dec 2011 09:57:52 +0000 (09:57 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8541 b70326c6-7e19-0410-871a-916f4a2858ee

utils/create_undef.pl

index 323c35a015bad6ddeb858b4275ed973e99ada4ae..3985a879f2dcfcb65d6ec9353e4208f674d0396f 100755 (executable)
@@ -45,6 +45,15 @@ my @tables = ();
 
 my $version = $ARGV[1];
 
+sub strip_default {
+       my $line = shift;
+       # strip quotes first
+       $line =~ s/'[^']*'//ig;
+       # drop default then
+       $line =~ s/DEFAULT [^,)]*//ig;
+       return $line;
+}
+
 my $time = POSIX::strftime("%c", localtime);
 print "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --\n";
 print "-- \n";
@@ -206,8 +215,7 @@ foreach my $fn (@funcs)
                my $fn_nm = $1;
                my $fn_arg = $2;
 
-               $fn_arg =~ s/DEFAULT [\w']+//ig;
-
+               $fn_arg = strip_default($fn_arg);
                if ( ! exists($type_funcs{$fn_nm}) )
                {
                        print "DROP FUNCTION IF EXISTS $fn_nm ($fn_arg);\n";