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


##########
c/driver/postgresql/postgresql_test.cc:
##########
@@ -94,6 +95,33 @@ class PostgresConnectionTest : public ::testing::Test,
   void TestMetadataGetObjectsTablesTypes() { GTEST_SKIP() << "Not yet 
implemented"; }
   void TestMetadataGetObjectsColumns() { GTEST_SKIP() << "Not yet 
implemented"; }
 
+  void TestMetadataGetTableSchema() {
+    // We are overriding to test against SQL injection
+    // TODO: should refactor to provide general pattern for all drivers to test
+    adbc_validation::ConnectionTest::TestMetadataGetTableSchema();
+    adbc_validation::Handle<ArrowSchema> schema;
+    ASSERT_THAT(AdbcConnectionGetTableSchema(&connection, /*catalog=*/nullptr,
+                                             /*db_schema=*/nullptr,
+                                             "0'::int; DROP TABLE 
bulk_ingest;--",
+                                             &schema.value, &error),
+                IsStatus(ADBC_STATUS_IO, &error));
+
+    ASSERT_THAT(
+        AdbcConnectionGetTableSchema(&connection, /*catalog=*/nullptr,
+                                     /*db_schema=*/"0'::int; DROP TABLE 
bulk_ingest;--",
+                                     "DROP TABLE bulk_ingest;", &schema.value, 
&error),
+        IsStatus(ADBC_STATUS_IO, &error));
+
+    ASSERT_THAT(AdbcConnectionGetTableSchema(&connection, /*catalog=*/nullptr,
+                                             /*db_schema=*/nullptr, 
"bulk_ingest",
+                                             &schema.value, &error),
+                IsOkStatus(&error));
+
+    ASSERT_NO_FATAL_FAILURE(adbc_validation::CompareSchema(
+        &schema.value, {{"int64s", NANOARROW_TYPE_INT64, true},

Review Comment:
   The `true` is listed as `NULLABLE` in the parent, but that is defined in an 
anonymous namespace. Didn't think it was worth moving around, but maybe



-- 
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