Opened 8 years ago

Closed 8 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 Changed 8 years ago by strk

Owner: changed from pramsey to strk
Status: newassigned

comment:2 Changed 8 years ago by strk

NOTE: using constraints is not a problem

comment:3 Changed 8 years ago by strk

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 Changed 8 years ago by strk

Owner: strk deleted
Status: assignednew

comment:5 Changed 8 years ago by strk

A close friend of the trigger one:

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

comment:6 Changed 8 years ago by strk

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 Changed 8 years ago by robe

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 Changed 8 years ago by pramsey

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