Opened 2 years ago

Closed 2 years ago

#3196 closed patch (fixed)

DropTopology can drop the topology extension

Reported by: Mike Toews Owned by: strk
Priority: high Milestone: PostGIS 2.0.8
Component: topology Version: trunk
Keywords: Cc:

Description

On a test database, try the following:

CREATE EXTENSION postgis_topology;
SELECT topology.DropTopology('this does not exist');
-- Topology 'this does not exist' dropped
SELECT topology.DropTopology('topology');
-- Topology 'topology' dropped

The first DropTopology on a non-existing topology shows a misleading message. Either the return value should indicate that the topology does not exist or an exception should be raised.

The second DropTopology kills the topology extension with DROP SCHEMA '||quote_ident(atopology)||' CASCADE, which should have been avoided as topology does not have a topoid. This can be disastrous.

Attachments (3)

droptopology.diff (1.8 KB) - added by Mike Toews 2 years ago.
patch for trunk
handle_invalid_toponame.2.diff (3.1 KB) - added by Mike Toews 2 years ago.
correction
handle_invalid_toponame.diff (3.1 KB) - added by Mike Toews 2 years ago.
correction

Download all attachments as: .zip

Change History (9)

comment:1 Changed 2 years ago by Mike Toews

Generally speaking DropTopology can also drop other unrelated schemas.

CREATE SCHEMA somethingelse;
SELECT topology.DropTopology('somethingelse');
-- Topology 'somethingelse' dropped

Changed 2 years ago by Mike Toews

Attachment: droptopology.diff added

patch for trunk

comment:2 Changed 2 years ago by Mike Toews

Type: defectpatch

A patch on trunk is ready for review. There are only minor changes, but the indent level change adds a bit of noise to the patch. This should be applied (and modified where needed) to 2.0 and 2.1 too.

comment:3 Changed 2 years ago by Mike Toews

I've added another patch that fixes a few other instances where invalid topography names are attempted. The handle_invalid_toponame.diff​ patch changes these functions:

  • topology.DropTopology
  • topology.GetTopologyId
  • topology.AddTopoGeometryColumn

Changed 2 years ago by Mike Toews

correction

Changed 2 years ago by Mike Toews

correction

comment:5 Changed 2 years ago by strk

Status: newassigned

comment:6 Changed 2 years ago by strk

Milestone: PostGIS 2.2.0PostGIS 2.0.8
Resolution: fixed
Status: assignedclosed

r13818 in trunk (2.2.0), r13819 in 2.1 branch (2.1.9), r13820 in 2.0 branch (2.0.8) -- Thanks !

Note: See TracTickets for help on using tickets.