Skip to content

Commit 122adb7

Browse files
committed
fix: allow to use reserved words for column names for the postgres
https://web.tracklify.com/project/2b7ZVgE5/AdminForth/1189/VzsoHD4B/minmax-does-not-work-(pg)-17:4
1 parent 13147d3 commit 122adb7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adminforth/dataConnectors/postgres.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ class PostgresConnector extends AdminForthBaseConnector implements IAdminForthDa
385385
const tableName = resource.table;
386386
const result = {};
387387
await Promise.all(columns.map(async (col) => {
388-
const q = `SELECT MIN(${col.name}) as min, MAX(${col.name}) as max FROM "${tableName}"`;
388+
const q = `SELECT MIN("${col.name}") as min, MAX("${col.name}") as max FROM "${tableName}"`;
389389
dbLogger.trace(`🪲📜 PG Q: ${q}`);
390390
const stmt = await this.client.query(q);
391391
const { min, max } = stmt.rows[0];

0 commit comments

Comments
 (0)