Bug report #13823

DB Manager - Renaming constraints and indexes fails when renaming a table

Added by Paul Kanelli over 8 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:DB Manager
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:21848

Description

When creating a table named 'lakes' in the DB Manager a constraint 'lakes_pkey' and the index 'sidx_lakes_geom' is created. But when renaming the table the constraint and the index don't get new names. So it's not possible to create a table named 'lakes' after renaming the original 'lakes' table.

Error: Relation „sidx_lakes_geom“ already exists


Related issues

Related to QGIS Application - Bug report #6798: when copying a table by d&d from one schema to another th... Closed 2012-11-30

History

#1 Updated by Paul Kanelli over 8 years ago

  • Target version set to Version 2.14

#2 Updated by Paul Kanelli about 8 years ago

Also renaming the sequence of a serial column fails:

CREATE TABLE lakes
(
gid SERIAL NOT NULL,
geom geometry(polygon, SRID),
CONSTRAINT lakes_pkey PRIMARY KEY (gid)
);

Default value for column 'gid' is 'nextval('lakes_gid_seq'::regclass)'. It's not renamed after renaming table 'lakes'.

#4 Updated by Sebastian Dietrich about 8 years ago

The workaround is to delete the constraints and recreate them. They are recreated with the correct name according to DB-Manager's naming scheme.

Note the linked ticket #14104 regarding the sequence issue.

#5 Updated by Sebastian Dietrich about 8 years ago

  • OS version deleted (7)
  • Affected QGIS version changed from 2.12.0 to master
  • Operating System deleted (Windows)

#6 Updated by Giovanni Manghi almost 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Jürgen Fischer over 6 years ago

  • Description updated (diff)

#8 Updated by Giovanni Manghi about 5 years ago

  • Status changed from Open to Closed
  • Resolution set to end of life

Also available in: Atom PDF