Skip to content
Permalink
Browse files

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

  • Loading branch information
jef-n committed Mar 10, 2015
1 parent a0a5822 commit 306a53b81019519e72487218a511027223672c4b
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" )
{
@@ -1315,8 +1315,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 306a53b

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