WillAyd commented on code in PR #1058:
URL: https://github.com/apache/arrow-adbc/pull/1058#discussion_r1327608004


##########
c/driver/postgresql/connection.cc:
##########
@@ -654,10 +652,23 @@ AdbcStatusCode PostgresConnectionGetInfoImpl(const 
uint32_t* info_codes,
         RAISE_ADBC(
             AdbcConnectionGetInfoAppendString(array, info_codes[i], 
"PostgreSQL", error));
         break;
-      case ADBC_INFO_VENDOR_VERSION:
-        RAISE_ADBC(AdbcConnectionGetInfoAppendString(
-            array, info_codes[i], std::to_string(PQlibVersion()).c_str(), 
error));
+      case ADBC_INFO_VENDOR_VERSION: {
+        const char* stmt = "SHOW server_version_num";
+        auto result_helper = PqResultHelper{conn_, std::string(stmt), error};
+        RAISE_ADBC(result_helper.Prepare());
+        RAISE_ADBC(result_helper.Execute());
+        auto it = result_helper.begin();
+        if (it == result_helper.end()) {
+          SetError(error,
+                   "[libpq] PostgreSQL returned no rows for 'SELECT 
CURRENT_SCHEMA'");

Review Comment:
   Ugh sorry about this - should have noticed already. Nice catch



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to