Opened 12 years ago

Closed 12 years ago

#2049 closed defect (wontfix)

populate_geometry_columns: ERROR: cannot alter type of a column used in a trigger definition

Reported by: strk Owned by:
Priority: medium Milestone: PostGIS 2.0.4
Component: postgis Version: 2.0.x
Keywords: Cc:

Description

This is the situation: I've a table with a column of type "geometry" which is used in a trigger. There is no constraint on the type of the geometry, but all rows are of type POINT and srid 4326.

I think in normal situation populate_geometry_column() would alter the table to become of type "geometry(point, 4326)" but in this case it would fail with this message:

ERROR:  cannot alter type of a column used in a trigger definition

I think it should be fixed in 2.0 by disabling the trigger during the ALTER as we know we're not really altering the value of the geometry but only it's _advertised_ type, right ?

Change History (8)

comment:1 by strk, 12 years ago

Owner: changed from pramsey to strk
Status: newassigned

comment:2 by strk, 12 years ago

NOTE: using constraints is not a problem

comment:3 by strk, 12 years ago

The only thing we could do is:

  1. Fetch trigger definition
  2. DROP the trigger
  3. Run the ALTER TABLE
  4. CREATE the trigger

comment:4 by strk, 12 years ago

Owner: strk removed
Status: assignednew

comment:5 by strk, 12 years ago

A close friend of the trigger one:

ERROR:  cannot alter type of a column used by a view or rule

comment:6 by strk, 12 years ago

I think it would be good to only skip the problematic tables rather than throw away the whole transaction, and the code seems to partially do that, but only when the exception thrown is "invalid_parameter_value"

comment:7 by robe, 12 years ago

Milestone: PostGIS 2.0.2PostGIS 2.0.3

We aren't goind to be fiddling with views or triggers. And I'm not going to changing this function in a week to raise a warning.

comment:8 by pramsey, 12 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.