I have an Oracle spatial layer that is built on top of a multi table view. When I make a new feature in QGIS, I get an error when I attempt to the save the edit. When I look in the database and refresh the QGIS view, the new features are present, so the error is being thrown even though the operation is successful. The errors says could not retrieve feature id -2 and has a sql statement where it looks like QGIS is quering by rowid. I was wondering if anyone elese has seen something similar to this or if it is possible to have qgis not use Oracle rowid as a check.

  • Welcome to gis.stackexchange! Please edit the title of your question to include enough information for future visitors to be able to find this thread when looking for the same problem.
    – underdark
    Apr 6, 2016 at 17:04

1 Answer 1


Can you show the SQL definition of the view?

Generally only simple views are updatable in Oracle (and other RDBMSs): views that select columns and rows in a single table. Anything else: aggregates, joins, subqueries ... are not.

You can make them updatable by adding an INSTEAD OF trigger to the view where you write the logic to apply to properly update the underlying tables.

The other issue is with ROWIDs. Those are physical pointers to table rows. A join view does not have any. So yes, you need to tell QGIS to find another way to identify rows in the view. However that is only possible if the view is "key-preserved" i.e if each row has a unique key that exists in both tables, i.e the join is a simple inner join.

  • Thanks for the information. I have instead of triggers on top of the views to make them editable. I have a primary key on the view but it seems like QGIS is not recognizing it eventhough I specify a primary key. Apr 14, 2016 at 19:50
  • Hmmm I have had that sort of issues with Mapinfo in the past. QGIS is fairly simple-minded. It thinks you are giving it a table and looks for a primary key or unique index that it can use internally. And that must be a single-column numeric. But obviously finds none. Mapinfo had a workaround: just name one column MI_PRINX. Maybe QGIS has something similar. Apr 15, 2016 at 22:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.