Skip to content

Commit

Permalink
fix pgGraphqlQuery with concurent search path (twentyhq#5537)
Browse files Browse the repository at this point in the history
  • Loading branch information
Weiko authored May 22, 2024
1 parent 5448512 commit 4e533bf
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,22 @@ export class WorkspaceQueryRunnerService {
)};
`);

const results = await workspaceDataSource?.query<PGGraphQLResult>(
`SELECT graphql.resolve($1);`,
[query],
);
return await workspaceDataSource?.transaction(
async (transactionManager) => {
await transactionManager.query(`
SET search_path TO ${this.workspaceDataSourceService.getSchemaName(
workspaceId,
)};
`);

return results;
const results = transactionManager.query<PGGraphQLResult>(
`SELECT graphql.resolve($1);`,
[query],
);

return results;
},
);
}

private async parseResult<Result>(
Expand Down

0 comments on commit 4e533bf

Please sign in to comment.