mirror of
https://git.osgeo.org/gitea/postgis/postgis
synced 2024-10-25 17:42:38 +00:00
Added new perl function to make an undef SQL script.
git-svn-id: http://svn.osgeo.org/postgis/trunk@52 b70326c6-7e19-0410-871a-916f4a2858ee
This commit is contained in:
parent
d8bd89be60
commit
e0325c2e77
105
postgis.sql.in
105
postgis.sql.in
|
@ -1,9 +1,21 @@
|
|||
BEGIN TRANSACTION;
|
||||
|
||||
|
||||
--- you might have to define the plpgsql language something like;
|
||||
|
||||
-- CREATE FUNCTION plpgsql_call_handler () RETURNS OPAQUE AS
|
||||
-- '/usr/local/pgsql/lib/plpgsql.so' LANGUAGE 'C';
|
||||
--
|
||||
-- CREATE TRUSTED PROCEDURAL LANGUAGE 'plpgsql'
|
||||
-- HANDLER plpgsql_call_handler
|
||||
-- LANCOMPILER 'PL/pgSQL';
|
||||
|
||||
|
||||
CREATE FUNCTION POSTGIS_VERSION() returns char
|
||||
as 'select \'@POSTGIS_VERSION@\'::char as version'
|
||||
LANGUAGE 'sql';
|
||||
|
||||
|
||||
-- create the table with spatial referencing information in it. spec, section 3.2.1.2
|
||||
|
||||
create table spatial_ref_sys (
|
||||
|
@ -15,8 +27,6 @@ create table spatial_ref_sys (
|
|||
|
||||
-- create the metadata table. spec, section 3.2.2.1
|
||||
|
||||
-- currently only type =0 (GEOMETRY_GENERIC) is supported
|
||||
|
||||
create table geometry_columns (
|
||||
f_table_catalog varchar(256) not null,
|
||||
f_table_schema varchar(256) not null,
|
||||
|
@ -97,7 +107,7 @@ END;
|
|||
-- select DropGeometryColumn('new_test','test_table','mygeom');
|
||||
|
||||
|
||||
drop function AddGeometryColumn(varchar,varchar,varchar,integer,varchar,integer);
|
||||
-- drop function AddGeometryColumn(varchar,varchar,varchar,integer,varchar,integer);
|
||||
|
||||
--- AddGeometryColumn(<db name>,<table name>,<column name>, <srid>, <type>,<dim>)
|
||||
--- type can be one of GEOMETRY, GEOMETRYCOLLECTION,POINT,MULTIPOINT,POLYGON,
|
||||
|
@ -413,7 +423,7 @@ CREATE FUNCTION length3d(GEOMETRY)
|
|||
|
||||
CREATE FUNCTION length(GEOMETRY)
|
||||
RETURNS FLOAT8
|
||||
AS '@MODULE_FILENAME@'
|
||||
AS '@MODULE_FILENAME@','length2d'
|
||||
LANGUAGE 'c' with (isstrict);
|
||||
|
||||
CREATE FUNCTION area2d(GEOMETRY)
|
||||
|
@ -428,7 +438,7 @@ CREATE FUNCTION perimeter3d(GEOMETRY)
|
|||
|
||||
CREATE FUNCTION perimeter(GEOMETRY)
|
||||
RETURNS FLOAT8
|
||||
AS '@MODULE_FILENAME@'
|
||||
AS '@MODULE_FILENAME@','perimeter2d'
|
||||
LANGUAGE 'c' with (isstrict);
|
||||
|
||||
CREATE FUNCTION truly_inside(GEOMETRY,GEOMETRY)
|
||||
|
@ -749,89 +759,4 @@ INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
|
|||
WHERE amname = 'gist' and opcname = 'gist_geometry_ops'
|
||||
and proname = 'ggeometry_same';
|
||||
|
||||
|
||||
|
||||
|
||||
---- RTREE indexing support
|
||||
|
||||
INSERT INTO pg_opclass (opcname, opcdeftype)
|
||||
SELECT 'rt_geometry_ops', oid
|
||||
FROM pg_type
|
||||
WHERE typname = 'geometry';
|
||||
|
||||
SELECT o.oid AS opoid, o.oprname
|
||||
INTO TABLE rt_ops_tmp
|
||||
FROM pg_operator o, pg_type t
|
||||
WHERE o.oprleft = t.oid
|
||||
and t.typname = 'geometry';
|
||||
|
||||
|
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
|
||||
SELECT am.oid, opcl.oid, c.opoid, 1
|
||||
FROM pg_am am, pg_opclass opcl, rt_ops_tmp c
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and c.oprname = '<<';
|
||||
|
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
|
||||
SELECT am.oid, opcl.oid, c.opoid, 2
|
||||
FROM pg_am am, pg_opclass opcl, rt_ops_tmp c
|
||||
WHERE amname = 'rtree' and opcname ='rt_geometry_ops'
|
||||
and c.oprname = '&<';
|
||||
|
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
|
||||
SELECT am.oid, opcl.oid, c.opoid, 3
|
||||
FROM pg_am am, pg_opclass opcl, rt_ops_tmp c
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and c.oprname = '&&';
|
||||
|
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
|
||||
SELECT am.oid, opcl.oid, c.opoid, 4
|
||||
FROM pg_am am, pg_opclass opcl, rt_ops_tmp c
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and c.oprname = '&>';
|
||||
|
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
|
||||
SELECT am.oid, opcl.oid, c.opoid, 5
|
||||
FROM pg_am am, pg_opclass opcl, rt_ops_tmp c
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and c.oprname = '>>';
|
||||
|
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
|
||||
SELECT am.oid, opcl.oid, c.opoid, 6
|
||||
FROM pg_am am, pg_opclass opcl, rt_ops_tmp c
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and c.oprname = '~=';
|
||||
|
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
|
||||
SELECT am.oid, opcl.oid, c.opoid, 7
|
||||
FROM pg_am am, pg_opclass opcl, rt_ops_tmp c
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and c.oprname = '~';
|
||||
|
||||
INSERT INTO pg_amop (amopid, amopclaid, amopopr, amopstrategy)
|
||||
SELECT am.oid, opcl.oid, c.opoid, 8
|
||||
FROM pg_am am, pg_opclass opcl, rt_ops_tmp c
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and c.oprname = '@';
|
||||
|
||||
DROP table rt_ops_tmp;
|
||||
|
||||
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
|
||||
SELECT am.oid, opcl.oid, pro.oid, 1
|
||||
FROM pg_am am, pg_opclass opcl, pg_proc pro
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and proname = 'geometry_union';
|
||||
|
||||
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
|
||||
SELECT am.oid, opcl.oid, pro.oid, 2
|
||||
FROM pg_am am, pg_opclass opcl, pg_proc pro
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and proname = 'geometry_inter';
|
||||
|
||||
INSERT INTO pg_amproc (amid, amopclaid, amproc, amprocnum)
|
||||
SELECT am.oid, opcl.oid, pro.oid, 3
|
||||
FROM pg_am am, pg_opclass opcl, pg_proc pro
|
||||
WHERE amname = 'rtree' and opcname = 'rt_geometry_ops'
|
||||
and proname = 'geometry_size';
|
||||
|
||||
end TRANSACTION;
|
||||
|
|
Loading…
Reference in a new issue