Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.4.0
-
None
-
Windows 7x64, MSVC 2013, PosgreSQL 9.3
-
34014406baaeac3e9d49d5654ef57ac6540a17a8
Description
I need to use QUuid values as QSqlQuery::bindValue arguments like this:
QSqlQuery q(db); bool ok = q.prepare("SELECT uuid('{C46A2575-7198-4C08-B4FD-C031B390E6E1}')=:test"); q.bindValue(":test", QUuid("{C46A2575-7198-4C08-B4FD-C031B390E6E1}")); q.exec(); qDebug() << q.lastError().databaseText();
This generates invalid query text like
SELECT uuid('{C46A2575-7198-4C08-B4FD-C031B390E6E1}')={C46A2575-7198-4C08-B4FD-C031B390E6E1}
Error text is: ERROR: syntax error at or near "{"
But the UUID values in PostgreSQL should be single-quoted
I am attaching simple patch to solve the problem
BTW, to use UUID in PostgreSQL you should create extension:
CREATE EXTENSION "uuid-ossp"