[postgis-devel] [PostGIS] #1320: typmod geometry type not changing in before trigger

PostGIS trac at osgeo.org
Tue Nov 22 13:23:49 PST 2011


#1320: typmod geometry type not changing in before trigger
----------------------+-----------------------------------------------------
 Reporter:  robe      |       Owner:  jomarlla@…         
     Type:  defect    |      Status:  new                
 Priority:  critical  |   Milestone:  PostGIS 2.0.0      
Component:  postgis   |     Version:  trunk              
 Keywords:            |  
----------------------+-----------------------------------------------------
 This is the report posted on:
 http://www.postgis.org/pipermail/postgis-users/2011-November/031493.html

 I can reproduce on 8.4 and 9.1 running latest build of PostGIS 2.0.

 To reproduce:

 {{{
 CREATE TABLE A(gid serial primary key, geom geometry(MultiPolygon,
 23030));

 CREATE OR REPLACE FUNCTION public.triga() RETURNS trigger AS
 $$
 BEGIN
 NEW.geom = ST_GeometryN(New.geom,1);
 RETURN NEW;
 END;
 $$ language plpgsql
 VOLATILE;


 CREATE TRIGGER triga_before
   BEFORE INSERT
   ON public.a
   FOR EACH ROW
   EXECUTE PROCEDURE public.triga();

 -- this allows  a polygon which should not be legal --
 INSERT INTO a(geom) VALUES('SRID=23030;MULTIPOLYGON (((0 0, 10 0, 10 10, 0
 0)))'::geometry);

 -- st_AsText POLYGON((0 0,10 0,10 10,0 0))
 }}}

 Seem to have same issue with geography.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1320>
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