Skip to content

Commit

Permalink
fix #30260
Browse files Browse the repository at this point in the history
  • Loading branch information
olivierdalang committed Jun 21, 2019
1 parent 0509d7d commit 395486b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions python/plugins/db_manager/db_plugins/plugin.py
Expand Up @@ -713,13 +713,6 @@ def uri(self):
geomCol = self.geomColumn if self.type in [Table.VectorType, Table.RasterType] else ""
uniqueCol = self.getValidQgisUniqueFields(True) if self.isView else None
uri.setDataSource(schema, self.name, geomCol if geomCol else None, None, uniqueCol.name if uniqueCol else "")
uri.setSrid(str(self.srid))
for f in self.fields():
if f.primaryKey:
uri.setKeyColumn(f.name)
break
uri.setWkbType(QgsWkbTypes.parseType(self.geomType))

return uri

def mimeUri(self):
Expand Down Expand Up @@ -990,6 +983,16 @@ def info(self):

return VectorTableInfo(self)

def uri(self):
uri = super().uri()
uri.setSrid(str(self.srid))
for f in self.fields():
if f.primaryKey:
uri.setKeyColumn(f.name)
break
uri.setWkbType(QgsWkbTypes.parseType(self.geomType))
return uri

def hasSpatialIndex(self, geom_column=None):
geom_column = geom_column if geom_column is not None else self.geomColumn
fld = None
Expand Down

0 comments on commit 395486b

Please sign in to comment.