the server version of this postgresql is unknown falling back to the client version
-
I am currently using postgresql 14.7 and QT 5.8.0. When i enter the command "postgres -V" or "psql -V" it both shows 14.7. Hence when i try to use VS2015 and run my code. It managed to establish connection to the database but in the console it keeps on giving this message whenever i execute the console application. "It gave me this error saying "the server version of this postgresql is unknown falling back to the client version" Is there any way to resolve this? Below is the following code.
#include <QtSql>
#include <QApplication>
#include <cstdlib>
#include <iostream>
int main()
{
FILE* stream = _popen("pg_config --version", "r");
char output[128];
fgets(output, sizeof(output), stream);std::cout << "PostgreSQL version: " << output << std::endl;
QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL");
db.setHostName("localhost");
db.setDatabaseName("test");
db.setUserName("testtt");
db.setPassword("password");
bool ok = db.open();
qDebug() << ok;
qDebug() << db.connectionName();
qDebug() << db.contains();
return 0;
} -
@ThomasNeo said in the server version of this postgresql is unknown falling back to the client version:
n" Is there any way to resolve this? Below is the following code.
Simply ignore it - it just tells you that the plugin can't resolve the server version (because it doesn't know anything about 14.x in this old Qt version).
-
@Christian-Ehrlicher Will it affect any functionality of the database since the old Qt version doesnt know anything about this 14.x?
-
@ThomasNeo said in the server version of this postgresql is unknown falling back to the client version:
Will it affect any functionality of the database since the old Qt version doesnt know anything about this 14.x?
No, as it says it uses the version from the postgresql client library which seems to be suitable.
-
@Christian-Ehrlicher Alright. Thanks a lot Christian. Can i ask if i upgrade my qt, will it remove this message? if so what qt version would you recommend me to use.
-
It should be fixed with Qt 5.9.3 when the parsing for the new numbering scheme of PostgreSQL was added.
-
@Christian-Ehrlicher Yup.. it worked when i upgraded my Qt version. Thanks a lot.
Just for education purposes, can i ask lets say if i am still using qt 5.8.0 and i wish to remove this message. Is there a way to do that? I believe this message is caused by this qt sqldriver file called qsql_psql.cpp. So I tried to remove the code that prompts this message in qsql_psql.cpp file and it didnt work when i run my application.