Skip to content
Permalink
Browse files

Revert "use triple quoting with st_estimatedextent in postgres provid…

…er and db_manager (fixes #12478)"

As it seems to address a meanwhile reverted behavior change in PostGIS 2.1
before it was released (see also https://trac.osgeo.org/postgis/ticket/2834).

This reverts commit 048aff0.
  • Loading branch information
jef-n committed Jul 13, 2015
1 parent 63e1850 commit 48e4fb85c800f63187f5ecc2b9f967ac87e90992
@@ -572,10 +572,10 @@ def getTableEstimatedExtent(self, table, geom):
return

schema, tablename = self.getSchemaTableName(table)
schema_part = u"%s," % self.quoteString( self.quoteId( schema) ) if schema is not None else ""
schema_part = u"%s," % self.quoteString(schema) if schema is not None else ""

subquery = u"SELECT st_estimated_extent(%s%s,%s) AS extent" % (
schema_part, self.quoteString( self.quoteId( tablename) ), self.quoteString(geom))
schema_part, self.quoteString(tablename), self.quoteString(geom))
sql = u"""SELECT st_xmin(extent), st_ymin(extent), st_xmax(extent), st_ymax(extent) FROM (%s) AS subquery """ % subquery

try:
@@ -2487,8 +2487,8 @@ QgsRectangle QgsPostgresProvider::extent()
sql = QString( "SELECT %1(%2,%3,%4)" )
.arg( connectionRO()->majorVersion() < 2 ? "estimated_extent" :
( connectionRO()->majorVersion() == 2 && connectionRO()->minorVersion() < 1 ? "st_estimated_extent" : "st_estimatedextent" ) )
.arg( quotedValue( quotedIdentifier( mSchemaName ) ) )
.arg( quotedValue( quotedIdentifier( mTableName ) ) )
.arg( quotedValue( mSchemaName ) )
.arg( quotedValue( mTableName ) )
.arg( quotedValue( mGeometryColumn ) );
result = mConnectionRO->PQexec( sql );
if ( result.PQresultStatus() == PGRES_TUPLES_OK && result.PQntuples() == 1 && !result.PQgetisnull( 0, 0 ) )

0 comments on commit 48e4fb8

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