]> granicus.if.org Git - postgis/commitdiff
Early support for 7.3. No fixes for typecasting problems yet.
authorPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 5 Dec 2002 20:30:22 +0000 (20:30 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Thu, 5 Dec 2002 20:30:22 +0000 (20:30 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@217 b70326c6-7e19-0410-871a-916f4a2858ee

Makefile
postgis_gist_73.sql.in

index 7a0de5224ded6eba3cbaa87811d8ded3ccb23764..00a871fc25802faf73743369f7593775f76f53ab 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ subdir=contrib/postgis
 ifeq (${PGSQL_SRC},) 
        top_builddir = ../..
        include $(top_builddir)/src/Makefile.global
-       libdir := $(libdir)/contrib
+       libdir := $$libdir
 else
        top_builddir = ${PGSQL_SRC}
        include $(top_builddir)/src/Makefile.global
@@ -83,7 +83,7 @@ else
        GIST_SUPPORT=72
 endif
 
-OBJS=postgis_debug.o postgis_ops.o postgis_fn.o postgis_inout.o postgis_proj.o postgis_chip.o postgis_transform.o postgis_gist_$(GIST_SUPPORT).o
+OBJS=postgis_debug.o postgis_ops.o postgis_fn.o postgis_inout.o postgis_proj.o postgis_chip.o postgis_transform.o postgis_gist_$(GIST_SUPPORT).o postgis_estimate.o
 
 # Add libraries that libpq depends (or might depend) on into the
 # shared library link.  (The order in which you list them here doesn't
index 9bb96be1a3fdcba0ea904ceab058c9a87a046b0d..d536a28d9e36330fa0f11a4989521a08ad6876ff 100644 (file)
@@ -70,25 +70,25 @@ create function postgisgistcostestimate(opaque,opaque,opaque,opaque,opaque,opaqu
             LANGUAGE 'c'  with (isstrict);
 
 -------- 7.2 GiST support functions
-create function ggeometry_consistent(opaque,GEOMETRY,int4) returns bool 
+create function ggeometry_consistent(internal,GEOMETRY,int4) returns bool 
 as '@MODULE_FILENAME@'   language 'C';
 
-create function ggeometry_compress(opaque) returns opaque 
+create function ggeometry_compress(internal) returns internal 
 as '@MODULE_FILENAME@'  language 'C';
 
-create function gbox_penalty(opaque,opaque,opaque) returns opaque 
+create function gbox_penalty(internal,internal,internal) returns internal 
 as '@MODULE_FILENAME@'   language 'C';
 
-create function gbox_picksplit(opaque, opaque) returns opaque 
+create function gbox_picksplit(internal, internal) returns internal 
 as '@MODULE_FILENAME@'   language 'C';
 
-create function gbox_union(bytea, opaque) returns opaque 
+create function gbox_union(bytea, internal) returns internal 
 as '@MODULE_FILENAME@'   language 'C';
 
-create function gbox_same(box, box, opaque) returns opaque 
+create function gbox_same(box, box, internal) returns internal 
 as '@MODULE_FILENAME@'   language 'C';
 
-create function rtree_decompress(opaque) returns opaque
+create function rtree_decompress(internal) returns internal
 as '@MODULE_FILENAME@'   language 'C';
 --------------------------
 create function postgis_gist_sel (internal, oid, internal, int4)  returns float8 
@@ -141,15 +141,12 @@ CREATE OPERATOR ~= (
    RESTRICT = eqsel, JOIN = eqjoinsel
 );
 
-
-
 CREATE OPERATOR @ (
    LEFTARG = GEOMETRY, RIGHTARG = GEOMETRY, PROCEDURE = geometry_contained,
    COMMUTATOR = '@',
    RESTRICT = contsel, JOIN = contjoinsel
 );
 
-
 CREATE OPERATOR ~ (
    LEFTARG = GEOMETRY, RIGHTARG = GEOMETRY, PROCEDURE = geometry_contain,
    COMMUTATOR = '@',
@@ -174,157 +171,24 @@ CREATE OPERATOR > (
    RESTRICT = contsel, JOIN = contjoinsel
 );
 
-
-
-
---- old way = insert into pg_opclass values ('gist_geometry_ops');
-
-INSERT INTO pg_opclass (opcamid, opcname, opcintype, opcdefault, opckeytype)
-    VALUES (
-        (SELECT oid FROM pg_am WHERE amname = 'gist'),
-        'gist_geometry_ops',
-        (SELECT oid FROM pg_type WHERE typname = 'geometry'),
-        true,
-        (SELECT oid FROM pg_type WHERE typname = 'box'));
-
---- drop table rt_ops_tmp;
-
-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';
-
--- poly_left
-INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr) 
-   SELECT opcl.oid, 1, true, c.opoid
-   FROM pg_opclass opcl, rt_ops_tmp c
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops' 
-      and c.oprname = '<<';
-
--- poly_overleft
-INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr) 
-   SELECT opcl.oid, 2, true, c.opoid
-   FROM pg_opclass opcl, rt_ops_tmp c
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops' 
-      and c.oprname = '&<';
-
--- poly_overlap
-INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr) 
-   SELECT opcl.oid, 3, true, c.opoid
-   FROM pg_opclass opcl, rt_ops_tmp c
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops' 
-      and c.oprname = '&&';
-
--- poly_overright
-INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr) 
-   SELECT opcl.oid, 4, true, c.opoid
-   FROM pg_opclass opcl, rt_ops_tmp c
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops' 
-      and c.oprname = '&>';
-
--- poly_right
-INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
-   SELECT opcl.oid, 5, true, c.opoid
-   FROM pg_opclass opcl, rt_ops_tmp c
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops' 
-      and c.oprname = '>>';
-
--- poly_same
-INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr) 
-   SELECT opcl.oid, 6, true, c.opoid
-   FROM pg_opclass opcl, rt_ops_tmp c
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops' 
-      and c.oprname = '~=';
-
--- poly_contains
-INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
-   SELECT opcl.oid, 7, true, c.opoid
-   FROM pg_opclass opcl, rt_ops_tmp c
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops' 
-      and c.oprname = '~';
-
--- poly_contained
-INSERT INTO pg_amop (amopclaid, amopstrategy, amopreqcheck, amopopr)
-   SELECT opcl.oid, 8, true, c.opoid
-   FROM pg_opclass opcl, rt_ops_tmp c
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops' 
-      and c.oprname = '@';
-
-DROP table rt_ops_tmp;
-
--- add the entries to amproc for the support methods
--- note the amprocnum numbers associated with each are specific!
-INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
-   SELECT opcl.oid, 1, pro.oid
-   FROM pg_opclass opcl, pg_proc pro
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops'
-      and proname = 'ggeometry_consistent';
-
-INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
-   SELECT opcl.oid, 2, pro.oid
-   FROM pg_opclass opcl, pg_proc pro
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops'
-      and proname = 'gbox_union';
-
-INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
-   SELECT opcl.oid, 3, pro.oid
-   FROM pg_opclass opcl, pg_proc pro
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops'
-      and proname = 'ggeometry_compress';
-
-INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
-   SELECT opcl.oid, 4, pro.oid
-   FROM pg_opclass opcl, pg_proc pro
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops'
-      and proname = 'rtree_decompress';
-
-INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
-   SELECT opcl.oid, 5, pro.oid
-   FROM pg_opclass opcl, pg_proc pro
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops'
-      and proname = 'gbox_penalty';
-
-INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
-   SELECT opcl.oid, 6, pro.oid
-   FROM pg_opclass opcl, pg_proc pro
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops'
-      and proname = 'gbox_picksplit';
-
-INSERT INTO pg_amproc (amopclaid, amprocnum, amproc)
-   SELECT opcl.oid, 7, pro.oid
-   FROM pg_opclass opcl, pg_proc pro
-   WHERE
-      opcamid = (SELECT oid FROM pg_am WHERE amname = 'gist')
-      and opcname = 'gist_geometry_ops'
-      and proname = 'gbox_same';
+---------Create opclass
+
+CREATE OPERATOR CLASS gist_geometry_ops
+       DEFAULT FOR TYPE geometry USING gist AS
+               OPERATOR        1       << ,
+               OPERATOR        2       &< ,
+               OPERATOR        3       && ,
+               OPERATOR        4       &> ,
+               OPERATOR        5       >> ,
+               OPERATOR        6       = ,
+               OPERATOR        7       @ ,
+               OPERATOR        8       ~ ,
+               FUNCTION        1       ggeometry_consistent (internal, geometry, int4),
+               FUNCTION        2       gbox_union (bytea, internal),
+               FUNCTION        3       ggeometry_compress (internal),
+               FUNCTION        4       rtree_decompress (internal),
+               FUNCTION        5       gbox_penalty (internal, internal, internal),
+               FUNCTION        6       gbox_picksplit (internal, internal),
+               FUNCTION        7       gbox_same (box, box, internal);
 
 END TRANSACTION;