TransWikia.com

QGIS error message while running PostgreSQL code. WARNING Invalid PostgreSQL layer

Geographic Information Systems Asked on January 16, 2021

I have run a code in pgAdmin it returns 43 rows of data. I took the same code ran it in QGIS and found the same row of data. However while trying to add the new data into the map QGIS comes with the error

WARNING Invalid PostgreSQL layer

I ran two forms of this code and both came back with the same error.

SELECT pin, ST_MakeValid(parcels.geom), ST_MakeValid(address_points.geom)
FROM   parcels
JOIN   address_points
       ON ST_Contains(parcels.geom,address_points.geom)
WHERE  class = 'CLUB';

or

SELECT pin
FROM   parcels
JOIN   address_points
       ON ST_Contains(ST_MakeValid(parcels.geom), ST_MakeValid(address_points.geom))
WHERE  class = 'CLUB';

What I am trying to do is select all the parcel that contains club within, and will add the new data to a new table (create table AS ….).
I was making the map first to see if the data was good to map, which lead to the above error.

One Answer

Normally that error occurs when QGIS cannot find a column with a unique "primary key". Ensure that the pin column has no duplicates, or add another field with a proper primary key.

See this thread for using the row number

Answered by Andre on January 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP