[postgis-tickets] r15279 - PostGIS upgrade scripts missing GRANT for views
Regina Obe
lr at pcorp.us
Mon Dec 19 19:24:55 PST 2016
Author: robe
Date: 2016-12-19 19:24:55 -0800 (Mon, 19 Dec 2016)
New Revision: 15279
Modified:
branches/2.2/utils/postgis_proc_upgrade.pl
Log:
PostGIS upgrade scripts missing GRANT for views
closes #3680 for PostGIS 2.2
also correct strk's email
Modified: branches/2.2/utils/postgis_proc_upgrade.pl
===================================================================
--- branches/2.2/utils/postgis_proc_upgrade.pl 2016-12-20 03:22:46 UTC (rev 15278)
+++ branches/2.2/utils/postgis_proc_upgrade.pl 2016-12-20 03:24:55 UTC (rev 15279)
@@ -4,7 +4,7 @@
# PostGIS - Spatial Types for PostgreSQL
# http://postgis.net
#
-# Copyright (C) 2014 Sandro Santilli <strk at keybit.net>
+# Copyright (C) 2014 Sandro Santilli <strk at kbt.io>
# Copyright (C) 2009-2010 Paul Ramsey <pramsey at opengeo.org>
# Copyright (C) 2005 Refractions Research Inc.
#
@@ -378,6 +378,17 @@
last if /\;\s*$/;
}
}
+
+ # Always output grant permissions (see ticket #3680)
+ if ( /^grant select\s+(\S+)\s*/i )
+ {
+ print;
+ while(<INPUT>)
+ {
+ print;
+ last if /\;\s*$/;
+ }
+ }
# Always output create ore replace rule
if ( /^create or replace rule\s+(\S+)\s*/i )
@@ -390,6 +401,37 @@
}
}
+ # This code handles operator family by creating them if we are doing a major upgrade
+ if ( /^create operator family\s+(\w+)\s+USING\s+(\w+)\s*/i )
+ {
+ my $opfname = $1;
+ my $amname = $2;
+ my $def = $_;
+ my $opfsig = $opfname . " " . $amname;
+ while(<INPUT>)
+ {
+ $def .= $_;
+ last if /\);/;
+ }
+
+ my $last_updated = parse_last_updated($comment);
+ if ( ! $last_updated ) {
+ print STDERR "WARNING: no last updated info for operator family '${opfname}'\n";
+ $last_updated = find_last_updated("opfamilies", $opfsig);
+ }
+ print "-- Operator family ${opfsig} -- LastUpdated: ${last_updated}\n";
+ print <<"EOF";
+DO LANGUAGE 'plpgsql'
+\$postgis_proc_upgrade\$
+BEGIN
+ IF $last_updated > version_from_num FROM _postgis_upgrade_info THEN
+ EXECUTE \$postgis_proc_upgrade_parsed_def\$ $def \$postgis_proc_upgrade_parsed_def\$;
+ END IF;
+END
+\$postgis_proc_upgrade\$;
+EOF
+ }
+
# This code handles operator classes by creating them if we are doing a major upgrade
if ( /^create operator class\s+(\w+)\s*/i )
{
More information about the postgis-tickets
mailing list