Kirk,

Qgis can only use columns of type integer with unique values for its unique key column. Primary keys made up from two or more other columns are not accepted either. This is a known restriction, and we have an enhancement ticket in trac to improve things.


Gavin

Kirk Wythers wrote:
I've got a quick question for the list. I am trying (once again) to add a postgis layer to qgis as map of "points". I have created a view that contains data from three different tables. The view contains a geometry column and two additional columns from a table that together make up a primary key (and are therefor unique).

However, qgis will not add the view as a postgis layer. Qgis gives the error message: The view 'public.climate_daily' has no column suitable for use as a unique key.

Is Qgis trying to tell me that the veiw MUST contain a single column that severs a primary key, and that the two column primary key will not satisfy this requirement?

The index form the table that contains the PK is:

"weather_pkey" PRIMARY KEY, btree (station_id, date)

While the view definition is:

SELECT weather.station_id, sites.thepoint_meter, sites.longname, weather.date, weather."year", weather."month", weather."day", weather.doy, weather.tmin, weather.tmax, solar.rad, weather.precip
   FROM sites, weather, solar
WHERE sites.station_id = weather.station_id AND sites.station_id = solar.station_id AND weather.date = solar.date;

_______________________________________________
Qgis-user mailing list
Qgis-user@lists.qgis.org
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user

Reply via email to