Skip to content
Permalink
Browse files

use triple quoting with st_estimatedextent in postgres provider and d…

…b_manager (fixes #12478)
  • Loading branch information
jef-n committed Jun 24, 2015
1 parent ea71b2c commit 048aff01bb9cf42e2c1c17eb0ddbd81537443e19
@@ -572,10 +572,10 @@ def getTableEstimatedExtent(self, table, geom):
return

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

subquery = u"SELECT st_estimated_extent(%s%s,%s) AS extent" % (
schema_part, self.quoteString(tablename), self.quoteString(geom))
schema_part, self.quoteString( self.quoteId( 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( mSchemaName ) )
.arg( quotedValue( mTableName ) )
.arg( quotedValue( quotedIdentifier( mSchemaName ) ) )
.arg( quotedValue( quotedIdentifier( 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 048aff0

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