QPSQL: Unable to create query
-
By looking what this error means: https://www.postgresql.org/docs/10/errcodes-appendix.html
Try to run your query directly with psql to see where exactly the error is.
Also there is no need to use prepare() here since you don't bind any values.@Christian-Ehrlicher Can there be a problem with a bad driver?
-
The table is 'account', the schema public - try without schema
@Christian-Ehrlicher it is too not work:
QSqlQuery query("SELECT * FROM account ", dataBase); if (!query.exec()) { qDebug()<<"not get data from db \r\n"<<query.lastError()<<"\r\n"; qDebug()<<query.lastQuery(); } else { qDebug()<<"get data from db \r\n"; query.first(); } return resultVector;
-
So where do you get the error? during query.exec()? And what error? The same as in the first post?
-
@Christian-Ehrlicher said in QPSQL: Unable to create query:
query.exec()
Yes, in query.exec(). The same error. Looks like it's the driver. How do I find out which version of the driver is designed for?
-
@Mikeeeeee I'm using psql since ages with Qt. Imo it's a problem with your psql installation. Simply test it with a sqlite database. Also you should take a look what others did to solve the psql 42601 error but that's not Qt related
-
Thenswitch back to the old PostgreSQL - or do you really need some new features in PostgreSQL 12 (btw: psql 12 is supported since Qt5.14 and works fine here)