Skip to content

Commit

Permalink
Add test for tid key types in PG views
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Sep 17, 2019
1 parent f7d1971 commit 4c8bac0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/src/python/test_provider_postgres.py
Expand Up @@ -1405,6 +1405,16 @@ def testInvalidLayerDiscoverRelations(self):
self.assertFalse(vl.isValid())
self.assertEqual(vl.dataProvider().discoverRelations(vl, []), [])

def testCheckTidPkOnViews(self):
"""Test vector layer based on a view with `ctid` as a key"""

# This is valid
vl0 = QgsVectorLayer(self.dbconn + ' checkPrimaryKeyUnicity=\'0\' sslmode=disable key=\'ctid\' srid=4326 type=POINT table="qgis_test"."b31799_test_view_ctid" (geom) sql=', 'test', 'postgres')
self.assertTrue(vl0.isValid())
self.assertEqual(vl0.featureCount(), 10)
for f in vl0.getFeatures():
self.assertNotEqual(f.attribute(0), NULL)


class TestPyQgsPostgresProviderCompoundKey(unittest.TestCase, ProviderTestCase):

Expand Down

0 comments on commit 4c8bac0

Please sign in to comment.