Skip to content

Commit 94e3dfd

Browse files
authored
Reduce logging for SQL exceptions from queries with calculated columns (#1840)
### version 6.58.5 *Released*: 14 August 2025 - Issue 52026 and 51862: Reduce the logging for calculated expression column SQL errors - add comment tag to executeSql query to indicate it is from a calculated column validation - use string value compatible with CAST to NUMERIC for parseCalculatedColumn() temp data
1 parent 80dd611 commit 94e3dfd

6 files changed

Lines changed: 19 additions & 11 deletions

File tree

packages/components/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@labkey/components",
3-
"version": "6.58.4",
3+
"version": "6.58.5",
44
"description": "Components, models, actions, and utility functions for LabKey applications and pages",
55
"sideEffects": false,
66
"files": [

packages/components/releaseNotes/components.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# @labkey/components
22
Components, models, actions, and utility functions for LabKey applications and pages
33

4+
### version 6.58.5
5+
*Released*: 14 August 2025
6+
- Issue 52026 and 51862: Reduce the logging for calculated expression column SQL errors
7+
- add comment tag to executeSql query to indicate it is from a calculated column validation
8+
- use string value compatible with CAST to NUMERIC for parseCalculatedColumn() temp data
9+
410
### version 6.58.4
511
*Released*: 12 August 2025
612
- Adding new parent alias on designer doesn't always add to the bottom of the list

packages/components/src/internal/components/domainproperties/actions.test.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,17 +867,15 @@ describe('domain properties actions', () => {
867867
expect(getCastStatement('key', 'VISITDATE')).toBe('CAST(CURDATE() AS TIMESTAMP) AS "key"');
868868
expect(getCastStatement('key', 'DATE')).toBe('CAST(CURDATE() AS DATE) AS "key"');
869869
expect(getCastStatement('key', 'TIME')).toBe('CAST(\'13:00\' AS TIME) AS "key"');
870-
expect(getCastStatement('key', 'TEXT')).toBe('CAST(\'Testing\' AS VARCHAR) AS "key"');
871-
expect(getCastStatement('key', 'OTHER')).toBe('CAST(\'Testing\' AS VARCHAR) AS "key"');
870+
expect(getCastStatement('key', 'TEXT')).toBe('CAST(\'1\' AS VARCHAR) AS "key"');
871+
expect(getCastStatement('key', 'OTHER')).toBe('CAST(\'1\' AS VARCHAR) AS "key"');
872872
});
873873

874874
// Issue 52608
875875
test('getCastStatement for special char field', () => {
876-
expect(getCastStatement('a"key" with quotes', 'TEXT')).toBe(
877-
'CAST(\'Testing\' AS VARCHAR) AS "a""key"" with quotes"'
878-
);
876+
expect(getCastStatement('a"key" with quotes', 'TEXT')).toBe('CAST(\'1\' AS VARCHAR) AS "a""key"" with quotes"');
879877
expect(getCastStatement('a,./key with!@#$specCHARS', 'TEXT')).toBe(
880-
'CAST(\'Testing\' AS VARCHAR) AS "a,./key with!@#$specCHARS"'
878+
'CAST(\'1\' AS VARCHAR) AS "a,./key with!@#$specCHARS"'
881879
);
882880
});
883881

packages/components/src/internal/components/domainproperties/actions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import { IImportAlias } from '../entities/models';
4949
import { DATA_CLASS_IMPORT_PREFIX, SAMPLE_SET_IMPORT_PREFIX } from '../entities/constants';
5050

5151
import {
52+
CALCULATED_COLUMN_SQL_TAG,
5253
DOMAIN_ERROR_ID,
5354
DOMAIN_FIELD_CLIENT_SIDE_ERROR,
5455
DOMAIN_FIELD_LOOKUP_CONTAINER,
@@ -442,7 +443,7 @@ export function getCastStatement(key: string, type: string): string {
442443
case 'TIME':
443444
return `CAST('13:00' AS TIME) AS "${quotedKey}"`;
444445
default:
445-
return `CAST('Testing' AS VARCHAR) AS "${quotedKey}"`;
446+
return `CAST('1' AS VARCHAR) AS "${quotedKey}"`;
446447
}
447448
}
448449

@@ -465,7 +466,8 @@ export async function parseCalculatedColumn(
465466
.map(key => getCastStatement(key, columnMap[key]))
466467
.join(',\n') +
467468
') AS x' +
468-
' WHERE 1=0';
469+
' WHERE 1=0' +
470+
CALCULATED_COLUMN_SQL_TAG; // Issue 52026 and 51862
469471

470472
await executeSql({
471473
schemaName: 'core',

packages/components/src/internal/components/domainproperties/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,3 +230,5 @@ export const MAX_VALID_TEXT_CHOICES = 200;
230230
export const LOOKUP_VALIDATOR_VALUES = { type: 'Lookup', name: 'Lookup Validator' };
231231

232232
export const DOMAIN_ERROR_ID = 'domain-error';
233+
234+
export const CALCULATED_COLUMN_SQL_TAG = '/* CALCULATED-EXPRESSION-COLUMN-QUERY */';

0 commit comments

Comments
 (0)