diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.ts index 62a1e6ae29..e485023849 100644 --- a/packages/nocodb/src/services/columns.service.ts +++ b/packages/nocodb/src/services/columns.service.ts @@ -124,6 +124,11 @@ export class ColumnsService { param.column.column_name = sanitizeColumnName(param.column.column_name); } + // trim leading and trailing spaces from column title as knex trim them by default + if (param.column.title) { + param.column.title = param.column.title.trim(); + } + if (param.column.column_name) { // - 5 is a buffer for suffix let colName = param.column.column_name.slice(0, mxColumnLength - 5); @@ -1068,6 +1073,11 @@ export class ColumnsService { param.column.column_name = sanitizeColumnName(param.column.column_name); } + // trim leading and trailing spaces from column title as knex trim them by default + if (param.column.title) { + param.column.title = param.column.title.trim(); + } + if (param.column.column_name) { // - 5 is a buffer for suffix let colName = param.column.column_name.slice(0, mxColumnLength - 5);