WillAyd commented on code in PR #799:
URL: https://github.com/apache/arrow-adbc/pull/799#discussion_r1230123782
##########
c/driver/postgresql/connection.cc:
##########
@@ -185,6 +186,10 @@ class PqGetObjectsHelper {
na_error_ = {0};
}
+ static const inline std::unordered_map<std::string, std::string>
PgTableTypes = {
Review Comment:
I've attached this to PqGetObjectsHelper for now, though I think could also
just be a static constant in the module
##########
c/driver/postgresql/connection.cc:
##########
@@ -365,6 +370,45 @@ class PqGetObjectsHelper {
params.push_back(std::string(table_name_));
}
+ if (table_types_ != NULL) {
+ std::vector<std::string> table_type_filter;
+ const char** table_types = table_types_;
+ while (*table_types != NULL) {
+ auto table_type_str = std::string(*table_types);
+ if (auto search =
PqGetObjectsHelper::PgTableTypes.find(table_type_str);
+ search != PqGetObjectsHelper::PgTableTypes.end()) {
+ table_type_filter.push_back(search->second);
+ }
+ table_types++;
+ }
+
+ if (!table_type_filter.empty()) {
+ std::ostringstream oss;
+ bool first = true;
+ oss << "(";
+ for (const auto& str : table_type_filter) {
+ if (!first) {
+ oss << ", ";
+ }
+ oss << "'" << str << "'";
+ first = false;
+ }
+ oss << ")";
+
+ if (StringBuilderAppend(&query, "%s%s", " AND c.relkind IN ",
Review Comment:
This does not use a parameter/prepared statement. My reasoning is that it is
internally controlled which arguments end up being in the filter, and it was
simpler to attach literally instead of keeping track of / enumerating all
possible parameters in the statement
##########
c/driver/postgresql/postgresql_test.cc:
##########
@@ -63,6 +63,24 @@ class PostgresQuirks : public adbc_validation::DriverQuirks {
return status;
}
+ AdbcStatusCode DropView(struct AdbcConnection* connection, const
std::string& name,
Review Comment:
Instead of a new method I think could also parametrize `DropTable` to accept
a constant table type argument. That would be more consistent with other method
names that refer to everything as `Table`
--
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]