2

I loaded a PostgreSQL layer in QGIS project. The layer has some array type attributes like integer[].

I'd like to edit these attributes in Attribute Table. But it doesn't work, I could not type any value in the table cell.

I also tried changing the Fields Widget of the attribute but it seem doesn't support multidimensional array value.

4
  • Array types are a non-relational extension of PG. Implementing them would be a significant change to the ODBC model used in cursors. It's not really a surprise they're not supported. I suggest you use the relational model and implement the lists as one-to-many tables.
    – Vince
    May 24 '20 at 14:29
  • Which version are you using? Editing an integer[] field should work out of the box (QGIS 3.10)
    – JGH
    May 24 '20 at 17:49
  • @JGH I am currently using QGIS 3.12.1. I have not done this on QGIS 3.10 before. I may have a try, thanks.
    – Zipei Lu
    May 25 '20 at 0:58
  • @Vince Thanks for your explanation. But using one-to-many tables is too complicated for editing features manually. Strange thing is if I export features as a GeoJSON file. The list-like string will automatically convert to list type. If I import the GeoJSON , the list turns to string. They don't support array types may have other reasons other than ODBC model.
    – Zipei Lu
    May 25 '20 at 2:21
1

For a table containing an array of integer

 create table testarr(id int primary key, arr integer[], geom geometry(point, 4326));

The widget type should be set to list

enter image description here

You can then edit a current record

enter image description here

or add a new one

enter image description here

1
  • Yes, this way works, but it doesn't support more than 1 dimension array :(
    – Zipei Lu
    May 25 '20 at 13:22

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.