Subject: Incorporating new access methods / polygons

From: [email-masked]
Date: Thu, 15 Dec 1994 14:00:58 -0500

Hello

I am working on adding additional spatial access method on Postgres and
have been trying to understand various source (like the source code and
pg.am -- thank for Paul Brown for that tip). 

Two questions:

(A) Suppose I have a new access method code written. Assume say, I just
    copy the R-tree code and renaming it R2-tree, residing in the
    directory ......./backend/access/index-r2tree. What else do I have
    to do to?

    This is what I think should happen, can anyone point out any mistake?

    (1) Create a Makefile.inc with the following statements:

    .PATH: ${.CURDIR}/access/index-r2tree
    SRCS+= r2tget.c r2tproc.c r2tree.c r2tscan.c r2tstrat.c

    (2) Go to ..../backend/catalog/

    (3) Edit pg_am by adding a DATA statement to insert the access method
        to pg_am  

        DATA(insert OID = 1500 ( r2tree PGUID "o" ...........));
      
        [A unique OID (from ALL other OIDS in other pg files) will be enough, 
         right? Or do the range of OID matters (like I should use 1-10 for 
         some function etc.)?]

    (4) Edit pg_proc by adding a DATA statement to insert each interface
        procedure to pg_proc 

        DATA(insert OID = 1600 ( r2tinsert PGUID "o" ...........));
  
        [We only need to do this for the interface functions, like those
         needed in pg_am, right?]

    (5) Edit pg_amop.h, pg_amproc.h similarly to insert the tuples.

    (6) Edit  ...../backend/utils/builtin.h to include all the function
        headers:
         extern char* r2tinsert(); etc.

    (7) If there is new selectivity functions, incoporate them
        into .../backend/utils/adt/selfuncs.c

    (8) Remake the whole thing (using bmake).

    Anything I missed? Messed up? Any guidelines?

(B) Polygons. The polygon functions seems to be just manipulating 
    bounding boxes. Is it right? Is there a package to allow really
    working with (multiside) polygons?

Hope it's not too long. Thanks a lot in advance.

David Lin

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "[email-masked]".
   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================
              URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/