diff --git a/tests/src/python/test_qgsserver_wms_getfeatureinfo.py b/tests/src/python/test_qgsserver_wms_getfeatureinfo.py
index f7fa05571afd..73c5b4b51166 100644
--- a/tests/src/python/test_qgsserver_wms_getfeatureinfo.py
+++ b/tests/src/python/test_qgsserver_wms_getfeatureinfo.py
@@ -407,6 +407,26 @@ def testGetFeatureInfoTolerance(self):
'wms_getfeatureinfo_polygon_tolerance_20_text_xml',
'test_project_values.qgz')
+ def testGetFeatureInfoPostgresTypes(self):
+ #compare json list output with file
+ self.wms_request_compare('GetFeatureInfo',
+ '&layers=json' +
+ '&info_format=text%2Fxml' +
+ '&srs=EPSG%3A3857' +
+ '&QUERY_LAYERS=json' +
+ '&FILTER=json' + urllib.parse.quote(':"pk" = 1'),
+ 'get_postgres_types_json_list',
+ 'test_project_postgres_types.qgs')
+
+ #compare dict output with file
+ self.wms_request_compare('GetFeatureInfo',
+ '&layers=json' +
+ '&info_format=text%2Fxml' +
+ '&srs=EPSG%3A3857' +
+ '&QUERY_LAYERS=json' +
+ '&FILTER=json' + urllib.parse.quote(':"pk" = 2'),
+ 'get_postgres_types_json_dict',
+ 'test_project_postgres_types.qgs')
if __name__ == '__main__':
unittest.main()
diff --git a/tests/testdata/qgis_server/get_postgres_types_json_dict.txt b/tests/testdata/qgis_server/get_postgres_types_json_dict.txt
new file mode 100644
index 000000000000..2913baed96d4
--- /dev/null
+++ b/tests/testdata/qgis_server/get_postgres_types_json_dict.txt
@@ -0,0 +1,13 @@
+*****
+Content-Type: text/xml; charset=utf-8
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/testdata/qgis_server/get_postgres_types_json_list.txt b/tests/testdata/qgis_server/get_postgres_types_json_list.txt
new file mode 100644
index 000000000000..3ca8f06fb229
--- /dev/null
+++ b/tests/testdata/qgis_server/get_postgres_types_json_list.txt
@@ -0,0 +1,13 @@
+*****
+Content-Type: text/xml; charset=utf-8
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/testdata/qgis_server/test_project_postgres_types.qgs b/tests/testdata/qgis_server/test_project_postgres_types.qgs
new file mode 100644
index 000000000000..75d439771f8c
--- /dev/null
+++ b/tests/testdata/qgis_server/test_project_postgres_types.qgs
@@ -0,0 +1,254 @@
+
+
+
+
+
+
+
+
+
+ +proj=longlat +datum=WGS84 +no_defs
+ 3452
+ 4326
+ EPSG:4326
+ WGS 84
+ longlat
+ WGS84
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ degrees
+
+ 8.20313020806923632
+ 44.90118727027074641
+ 8.20717330488028196
+ 44.90224039332306205
+
+ 0
+
+
+ +proj=longlat +datum=WGS84 +no_defs
+ 3452
+ 4326
+ EPSG:4326
+ WGS 84
+ longlat
+ WGS84
+ true
+
+
+ 0
+
+
+
+
+
+
+ json_b2af056d_ba24_4fb7_805b_5a7720e242f3
+ dbname='qgis_test' port=5432 user='postgres' password='postgres' sslmode=disable key='pk' table="qgis_test"."json" sql=
+
+
+
+ json
+
+
+
+ 0
+ 0
+
+
+
+
+ true
+
+
+
+
+
+
+ dataset
+
+
+
+
+
+
+
+
+ 0
+ 0
+
+
+
+
+ false
+
+
+
+
+ postgres
+
+
+
+
+
+
+
+
+
+
+ 1
+ 1
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0
+
+
+ 0
+ generatedlayout
+
+
+
+ "pk"
+
+
+
+
+
+
+ WGS84
+
+
+ 1
+
+
+ 255
+ 255
+ 255
+ 0
+ 255
+ 255
+ 255
+
+
+ 2
+ true
+
+
+
+ 16
+ 50
+ false
+ 0
+ false
+ 30
+ false
+ true
+ true
+
+
+ false
+
+
+ meters
+ m2
+
+
+
+
+
+
+
+
+
+
+
+
+ David
+ 2018-10-17T15:28:25
+
+
+
+