Skip to content

Commit 4e533bf

Browse files
authored
fix pgGraphqlQuery with concurent search path (#5537)
1 parent 5448512 commit 4e533bf

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

packages/twenty-server/src/engine/api/graphql/workspace-query-runner/workspace-query-runner.service.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,22 @@ export class WorkspaceQueryRunnerService {
583583
)};
584584
`);
585585

586-
const results = await workspaceDataSource?.query<PGGraphQLResult>(
587-
`SELECT graphql.resolve($1);`,
588-
[query],
589-
);
586+
return await workspaceDataSource?.transaction(
587+
async (transactionManager) => {
588+
await transactionManager.query(`
589+
SET search_path TO ${this.workspaceDataSourceService.getSchemaName(
590+
workspaceId,
591+
)};
592+
`);
590593

591-
return results;
594+
const results = transactionManager.query<PGGraphQLResult>(
595+
`SELECT graphql.resolve($1);`,
596+
[query],
597+
);
598+
599+
return results;
600+
},
601+
);
592602
}
593603

594604
private async parseResult<Result>(

0 commit comments

Comments
 (0)