You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "WillAyd (via GitHub)" <gi...@apache.org> on 2023/06/02 18:34:11 UTC

[GitHub] [arrow-adbc] WillAyd commented on a diff in pull request #725: feat(c/driver/postgresql): Implement PRIMARY KEY in GetObjects ALL depth

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


##########
c/driver/postgresql/postgresql_test.cc:
##########
@@ -258,6 +258,131 @@ TEST_F(PostgresConnectionTest, GetObjectsGetDbSchemas) {
   ASSERT_TRUE(seen_public) << "public schema does not exist";
 }
 
+TEST_F(PostgresConnectionTest, GetObjectsGetAllFindsPrimaryKey) {
+  ASSERT_THAT(AdbcConnectionNew(&connection, &error), IsOkStatus(&error));
+  ASSERT_THAT(AdbcConnectionInit(&connection, &database, &error), IsOkStatus(&error));
+
+  if (!quirks()->supports_get_objects()) {
+    GTEST_SKIP();
+  }
+
+  adbc_validation::StreamReader reader;
+  ASSERT_THAT(
+      AdbcConnectionGetObjects(&connection, ADBC_OBJECT_DEPTH_ALL, nullptr, nullptr,
+                               nullptr, nullptr, nullptr, &reader.stream.value, &error),
+      IsOkStatus(&error));
+  ASSERT_NO_FATAL_FAILURE(reader.GetSchema());
+  ASSERT_NO_FATAL_FAILURE(reader.Next());
+  ASSERT_NE(nullptr, reader.array->release);
+  ASSERT_GT(reader.array->length, 0);
+
+  // should exist on public.adbc_test id column
+  bool seen_id_column = false;
+  bool seen_primary_key = false;
+
+  // TODO: these are in the PqObjectsHelper.GetObjects method; move to shared location

Review Comment:
   Thinking these eventually should belong in utils so they can be used by all c/c++ driver implementations



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org