Skip to content

Commit

Permalink
Revert "use triple quoting with st_estimatedextent in postgres provid…
Browse files Browse the repository at this point in the history
…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.

(cherry picked from commit e4410abb93e74ca6e85e11f5916e8c07c417e06f)
  • Loading branch information
jef-n committed Jul 13, 2015
1 parent 174dca2 commit 8300521
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions python/plugins/db_manager/db_plugins/postgis/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) )
Expand Down

0 comments on commit 8300521

Please sign in to comment.