Skip to content
Permalink
Browse files

postgres provider fixes:

- allow selection of rows with srid 0 (fixes #7889)
- fix geometry type assignment of geometry less tables
- filter out geometry columns with srids < 0 in browser
  • Loading branch information
jef-n committed May 25, 2013
1 parent a84f3a4 commit 925d3179e17bf3e4516ac2037a0ee7d10fc16b66
@@ -56,7 +56,7 @@ void QgsPgTableModel::addTableEntry( QgsPostgresLayerProperty layerProperty )
wkbType = QGis::WKBNoGeometry;
}

bool selectable = wkbType == QGis::WKBNoGeometry || ( wkbType != QGis::WKBUnknown && srid > 0 );
bool selectable = wkbType == QGis::WKBNoGeometry || ( wkbType != QGis::WKBUnknown && srid >= 0 );

QStandardItem *schemaNameItem = new QStandardItem( layerProperty.schemaName );
QStandardItem *typeItem = new QStandardItem( iconForWkbType( wkbType ), wkbType == QGis::WKBUnknown ? tr( "Select..." ) : QgsPostgresConn::displayStringForWkbType( wkbType ) );
@@ -571,7 +571,7 @@ bool QgsPostgresConn::getTableInfo( bool searchGeometryColumnsOnly, bool searchP

QgsDebugMsg( QString( "%1.%2: %3" ).arg( schema ).arg( table ).arg( relkind ) );

layerProperty.types = QList<QGis::WkbType>() << QGis::WKBUnknown;
layerProperty.types = QList<QGis::WkbType>() << QGis::WKBNoGeometry;
layerProperty.srids = QList<int>() << -1;
layerProperty.schemaName = schema;
layerProperty.tableName = table;
@@ -123,7 +123,8 @@ void QgsPGConnectionItem::setLayerType( QgsPostgresLayerProperty layerProperties
{
QgsPostgresLayerProperty layerProperty = layerProperties.at( i );

if ( layerProperty.types[0] == QGis::WKBUnknown && !layerProperty.geometryColName.isEmpty() )
if ( layerProperty.types[0] == QGis::WKBUnknown ||
(!layerProperty.geometryColName.isEmpty() && layerProperty.srids[0] < 0 ) )
continue;

if ( !schemaItem )

1 comment on commit 925d317

@strk

This comment has been minimized.

Copy link
Contributor

@strk strk commented on 925d317 May 25, 2013

Does the code converts SRID=-1 to SRID=0 when working with PostGIS < 2.0 ? Otherwise you still couldn't select this kind of tables with postgis-1.5

Please sign in to comment.
You can’t perform that action at this time.