Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

address reviews

Andrey3c4fca809474
diff --git a/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-connection-controller.ts b/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-connection-controller.ts
index e104f5ac69..1b5a37ed9c 100644
--- a/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-connection-controller.ts
+++ b/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-connection-controller.ts
@@ -106,6 +106,7 @@ export const createClickhouseConnectionController = async (
abort_signal: abortController.signal,
clickhouse_settings: {
default_format: "JSONCompact",
+ max_execution_time: 30,
max_result_rows: String(MAX_ROWS + 1),
result_overflow_mode: "break",
wait_end_of_query: 1
diff --git a/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-data-explorer-fns.test.ts b/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-data-explorer-fns.test.ts
index dfa4c8f18f..1b1f5452c2 100644
--- a/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-data-explorer-fns.test.ts
+++ b/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-data-explorer-fns.test.ts
@@ -189,13 +189,8 @@ describe("parseStatementBody", () => {
expect(result.isTruncated).toBe(true);
});
- test("output in a format it cannot read is handed back verbatim", () => {
- expect(parseStatementBody("1\tone\n2\ttwo\n")).toEqual({
- rows: [{ result: "1\tone\n2\ttwo\n" }],
- fields: [{ name: "result" }],
- rowCount: null,
- isTruncated: false
- });
+ test("output the grid cannot lay out fails with a reason", () => {
+ expect(() => parseStatementBody("1\tone\n2\ttwo\n")).toThrow(/FORMAT clause/);
});
test("a composite column arrives as text rather than an object", () => {
diff --git a/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-data-explorer-fns.ts b/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-data-explorer-fns.ts
index 78a7aa609d..8c4b2ad1c8 100644
--- a/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-data-explorer-fns.ts
+++ b/backend/src/ee/services/pam-web-access/clickhouse/pam-clickhouse-data-explorer-fns.ts
@@ -167,13 +167,11 @@ export const parseStatementBody = (body: string, summary?: { written_rows: strin
parsed = null;
}
+ // A FORMAT clause overrides the default and produces output the grid cannot lay out
if (!parsed || !Array.isArray(parsed.meta) || !Array.isArray(parsed.data)) {
- return {
- rows: [{ result: body }],
- fields: [{ name: "result" }],
- rowCount: null,
- isTruncated: false
- };
+ throw new Error(
+ "This statement returned a format the explorer can't display as a grid. Remove the FORMAT clause, or use the CLI to read the output as it is."
+ );
}
const fieldNames = uniqueFieldNames(parsed.meta.map((column) => column.name));
diff --git a/docs/documentation/platform/pam/accounts/clickhouse.mdx b/docs/documentation/platform/pam/accounts/clickhouse.mdx
index a44b4e68bd..70ab324546 100644
--- a/docs/documentation/platform/pam/accounts/clickhouse.mdx
+++ b/docs/documentation/platform/pam/accounts/clickhouse.mdx
@@ -98,7 +98,7 @@ Command blocking matches the text of each statement, so a statement that builds
</Tab>
</Tabs>
-The Data Explorer shows the first 1,000 rows a statement produces and tells you when there are more. ClickHouse itself imposes no such limit; use the CLI with your own client to work with a full result set.
+The Data Explorer shows the first 1,000 rows a statement produces and tells you when there are more, and caps a statement at 30 seconds. Neither limit applies to the CLI, so use it with your own client for a long query or a full result set.
<Note>
ClickHouse applies row changes as asynchronous mutations rather than as statements that take effect when they return, so the Data Explorer grid is read-only for every table. Run `ALTER TABLE ... UPDATE` or `DELETE FROM` from the SQL Editor instead. The column marked as a key in the grid is the table's sorting key, which ClickHouse calls the primary key: it's an index, not a unique constraint.