paleolimbot commented on code in PR #2219:
URL: https://github.com/apache/arrow-adbc/pull/2219#discussion_r1823335747


##########
c/driver/postgresql/postgres_type.h:
##########
@@ -111,7 +111,11 @@ enum class PostgresTypeId {
   kXid8,
   kXid,
   kXml,
-  kUserDefined
+  kUserDefined,
+  // This is not an actual type, but there are cases where all we have is an 
Oid
+  // that was not inserted into the type resolver. We can't use "unknown" or 
"opaque"
+  // or "void" because those names show up in actual pg_type tables.
+  kUnnamed

Review Comment:
   This surfaced because apparently the "geometry" type is returned with an oid 
that doesn't exist (3999) despite actually existing (with oid 3000). There's 
really no reason we can't still return the binary data that was sent there with 
the appropriate `arrow.opaque` metadata, which is what this particular hack 
enables.



##########
c/driver/postgresql/connection.cc:
##########
@@ -175,6 +176,13 @@ class PostgresGetObjectsHelper : public 
adbc::driver::GetObjectsHelper {
         all_constraints_(conn, kConstraintsQueryAll),
         some_constraints_(conn, ConstraintsQuery()) {}
 
+  // Allow Redshift to execute this query without constraints
+  // TODO(paleolimbot): Investigate to see if we can simplify the constraits 
query so that
+  // it works on both!
+  void SetEnableConstraints(bool enable_constraints) {
+    enable_constraints_ = enable_constraints;
+  }

Review Comment:
   I didn't dig too deeply here but I did check that we get column names! I am 
not sure that we're getting tables from schemas outside "public" (there are 
quite a few things that look like sample database schemas but I don't see any 
tables in them listed by our query).



##########
c/driver/postgresql/postgres_type.h:
##########
@@ -204,7 +213,8 @@ class PostgresType {
   // do not have a corresponding Arrow type are returned as Binary with field
   // metadata ADBC:posgresql:typname. These types can be represented as their
   // binary COPY representation in the output.
-  ArrowErrorCode SetSchema(ArrowSchema* schema) const {
+  ArrowErrorCode SetSchema(ArrowSchema* schema,
+                           const std::string& vendor_name = "PostgreSQL") 
const {

Review Comment:
   This lets our "opaque" type have the appropriate vendor name (since it's not 
always "PostgreSQL" any more).



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