Bug report #12872

copy/paste features to same Oracle layer does not work

Added by magnus hoeirup almost 9 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Data Provider/Oracle
Affected QGIS version:2.8.2 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:20963

Description

When copying a feature to the same layer the geometry is copied, but not the attribute which is all assigned NULL.

I tried using the copy feature and paste feature icons as well as Ctrl+C and Ctrl+V.

I guess this is an error?

History

#1 Updated by Giovanni Manghi almost 9 years ago

  • Category set to Digitising
  • Status changed from Open to Feedback

I cannot confirm, please attach sample data.

#2 Updated by magnus hoeirup almost 9 years ago

Giovanni Manghi wrote:

I cannot confirm, please attach sample data.

The data is loaded from a Oracle Spatial server.

When I add a new feature to the layer, it can be saved, but if a feature is copied I get this error when I try to save the changes:

Could not commit changes to layer F_KIRKEGD_GRAVSTEDER
Errors: ERROR: 1 feature(s) not added.
Provider errors:
Oracle error while adding features: Oracle error: Could not insert feature -22
SQL: ORA-01400: kan ikke indsætte NULL i ("CPN"."F_KIRKEGD_GRAVSTEDER"."MI_PRINX")
Unable to execute statement
Error: INSERT INTO "CPN"."F_KIRKEGD_GRAVSTEDER"("SDO_GEOMETRY","MI_PRINX") VALUES (:f,:fb)

"kan ikke indsætte" means: cannot insert/assign

#3 Updated by Giovanni Manghi almost 9 years ago

  • Status changed from Feedback to Open
  • OS version changed from Service Pack 1 to 7
  • Operating System changed from Windows 7 64bit to Windows
  • Category changed from Digitising to Data Provider/Oracle
  • Subject changed from copy feature to same layer does not copy attributes to copy/paste features to same Oracle layer does not work

The data is loaded from a Oracle Spatial server.

this is an important detail :)

#4 Updated by Jürgen Fischer almost 9 years ago

  • Status changed from Open to Feedback

magnus hoeirup wrote:

Could not commit changes to layer F_KIRKEGD_GRAVSTEDER
Errors: ERROR: 1 feature(s) not added.
Provider errors:
Oracle error while adding features: Oracle error: Could not insert feature -22
SQL: ORA-01400: kan ikke indsætte NULL i ("CPN"."F_KIRKEGD_GRAVSTEDER"."MI_PRINX")
Unable to execute statement
Error: INSERT INTO "CPN"."F_KIRKEGD_GRAVSTEDER"("SDO_GEOMETRY","MI_PRINX") VALUES (:f,:fb)

"kan ikke indsætte" means: cannot insert/assign

I guess "MI_PRINX" is your primary key. The primary keys are skipped (or set to the default value) on paste, because there would be duplicate key otherwise. You need to assign a new value to the keyfield before committing.

#5 Updated by magnus hoeirup almost 9 years ago

Jürgen Fischer wrote:

magnus hoeirup wrote:

...

I guess "MI_PRINX" is your primary key. The primary keys are skipped (or set to the default value) on paste, because there would be duplicate key otherwise. You need to assign a new value to the keyfield before committing.

MI_PRINX is used by MapInfo as a primary key, and GeoMedia has the option to use it as a primary key. But is it a feature that exists in QGIS? Or do I have to manually guess the next step in the primary key sequence?
Still all the other attributes are NULL as well, when I copy/paste a polygon.

#6 Updated by Jürgen Fischer almost 9 years ago

magnus hoeirup wrote:

MI_PRINX is used by MapInfo as a primary key, and GeoMedia has the option to use it as a primary key. But is it a feature that exists in QGIS? Or do I have to manually guess the next step in the primary key sequence?

Depends on how it's implemented. If it uses a trigger to set the primary on INSERT it would work. Also it you set it by default value. Otherwise you indeed have to figure out a free id and assign it manually.

Still all the other attributes are NULL as well, when I copy/paste a polygon.

Ok. What other attributes are there? So far only "SDO_GEOMETRY" and "MI_PRINX" were mentioned.

#7 Updated by magnus hoeirup over 8 years ago

  • Status changed from Feedback to Closed

I am no longer part of the project, so i can't provide additional information.

Also available in: Atom PDF