[postgis-devel] [PostGIS] #944: typmod support for PostGIS geometry

PostGIS trac at osgeo.org
Thu Jun 23 04:14:06 PDT 2011


#944: typmod support for PostGIS geometry
-------------------------+--------------------------------------------------
 Reporter:  robe         |       Owner:  pramsey      
     Type:  enhancement  |      Status:  new          
 Priority:  medium       |   Milestone:  PostGIS 2.0.0
Component:  postgis      |     Version:  trunk        
 Keywords:               |  
-------------------------+--------------------------------------------------

Comment(by robe):

 Okay I committed the change I discussed abovee at r7450

 There is one issue that is bugging me.  That is our new types do not
 display in a backwards compatible way.  As far as speed goes, I have to
 test more, but in a database of 30 geometry columns most of which wer
 defined using contraints, the speed to output geometry_columns_v was under
 23ms.  I'll do a more straineous test of generating thousands of tables.

 Getting back to what concerns me -- here is my basic test:


 {{{
 CREATE TABLE test_geom_typmod(gid serial primary key, geom
 geometry(POINTZ,26986));
 CREATE TABLE test_geom_constraint(gid serial primary key);
 SELECT AddGeometryColumn
 ('public','test_geom_constraint','geom',26986,'POINT',3);

 SELECT AddGeometryColumn
 ('public','test_geom_constraint','geomm',26986,'POINTM',3);
 ALTER TABLE test_geom_typmod ADD COLUMN geomm geometry(POINTM,26986);

 CREATE OR REPLACE VIEW vw_test_geom_typmod AS SELECT * FROM
 test_geom_typmod;
 CREATE OR REPLACE VIEW vw_test_geom_constraint AS SELECT * FROM
 test_geom_constraint;
 CREATE OR REPLACE VIEW vw_test_geom_constraint_cast AS
   SELECT gid, geom::geometry(POINTZ,26986) As geom,
       geomm::geometry(POINTM,26986) As geomm
   FROM test_geom_constraint;
 }}}

 Of which the results of my query:

 {{{
 SELECT f_table_schema, f_table_name, f_geometry_column, coord_dimension,
 srid, type
 FROM geometry_columns_v WHERE f_table_schema = 'public';

 }}}

 yield:


 {{{
          f_table_name         | f_geometry_column | coord_dimension | srid
 |   type
 ------------------------------+-------------------+-----------------+-------+----------
  raster_columns               | extent            |               2 |
 0 | Geometry
  test_geom_constraint         | geom              |               3 |
 26986 | POINT
  test_geom_constraint         | geomm             |               3 |
 26986 | POINTM
  test_geom_typmod             | geom              |               3 |
 26986 | PointZ
  test_geom_typmod             | geomm             |               3 |
 26986 | PointM
  vw_test_geom_typmod          | geom              |               3 |
 26986 | PointZ
  vw_test_geom_typmod          | geomm             |               3 |
 26986 | PointM
  vw_test_geom_constraint      | geom              |               2 |
 0 | Geometry
  vw_test_geom_constraint      | geomm             |               2 |
 0 | Geometry
  vw_test_geom_constraint_cast | geom              |               3 |
 26986 | PointZ
  vw_test_geom_constraint_cast | geomm             |               3 |
 26986 | PointM
 }}}

 I fear this change in casing will break applications.  I can almost
 forgive the difference between PointZ and POINT since most tools we work
 with are currently 2D anyway.

 The other change I made is I cast all the columns so the are the same type
 and size as teh original geometry_columns.  Before they were outputting
 objects of type "name" which I can just see a bunch of things coughing up
 on.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/944#comment:31>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list