Skip to content
Permalink
Browse files

postgres provider: also cast field expressions to text (fixes #12346)

(cherry picked from commit 1acad42f48dcf7ce31512356c8dd609292f22899)
  • Loading branch information
jef-n committed Mar 10, 2015
1 parent e94ebd7 commit f04c40c28330708e394f598f27c26bf0e78dea7c
Showing with 4 additions and 5 deletions.
  1. +3 −3 src/providers/postgres/qgspostgresconn.cpp
  2. +1 −2 src/providers/postgres/qgspostgresprovider.cpp
@@ -1183,15 +1183,15 @@ QString QgsPostgresConn::fieldExpression( const QgsField &fld, QString expr )
expr = expr.arg( quotedIdentifier( fld.name() ) );
if ( type == "money" )
{
return QString( "cash_out(%1)" ).arg( expr );
return QString( "cash_out(%1)::text" ).arg( expr );
}
else if ( type.startsWith( "_" ) )
{
return QString( "array_out(%1)" ).arg( expr );
return QString( "array_out(%1)::text" ).arg( expr );
}
else if ( type == "bool" )
{
return QString( "boolout(%1)" ).arg( expr );
return QString( "boolout(%1)::text" ).arg( expr );
}
else if ( type == "geometry" )
{
@@ -1270,8 +1270,7 @@ void QgsPostgresProvider::uniqueValues( int index, QList<QVariant> &uniqueValues
sql += QString( " WHERE %1" ).arg( mSqlWhereClause );
}

sql += QString( " ORDER BY %1" )
.arg( quotedIdentifier( fld.name() ) );
sql += QString( " ORDER BY %1" ).arg( connectionRO()->fieldExpression( fld ) );

if ( limit >= 0 )
{

0 comments on commit f04c40c

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