I would like to load a PostgreSQL table without geometry and with a composite primary key in QGIS (there is no unique column, see below).
This yields “ERROR” in all cells. It is not resolved by adding a SERIAL column.
The same occurs when loading using DB Manager. But the issue is resolved when I “Edit table” in DB Manager, using “SELECT * from table” and “Load as new layer”. If I select all records, DB Manager adds a unique _uid_ column. If I select one subgroup from (id_name, sub_id), I can select the time_ column as unique values which also works.
What am I missing for QGIS to load the table directly from PostgreSQL? Is a unique column as primary key required, or should I look elsewhere?
I am using a PostgreSQL/PostGIS database v9.4.6 and QGIS 2.14.9 ltr.
Name - Type - Length - Null
id_name - varchar - (30) - N
sub_id - varchar - (30) - N
time_ - timestamp - 8 - N
mtaw - float8 - 8 - Y
mmv - float8 - 8 - Y
Name - Type - Column(s)
timeseries_values_pkey - Primary key - id_name, sub_id, time_
timeseries_values_id_name_fkey - Foreign key - id_name, sub_id