Skip to content

Commit

Permalink
QgsProviderConnectionPostgres: add test for qgis#55223
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Feb 6, 2024
1 parent bf10057 commit 58c1da3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/src/python/test_qgsproviderconnection_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,26 @@ def test_zm(self):
table_info = conn.table('qgis_test', 'gh_43268_test_zm')
self.assertEqual(sorted([QgsWkbTypes.displayString(col.wkbType) for col in table_info.geometryColumnTypes()]), ['LineStringZ', 'PointZ', 'PolygonZ'])

def test_m(self):
"""Test regression GH #55223"""

md = QgsProviderRegistry.instance().providerMetadata('postgres')
conn = md.createConnection(self.uri, {})
sql = """
DROP TABLE IF EXISTS qgis_test.gh_55223_test_m;
CREATE TABLE qgis_test.gh_55223_test_m AS
WITH test_measure AS (
SELECT ST_GeomFromText('LINESTRING M (796091.2 6313188.3 0,796089 6313175 13.480726983172712,796087 6313166.1 22.602678529121157,796083.6 6313156.5 32.786980173957)', 2154) AS xym
)
select
xym,
ST_Force2D(xym) as xy
FROM test_measure;
"""
conn.executeSql(sql)
geom_types = [t.geometryColumnTypes()[0] for t in conn.tables() if t.tableName() == 'gh_55223_test_m']
self.assertEqual(sorted([QgsWkbTypes.displayString(col.wkbType) for col in geom_types]), ['LineString', 'LineStringM'])

def test_table_scan(self):
"""Test that with use estimated metadata disabled all geometry column
types can be identified, test for GH #43186 """
Expand Down

0 comments on commit 58c1da3

Please sign in to comment.