New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PostgreSQL Provider: Fix M detection #56199
PostgreSQL Provider: Fix M detection #56199
Conversation
with this "fix": |
Unlike Geometry(Z), GeometryM contains already M suffix. It's useless to add M suffix here, since it will add a new name and the geometry type name will be something like GeometryMM. Fixes qgis#55223
68941c6
to
ea64e9b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Any chance to have a test?
// It's useless to add M suffix here, | ||
// since it will add a new name and the geometry type name will be something like GeometryMM. | ||
// see: https://github.com/qgis/QGIS/issues/55223 | ||
//typeString.append( 'M' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we avoid introducing commented-out code here? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since I wasn't sure about my fix, and it still seems like something that deserves an explanation, I preferred to add my comment and leave the code as a comment. Do you agree, if I leave my comment, but delete the "faulty" line?
@elpaso I confess I have no idea how to test it :/ |
Create the test table md = QgsProviderRegistry.instance().providerMetadata('postgres')
geom_types = [t.geometryColumnTypes()[0] for t in md.createConnection('dbname=qgis_test port=5433', {}).tables() if t.tableName() == 'test_linestringm']
# Expected:
[<QgsAbstractDatabaseProviderConnection.TableProperty.GeometryColumnType: 'LineString, EPSG:2154'>,
<QgsAbstractDatabaseProviderConnection.TableProperty.GeometryColumnType: 'LineStringM, EPSG:2154'>] See here for examples: https://github.com/qgis/QGIS/blob/master/tests/src/python/test_qgsproviderconnection_postgres.py#L386 |
thanks! |
Description
Unlike Geometry(Z), GeometryM contains already M suffix. It's useless to add M suffix here, since it will add a new name and the geometry type name will be something like GeometryMM.
Fixes #55223