Ticket #1320 (closed defect: fixed)
typmod geometry type not changing in before trigger
| Reported by: | robe | Owned by: | strk |
|---|---|---|---|
| Priority: | critical | Milestone: | PostGIS 2.0.0 |
| Component: | postgis | Version: | trunk |
| Keywords: | Cc: |
Description (last modified by robe) (diff)
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))
Geography works as expected -see next 2 notes.
Change History
Note: See
TracTickets for help on using
tickets.
