Skip to content

Commit f076f9f

Browse files
committed
fix(projcets.ts): fixed greptile issues
1 parent 3a45993 commit f076f9f

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/storage/adapter/clickhouse/handlers/queryEvents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ async function handleListQuery(
263263
);
264264
let q = `SELECT ${buildSelectColumns(t)} FROM ${t}`;
265265
q += ` WHERE project_id = {projectId:String}`;
266-
if (whereClause) q += ` AND ${whereClause}`;
266+
if (whereClause) q += ` AND (${whereClause})`;
267267
return q;
268268
});
269269

@@ -344,7 +344,7 @@ async function handleAggregationQuery(
344344
);
345345
let q = `SELECT ${cols.join(", ")} FROM ${t}`;
346346
q += ` WHERE project_id = {projectId:String}`;
347-
if (whereClause) q += ` AND ${whereClause}`;
347+
if (whereClause) q += ` AND (${whereClause})`;
348348
return q;
349349
});
350350

@@ -399,7 +399,7 @@ async function getTotalCount(
399399
);
400400
let q = `SELECT count() as cnt FROM ${t}`;
401401
q += ` WHERE project_id = {projectId:String}`;
402-
if (whereClause) q += ` AND ${whereClause}`;
402+
if (whereClause) q += ` AND (${whereClause})`;
403403
return q;
404404
});
405405

src/storage/adapter/postgres/handlers/queryEvents.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ async function handleListQuery(
304304
const subqueries = tables.map((t, i) => {
305305
const base = sql`SELECT ${selectExpr[i]} FROM ${sql.raw(t)}`;
306306
const fullWhere = whereExpr[i]
307-
? sql`${whereExpr[i]} AND ${projectFilter}`
307+
? sql`(${whereExpr[i]}) AND ${projectFilter}`
308308
: projectFilter;
309309
return sql`${base} WHERE ${fullWhere}`;
310310
});
@@ -373,7 +373,7 @@ async function handleAggregationQuery(
373373
const whereClause = buildWhereClause(request.where, t);
374374
const base = sql`SELECT ${sql.join(cols, sql`, `)} FROM ${sql.raw(t)}`;
375375
const fullWhere = whereClause
376-
? sql`${whereClause} AND ${projectFilter}`
376+
? sql`(${whereClause}) AND ${projectFilter}`
377377
: projectFilter;
378378
return sql`${base} WHERE ${fullWhere}`;
379379
});
@@ -431,7 +431,7 @@ async function getTotalCount(
431431
const whereClause = buildWhereClause(request.where, t);
432432
const base = sql`SELECT count(*)::int as cnt FROM ${sql.raw(t)}`;
433433
const fullWhere = whereClause
434-
? sql`${whereClause} AND ${projectFilter}`
434+
? sql`(${whereClause}) AND ${projectFilter}`
435435
: projectFilter;
436436
return sql`${base} WHERE ${fullWhere}`;
437437
});

0 commit comments

Comments
 (0)