Skip to content

Commit

Permalink
fix(redshift-driver): Dont load user defined types
Browse files Browse the repository at this point in the history
  • Loading branch information
ovr committed Aug 15, 2021
1 parent 044ba8e commit 1ea0a44
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/cubejs-postgres-driver/src/PostgresDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,7 @@ export class PostgresDriver<Config extends PostgresDriverConfiguration = Postgre
}
}

protected async prepareConnection(
conn: PoolClient,
options: { executionTimeout: number } = {
executionTimeout: this.config.executionTimeout ? <number>(this.config.executionTimeout) * 1000 : 600000
}
) {
await conn.query(`SET TIME ZONE '${this.config.storeTimezone || 'UTC'}'`);
await conn.query(`SET statement_timeout TO ${options.executionTimeout}`);

protected async loadUserDefinedTypes(conn: PoolClient): Promise<void> {
if (!this.userDefinedTypes) {
const customTypes = await conn.query(
"SELECT oid, typname FROM pg_type WHERE typcategory = 'U'",
Expand All @@ -149,6 +141,18 @@ export class PostgresDriver<Config extends PostgresDriverConfiguration = Postgre
}
}

protected async prepareConnection(
conn: PoolClient,
options: { executionTimeout: number } = {
executionTimeout: this.config.executionTimeout ? <number>(this.config.executionTimeout) * 1000 : 600000
}
) {
await conn.query(`SET TIME ZONE '${this.config.storeTimezone || 'UTC'}'`);
await conn.query(`SET statement_timeout TO ${options.executionTimeout}`);

await this.loadUserDefinedTypes(conn);
}

public async stream(
query: string,
values: unknown[],
Expand Down
4 changes: 4 additions & 0 deletions packages/cubejs-redshift-driver/src/RedshiftDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export class RedshiftDriver extends PostgresDriver<RedshiftDriverConfiguration>
return undefined;
}

public async loadUserDefinedTypes(): Promise<void> {
// @todo Implement for Redshift, column \"typcategory\" does not exist in pg_type
}

public async isUnloadSupported() {
if (this.config.exportBucket) {
return true;
Expand Down

0 comments on commit 1ea0a44

Please sign in to comment.