use double precision and brackets

This commit is contained in:
Charlie Kolb 2025-10-28 15:03:37 +01:00
parent 37c89f2438
commit cf81a92007
No known key found for this signature in database

View File

@ -390,7 +390,7 @@ export function resolvePath(
let base = `${ref}${toPostgresPath(pathArray)}`;
let type = 'text';
if (typeof value === 'number') {
type = 'numeric';
type = 'double precision';
} else if (value instanceof Date) {
type = 'timestamp';
} else if (typeof value === 'boolean') {
@ -403,8 +403,8 @@ export function resolvePath(
}
return `CASE
WHEN json_typeof(${base.replace('->>', '->')}) = '${type}'
THEN ${base.replace('->>', '->')}::${type}
WHEN json_typeof((${base.replace('->>', '->')})) = '${type}'
THEN (${base.replace('->>', '->')})::${type}
ELSE NULL
END`;
} else {