Skip to content

Commit

Permalink
nix previous type
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Oct 30, 2024
1 parent 07cf6b6 commit 148f44d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
15 changes: 2 additions & 13 deletions c/driver/postgresql/database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ AdbcStatusCode PostgresDatabase::SetOption(const char* key, const char* value,
struct AdbcError* error) {
if (strcmp(key, "uri") == 0) {
uri_ = value;
} else if (strcmp(key, ADBC_POSTGRESQL_OPTION_LOAD_ARRAY_TYPES) == 0) {
load_array_types_ = strcmp(value, ADBC_OPTION_VALUE_ENABLED) == 0;
} else {
SetError(error, "%s%s", "[libpq] Unknown database option ", key);
return ADBC_STATUS_NOT_IMPLEMENTED;
Expand Down Expand Up @@ -219,10 +217,7 @@ static inline int32_t InsertPgTypeResult(

AdbcStatusCode PostgresDatabase::RebuildTypeResolver(PGconn* conn,
struct AdbcError* error) {
AdbcStatusCode final_status = Connect(&conn, error);
if (final_status != ADBC_STATUS_OK) {
return final_status;
}
AdbcStatusCode final_status = ADBC_STATUS_OK;

// We need a few queries to build the resolver. The current strategy might
// fail for some recursive definitions (e.g., arrays of records of arrays).
Expand Down Expand Up @@ -275,7 +270,7 @@ ORDER BY
)";

std::string type_query;
if (load_array_types_) {
if (redshift_server_version_[0] == 0) {
type_query = kTypeQuery;
} else {
type_query = kTypeQueryNoArrays;
Expand Down Expand Up @@ -317,12 +312,6 @@ ORDER BY
}
}

// Disconnect since PostgreSQL connections can be heavy.
{
AdbcStatusCode status = Disconnect(&conn, error);
if (status != ADBC_STATUS_OK) final_status = status;
}

if (final_status == ADBC_STATUS_OK) {
type_resolver_ = std::move(resolver);
}
Expand Down
3 changes: 0 additions & 3 deletions c/driver/postgresql/database.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@

#include "postgres_type.h"

#define ADBC_POSTGRESQL_OPTION_LOAD_ARRAY_TYPES "adbc.postgresql.load_array_types"

namespace adbcpq {
class PostgresDatabase {
public:
Expand Down Expand Up @@ -71,7 +69,6 @@ class PostgresDatabase {
std::shared_ptr<PostgresTypeResolver> type_resolver_;
std::array<int, 3> postgres_server_version_{};
std::array<int, 3> redshift_server_version_{};
bool load_array_types_{true};
};
} // namespace adbcpq

Expand Down

0 comments on commit 148f44d

Please sign in to comment.