Opened 12 years ago

Last modified 12 years ago

#1320 closed defect

typmod geometry type not changing in before trigger — at Initial Version

Reported by: robe Owned by: jomarlla@…
Priority: critical Milestone: PostGIS 2.0.0
Component: postgis Version: master
Keywords: Cc:

Description

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.

Change History (0)

Note: See TracTickets for help on using tickets.