lidavidm commented on code in PR #2219:
URL: https://github.com/apache/arrow-adbc/pull/2219#discussion_r1828624368
##########
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.
+ kUnnamedArrowOpaque
Review Comment:
Hmm, that seems like it should be an error? (or if we had warnings, a
warning that you should recreate the connection to reload the OIDs)
##########
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.
+ kUnnamedArrowOpaque
Review Comment:
Eventually we'll probably have to tackle it as part of
https://github.com/apache/arrow-adbc/issues/1755
##########
c/driver/postgresql/database.h:
##########
@@ -58,12 +62,29 @@ class PostgresDatabase {
return type_resolver_;
}
- AdbcStatusCode RebuildTypeResolver(struct AdbcError* error);
+ Status InitVersions(PGconn* conn);
+ Status RebuildTypeResolver(PGconn* conn);
+ std::string_view VendorName() {
+ if (redshift_server_version_[0] != 0) {
+ return "Redshift";
+ } else {
+ return "PostgreSQL";
+ }
+ }
+ const std::array<int, 3>& VendorVersion() {
+ if (redshift_server_version_[0] != 0) {
+ return redshift_server_version_;
+ } else {
+ return postgres_server_version_;
+ }
+ }
private:
int32_t open_connections_;
std::string uri_;
std::shared_ptr<PostgresTypeResolver> type_resolver_;
+ std::array<int, 3> postgres_server_version_{};
+ std::array<int, 3> redshift_server_version_{};
Review Comment:
I suppose if you wanted to be fancy you could use std::variant with
single-member structs but this works fine
--
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]