From fe3a8b1565ae2b0e1512c4737a15dcf8e9ce2382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20de=20Paula=20Rodrigues=20Neto=20Assis?= Date: Mon, 25 May 2020 10:25:01 -0300 Subject: [PATCH] Don't assume pg_attribute.attgenerated will always have "s" The value for pg_attribute.attgenerated will hold "s" for stored generated fields, but this might change in future releases of PostgreSQL. So, we just check for the presence of a value in that field. --- src/providers/postgres/qgspostgresprovider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/postgres/qgspostgresprovider.cpp b/src/providers/postgres/qgspostgresprovider.cpp index bf2f84d92a7..443a1cfcd4e 100644 --- a/src/providers/postgres/qgspostgresprovider.cpp +++ b/src/providers/postgres/qgspostgresprovider.cpp @@ -920,7 +920,7 @@ bool QgsPostgresProvider::loadFields() notNullMap[attrelid][attnum] = attNotNull; uniqueMap[attrelid][attnum] = uniqueConstraint; identityMap[attrelid][attnum] = attIdentity.isEmpty() ? " " : attIdentity; - generatedMap[attrelid][attnum] = attGenerated == "s" ? defVal : ""; + generatedMap[attrelid][attnum] = attGenerated.isEmpty() ? "" : defVal; } } }