[QGIS-Developer] Insert data in a table with a table with a GENERATED column
Régis Haubourg
regis.haubourg at gmail.com
Tue Feb 11 06:03:05 PST 2020
Hi Paolo,
nice feature, thanks for the heads up !
I confirm the behavior here.
The documentation advises to use the `DEFAULT` keyword into the INSERT
command.
Here is what I get with a QGIS-like insert :
INSERT INTO
"data"."pipe"("geometry","id","label_1_text","_length2d","_length3d")
VALUES (st_geomfromtext('LINESTRINGZ(1 1 1, 2 2 2)',3946),1 ,'test',0, 0);
ERREUR: 42601: ne peut pas insérer dans la colonne « _length2d »
DÉTAIL : Column "_length2d" is a generated column.
EMPLACEMENT : rewriteTargetListIU, rewriteHandler.c : 827
With the keyword 'DEFAULT', it works
INSERT INTO
"data"."pipe"("geometry","id","label_1_text","_length2d","_length3d")
VALUES (st_geomfromtext('LINESTRINGZ(1 1 1, 2 2 2)',3946),2
,'test',DEFAULT, DEFAULT);
And with no data supplied for the generated columns, it also works
We indeed have to upgrade the postgresql provider to check this particular
column type to handle INSERT and UPDATE accordingly.
Regards
Régis
Le mar. 11 févr. 2020 à 13:59, Paolo Cavallini <cavallini at faunalia.it> a
écrit :
> Hi all,
> PostgreSQL 12 has the option of a GENERATED ALWAYS AS ... STORED column.
> QGIS is able to load the table, but apparently it is not possible to
> insert new records. Does anyone confirm that this is not a local problem?
> All the best.
> --
> Paolo Cavallini - www.faunalia.eu
> QGIS.ORG Chair:
> http://planet.qgis.org/planet/user/28/tag/qgis%20board/
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200211/d98a8913/attachment-0001.html>
More information about the QGIS-Developer
mailing list