Bug report #12956

DB Manager: copying a table from a PostGIS schema into another fails

Added by Paul Kanelli over 9 years ago. Updated almost 9 years ago.

Status:Closed
Priority:Normal
Assignee:Giuseppe Sucameli
Category:DB Manager
Affected QGIS version:2.8.2 Regression?:No
Operating System:Ubuntu Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:21035

Description

Using the "DB Manager" to copy a table from a PostGIS schema into another by drag and drop QGIS says "Error 5
Creation of fields failed". The table is created but without any records. Moreover the sequences of serial columns get lost.

postgis_table_import_1.jpg (142 KB) Paul Kanelli, 2015-06-14 02:14 AM

postgis_table_import_2.jpg (127 KB) Paul Kanelli, 2015-06-14 02:14 AM

History

#1 Updated by Giovanni Manghi over 9 years ago

  • Status changed from Open to Feedback
  • Priority changed from High to Normal
  • Target version deleted (Version 2.10)

I cannot confirm on qgis master on Ubuntu 14.04 and on qgis 2.8.2/master on Windows.

#2 Updated by Paul Kanelli over 9 years ago

I've created a table "test_geometry" using the DB manager. When trying to copy it from "testschema_1" to "testschema_2" by drag and drop QGIS says "Error 5".

#3 Updated by Giovanni Manghi over 9 years ago

Paul Kanelli wrote:

I've created a table "test_geometry" using the DB manager. When trying to copy it from "testschema_1" to "testschema_2" by drag and drop QGIS says "Error 5".

I understand, but I cannot confirm it. Are you sure you have the proper permissions in the db/schema?

#4 Updated by Paul Kanelli over 9 years ago

"postgres" is the owner of the database, both schemata and the table. In my QGIS project I'm connected via "postgres" to PostgreSQL/PostGIS. On some tables copying works properly but even in that case the sequence of serial columns is missing after importing. Seems this are two different issues.

#5 Updated by Paul Kanelli over 9 years ago

"Table/Move to schema" is working fine, even the sequences of the serial columns are moved.

#6 Updated by Giuseppe Sucameli about 9 years ago

  • Assignee set to Giuseppe Sucameli

Hi Paul, could you test it again with the latest trunk?

#7 Updated by Paul Kanelli about 9 years ago

I never had "Error 5" again. Meanwhile I've installed QGIS 2.10.1 (Ubuntu 14.04) and the sequence is still missing after copying a table by drag and drop. Unfortunatelly I got troubles installing the nightly build of upcoming point release. So I can't do further tests at the moment.

#8 Updated by Paul Kanelli almost 9 years ago

In QGIS 2.12 the sequences of serial columns don't get lost when copying a table from a schema into another by drag and drop (DB Manager). Unfortunately the copies of sequences don't consider existing rows. So it's impossible to add new features in the table copy.

ERROR: duplicate key value violates unique constraint "test_geometry_pkey"
DETAIL: Key (gid)=(1) already exists.

#9 Updated by Giovanni Manghi almost 9 years ago

  • Resolution set to fixed/implemented
  • Status changed from Feedback to Closed

Paul Kanelli wrote:

In QGIS 2.12 the sequences of serial columns don't get lost when copying a table from a schema into another by drag and drop (DB Manager). Unfortunately the copies of sequences don't consider existing rows. So it's impossible to add new features in the table copy.

ERROR: duplicate key value violates unique constraint "test_geometry_pkey"
DETAIL: Key (gid)=(1) already exists.

confirmed but a separate issue, please file another ticket for this.

Also available in: Atom PDF