Bug report #13823

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

Added by Paul Kanelli almost 4 years ago. Updated 8 months 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 3 years ago

  • Target version set to Version 2.14

#2 Updated by Paul Kanelli over 3 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 over 3 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 over 3 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 over 2 years ago

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

#7 Updated by Jürgen Fischer about 2 years ago

  • Description updated (diff)

#8 Updated by Giovanni Manghi 8 months ago

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

Also available in: Atom PDF