In PostGIS, it is possible to use addgeometrycolumn more than once on the same table.

Example: I have one table "scenes" with many attributes, and 2 geometry columns: the_geom1 and the_geom2.

select addgeometrycolumn('scenes', 'the_geom1', 0, 'POLYGON', 2);
select addgeometrycolumn('scenes', 'the_geom2', 0, 'POLYGON', 2);

In QGIS, when I display "scenes", it only displays the_geom1.

To display the features using the second geometry, I found a solution with :

create view v2 as select id,the_geom2 from scenes;

But I'd like to access all other fields; something like:

create view v2 as select * (except the_geom1),the_geom2 from scenes;

Any ideas?


Qgis see your table two times, one with the_geom1 and one with the_geom2. When you upload the_geom1, you will see the_geom2 like a text.


If a table has two geometry columns, it is listed twice in the Add PostGIS Table(s) dialog:

enter image description here

Select the geometry column you want to use and press Add.


You can load it using DB Manager. Insert the query to SQL Window and load it as layer. Something like this:

SELECT id::int, the_geom1, next_attributes... FROM scenes;
SELECT id::int, the_geom2, next_attributes... FROM scenes;

Why not create two views and drop geometry columns alternatively? Something like https://stackoverflow.com/a/1712243/2308051 (except that you would use views, not tables).

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.