I have used oracle_fdw to create a foreign data wrapper in my PostgreSQL database to connect to my Oracle database and retrieve foreign tables from the Oracle database into my Postgres database. This includes the geometry of the Oracle table.

When I save the foreign table as a "local" table and add a primary key and spatial index, I can add the local table to the map in QGIS, so I know that the geometry has been retrieved correctly.

However, when I try to put the foreign table directly into QGIS, I get "invalid layer and cannot be loaded". I'm sure that this is because I can't add a spatial index or primary key to the foreign table.

Is there any way to show this foreign table in QGIS without the spatial index and primary key?

1 Answer 1


Try making an editable view for this foreign table, if you need to see up-to-date data, and add this view to QGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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