patch_for_bug_1009.txt
1 |
Index: src/providers/postgres/qgspostgresprovider.cpp |
---|---|
2 |
=================================================================== |
3 |
--- src/providers/postgres/qgspostgresprovider.cpp (revision 8290) |
4 |
+++ src/providers/postgres/qgspostgresprovider.cpp (working copy) |
5 |
@@ -393,17 +393,25 @@ |
6 |
continue; |
7 |
|
8 |
const QString &type = fld.typeName(); |
9 |
- if( type == "money" || type.startsWith("_") ) |
10 |
+ if( type == "money" ) |
11 |
{ |
12 |
// money and arrays don't support cast to text, but return text |
13 |
// TODO: check other types |
14 |
- declare += "," + quotedIdentifier( fieldname ); |
15 |
+ declare += QString(",cash_out(%1) AS %1") |
16 |
+ .arg( quotedIdentifier( fieldname ) ); |
17 |
} |
18 |
+ else if( type.startsWith("_") ) |
19 |
+ { |
20 |
+ // money and arrays don't support cast to text, but return text |
21 |
+ // TODO: check other types |
22 |
+ declare += QString(",array_out(%1) AS %1") |
23 |
+ .arg( quotedIdentifier( fieldname ) ); |
24 |
+ } |
25 |
else if( type == "bool" ) |
26 |
{ |
27 |
// bool doesn't support cast to text either and even doesn't return text. |
28 |
// (even text() doesn't work with binary cursors) |
29 |
- declare += QString(",CASE WHEN %1 THEN 't' WHEN NOT %1 THEN 'f' ELSE NULL END AS %1") |
30 |
+ declare += QString(",boolout(%1) AS %1") |
31 |
.arg( quotedIdentifier(fieldname) ); |
32 |
} |
33 |
else |