Priority: P3: Somewhat important
Affects Version/s: 5.4.0 Alpha
Component/s: SQL Support
Environment:Any operating system with a locale that does not use arabic numerals.
After adding timezone support for datetime fields in PSQL driver, the function formatValue is using the function QDateTime::toString(QString format) to convert the provided QDateTime value to a string.
Since QDateTime::toString(QString format) function currently uses system's locale to do string conversion. PostgreSQL fails to read the serialized value when the system's locale is set to use any numerals other than arabic numerals.
In summary, this causes QSqlQuery::addBindValue() and QSqlQuery::bindValue() to fail when they are passed a QDateTime object on systems having locales with non arabic numerals.
Here is an example that demonstrates the issue:
The example results in the following error:
P.S. It seems that this will get fixed automatically in Qt 6 (when the function QDateTime::toString(QString format) is changed to use C locale instead of the system's locale). But It would be better to get that fixed in Qt5 releases (especially Qt5.6 LTS).
|For Gerrit Dashboard: QTBUG-59524|
|188854,3||PostgreSQL: fix datetime format when system locale doesn't use arabic numerals||5.4||qt/qtbase||Status: ABANDONED||0||0|
|188857,3||PostgreSQL: fix datetime format when system locale doesn't use arabic numerals||5.8||qt/qtbase||Status: MERGED||+2||0|
|188884,2||PostgreSQL: fix datetime format when system locale doesn't use arabic numerals||5.6||qt/qtbase||Status: MERGED||+2||0|