I have tried to load a PostGIS layer containing a binary data field (BLOB, bytea) and then use the new form widget for binary fields (https://qgis.org/en/site/forusers/visualchangelog36/index.html#feature-new-form-widget-for-binary-blob-fields). The problem is, that the binary field will not be in the layers attribute table, so the widget can not be used/activated. In the QGIS database manager the field is visible in the table preview. Does anybody knows what is going wrong or what I am missing?
2 Answers
QGIS (as of version 3.8.0) has no support for binary/bytea fields from Postgres sources. As of version 3.8, they are only supported for disk-based vector layers and in-memory scratch layers.
- 27,620
- 3
- 61
- 85
This is possible in QGIS 3.16 (not tested on previous versions).
You can add a bytea column to your layer and QGIS is able to insert and retrieve the BLOB (if using PostgreSQL).
In the following use case, I added a photo bytea column to my layer to store images.
To configure the feature form, please follow the answer to create either and HTML Widget or QML Widget to see your picture.
Your bytea field will became a Binary Widget and you can use it to upload your binary data.
If you use images, add an HTML Widget or QML Widget to the feature form to display the image, as shown below.
If you use other types of binary data, you have to customize the widgets.
Tested with Geopackage and PostgreSQL providers.
-
Also works with MS SQL. – Albine Pro Feb 24 '22 at 11:43


