From 14a06b4f4fa5a9e5be174e91ef16ce131458f95b Mon Sep 17 00:00:00 2001 From: David Blasby Date: Wed, 8 Aug 2001 21:54:15 +0000 Subject: [PATCH] Added new undef.sql file and perl file to generate it. git-svn-id: http://svn.osgeo.org/postgis/trunk@53 b70326c6-7e19-0410-871a-916f4a2858ee --- create_undef.pl | 122 ++++++++++++++++++++++++++++++++++++++++++++++ postgis_undef.sql | 102 ++++++++++++++++++++++++++++++++++++++ undef-funcs.sql | 95 ------------------------------------ 3 files changed, 224 insertions(+), 95 deletions(-) create mode 100644 create_undef.pl create mode 100644 postgis_undef.sql delete mode 100644 undef-funcs.sql diff --git a/create_undef.pl b/create_undef.pl new file mode 100644 index 000000000..3ab7f831a --- /dev/null +++ b/create_undef.pl @@ -0,0 +1,122 @@ +# perl create_undef.pl +# creates a new sql script to delete all the postgis functions et al. + +($#ARGV == 0) || die "usage: perl create_undef.pl \ncreates a new sql script to delete all the postgis functions et al."; + + +# drops are in the following order: +# 1. Indexing system stuff +# 2. Meta datatables +# 3. Aggregates - must be of type geometry +# 4. Operators - must be of type op(geometry,geometry) +# 5. Functions +# 6. Types + +@aggs =(); +@funcs = (); +@types = (); +@ops = (); + + +open( INPUT,$ARGV[0]) || die "couldnt open file: $ARGV[0]"; + + + print "begin;\n"; + print "--- indexing meta table stuff\n"; + print "delete from pg_amproc where amopclaid = (select oid from pg_opclass where opcname = 'gist_geometry_ops');\n"; + print "delete from pg_amop where amopclaid = (select oid from pg_opclass where opcname = 'gist_geometry_ops');\n"; + print "delete from pg_opclass where opcname = 'gist_geometry_ops';\n"; + + + while( $line = ) + { + + if ($line =~ /^create function/i) + { + push (@funcs, $line); + } + if ($line =~ /^create operator/i) + { + push (@ops, $line); + } + if ($line =~ /^create AGGREGATE/i) + { + push (@aggs, $line); + } + if ($line =~ /^create type/i) + { + push (@types, $line); + } + } + + #now have all the info, do the deletions + + print "--- AGGREGATEs\n"; + + foreach $agg (@aggs) + { + if ($agg =~ /create AGGREGATE ([^(]+)/i ) + { + print "drop AGGREGATE $1 geometry;\n"; + } + else + { + die "couldnt parse line: $line\n"; + } + } + + print "--- operators\n"; + + foreach $op (@ops) + { + if ($op =~ /create operator ([^(]+)/i ) + { + print "drop operator $1 (geometry,geometry);\n"; + } + else + { + die "couldnt parse line: $line\n"; + } + } + + + print "--- functions\n"; + + foreach $fn (@funcs) + { + chomp($fn); chomp($fn); + + + if ($fn =~ /create function ([^(]+)\(([^()]*)\)/i ) + { + print "drop function $1 ($2);\n"; + } + else + { + die "couldnt parse line: $line\n"; + } + } + + print "--- types\n"; + + foreach $type (@types) + { + if ($type =~ /create type ([^(]+)/i ) + { + print "drop type $1;\n"; + } + else + { + die "couldnt parse line: $line\n"; + } + } + + + + print "end;\n"; + + +close( INPUT ); + +1; + diff --git a/postgis_undef.sql b/postgis_undef.sql new file mode 100644 index 000000000..b1d90bab1 --- /dev/null +++ b/postgis_undef.sql @@ -0,0 +1,102 @@ +begin; +--- indexing meta table stuff +delete from pg_amproc where amopclaid = (select oid from pg_opclass where opcname = 'gist_geometry_ops'); +delete from pg_amop where amopclaid = (select oid from pg_opclass where opcname = 'gist_geometry_ops'); +delete from pg_opclass where opcname = 'gist_geometry_ops'; +--- AGGREGATEs +drop AGGREGATE extent geometry; +--- operators +drop operator << (geometry,geometry); +drop operator &< (geometry,geometry); +drop operator && (geometry,geometry); +drop operator &> (geometry,geometry); +drop operator >> (geometry,geometry); +drop operator ~= (geometry,geometry); +drop operator @ (geometry,geometry); +drop operator ~ (geometry,geometry); +drop operator = (geometry,geometry); +drop operator < (geometry,geometry); +drop operator > (geometry,geometry); +--- functions +drop function POSTGIS_VERSION (); +drop function DropGeometryColumn (varchar,varchar,varchar); +drop function AddGeometryColumn (varchar,varchar,varchar,integer,varchar,integer); +drop function BOX3D_in (opaque); +drop function BOX3D_out (opaque); +drop function SPHEROID_in (opaque); +drop function SPHEROID_out (opaque); +drop function geometry_in (opaque); +drop function geometry_out (opaque); +drop function box3d (GEOMETRY); +drop function geometry (BOX3D); +drop function expand (BOX3D,float8); +drop function asbinary (GEOMETRY); +drop function asbinary (GEOMETRY,TEXT); +drop function npoints (GEOMETRY); +drop function nrings (GEOMETRY); +drop function mem_size (GEOMETRY); +drop function numb_sub_objs (GEOMETRY); +drop function summary (GEOMETRY); +drop function translate (GEOMETRY,float8,float8,float8); +drop function dimension (GEOMETRY); +drop function geometrytype (GEOMETRY); +drop function envelope (GEOMETRY); +drop function x (GEOMETRY); +drop function y (GEOMETRY); +drop function z (GEOMETRY); +drop function numpoints (GEOMETRY); +drop function pointn (GEOMETRY,INTEGER); +drop function exteriorring (GEOMETRY); +drop function numinteriorrings (GEOMETRY); +drop function interiorringn (GEOMETRY,INTEGER); +drop function numgeometries (GEOMETRY); +drop function geometryn (GEOMETRY,INTEGER); +drop function distance (GEOMETRY,GEOMETRY); +drop function astext (geometry); +drop function srid (geometry); +drop function geometryfromtext (geometry,int4); +drop function setSRID (geometry,int4); +drop function length_spheroid (GEOMETRY,SPHEROID); +drop function length3d_spheroid (GEOMETRY,SPHEROID); +drop function length3d (GEOMETRY); +drop function length (GEOMETRY); +drop function area2d (GEOMETRY); +drop function perimeter3d (GEOMETRY); +drop function perimeter (GEOMETRY); +drop function truly_inside (GEOMETRY,GEOMETRY); +drop function point_inside_circle (GEOMETRY,float8,float8,float8); +drop function startpoint (GEOMETRY); +drop function endpoint (GEOMETRY); +drop function isclosed (GEOMETRY); +drop function centroid (GEOMETRY); +drop function combine_bbox (BOX3D,GEOMETRY); +drop function geometry_overleft (GEOMETRY, GEOMETRY); +drop function geometry_overright (GEOMETRY, GEOMETRY); +drop function geometry_left (GEOMETRY, GEOMETRY); +drop function geometry_right (GEOMETRY, GEOMETRY); +drop function geometry_contain (GEOMETRY, GEOMETRY); +drop function geometry_contained (GEOMETRY, GEOMETRY); +drop function geometry_overlap (GEOMETRY, GEOMETRY); +drop function geometry_same (GEOMETRY, GEOMETRY); +drop function geometry_lt (GEOMETRY, GEOMETRY); +drop function geometry_gt (GEOMETRY, GEOMETRY); +drop function geometry_eq (GEOMETRY, GEOMETRY); +drop function force_2d (GEOMETRY); +drop function force_3d (GEOMETRY); +drop function force_collection (GEOMETRY); +drop function ggeometry_consistent (opaque,GEOMETRY,int4); +drop function ggeometry_compress (opaque); +drop function ggeometry_penalty (opaque,opaque,opaque); +drop function ggeometry_picksplit (opaque, opaque); +drop function ggeometry_union (bytea, opaque); +drop function ggeometry_same (opaque, opaque, opaque); +drop function rtree_decompress (opaque); +drop function geometry_union (GEOMETRY,GEOMETRY); +drop function geometry_inter (GEOMETRY,GEOMETRY); +drop function geometry_size (GEOMETRY,opaque); +--- types +drop type SPHEROID ; +drop type BOX3D ; +drop type WKB ; +drop type GEOMETRY ; +end; diff --git a/undef-funcs.sql b/undef-funcs.sql deleted file mode 100644 index 48059ec67..000000000 --- a/undef-funcs.sql +++ /dev/null @@ -1,95 +0,0 @@ -begin; - -delete from pg_amproc where amopclaid = (select oid from pg_opclass where opcname = 'rt_geometry_ops'); - -delete from pg_amop where amopclaid = (select oid from pg_opclass where opcname = 'rt_geometry_ops'); - -delete from pg_opclass where opcname = 'rt_geometry_ops'; - - -delete from pg_amproc where amopclaid = (select oid from pg_opclass where opcname = 'gist_geometry_ops'); - -delete from pg_amop where amopclaid = (select oid from pg_opclass where opcname = 'gist_geometry_ops'); - -delete from pg_opclass where opcname = 'gist_geometry_ops'; - - -drop OPERATOR > (geometry,geometry); -drop OPERATOR < (geometry,geometry); -drop OPERATOR = (geometry,geometry); -drop OPERATOR ~ (geometry,geometry); -drop OPERATOR @ (geometry,geometry); -drop OPERATOR ~= (geometry,geometry); -drop OPERATOR && (geometry,geometry); -drop OPERATOR &> (geometry,geometry); -drop OPERATOR >> (geometry,geometry); -drop OPERATOR &< (geometry,geometry); - -drop OPERATOR << (geometry,geometry); -drop function geometry_size(GEOMETRY,opaque) ; -drop function geometry_inter(GEOMETRY,GEOMETRY) ; -drop function geometry_union(GEOMETRY,GEOMETRY) ; - - -drop function rtree_decompress(opaque) ; -drop function ggeometry_union(bytea, opaque) ; -drop function ggeometry_same(opaque, opaque, opaque); -drop function ggeometry_picksplit(opaque, opaque) ; -drop function ggeometry_penalty(opaque,opaque,opaque) ; -drop function ggeometry_compress(opaque) ; -drop function ggeometry_consistent(opaque,GEOMETRY,int4) ; - - -drop FUNCTION force_3d(GEOMETRY) ; -drop FUNCTION force_2d(GEOMETRY) ; -drop FUNCTION geometry_eq(GEOMETRY, GEOMETRY) ; -drop FUNCTION geometry_gt(GEOMETRY, GEOMETRY) ; -drop FUNCTION geometry_lt(GEOMETRY, GEOMETRY) ; - -drop FUNCTION geometry_same(GEOMETRY, GEOMETRY); -drop FUNCTION geometry_overlap(GEOMETRY, GEOMETRY) ; -drop FUNCTION geometry_contained(GEOMETRY, GEOMETRY) ; -drop function geometry_contain(GEOMETRY, GEOMETRY) ; -drop FUNCTION geometry_right(GEOMETRY, GEOMETRY) ; -drop FUNCTION geometry_left(GEOMETRY, GEOMETRY) ; -drop FUNCTION geometry_overright(GEOMETRY, GEOMETRY) ; -drop FUNCTION geometry_overleft(GEOMETRY, GEOMETRY) ; - - - -drop AGGREGATE extent geometry; -drop FUNCTION combine_bbox(BOX3D,GEOMETRY); -drop FUNCTION truly_inside(GEOMETRY,GEOMETRY); -drop FUNCTION perimeter2d(GEOMETRY); -drop FUNCTION perimeter3d(GEOMETRY); - - - -drop FUNCTION area2d(GEOMETRY); -drop FUNCTION length2d(GEOMETRY); -drop FUNCTION length3d(GEOMETRY); -drop FUNCTION translate(GEOMETRY,float8,float8,float8); -drop FUNCTION summary(GEOMETRY); -drop FUNCTION numb_sub_objs(GEOMETRY); - - -drop FUNCTION mem_size(GEOMETRY); -drop FUNCTION nrings(GEOMETRY); -drop FUNCTION npoints(GEOMETRY); -drop FUNCTION wkb_XDR(GEOMETRY); -drop FUNCTION wkb_NDR(GEOMETRY); -drop FUNCTION geometry(BOX3D); -drop FUNCTION box3d(GEOMETRY); - - -drop function geometry_in(opaque); -drop function geometry_out(opaque); -drop FUNCTION BOX3D_in(opaque); -drop FUNCTION BOX3D_out(opaque); - -drop TYPE BOX3D ; -drop TYPE WKB ; -drop TYPE GEOMETRY ; - - -end; \ No newline at end of file -- 2.49.0