From 8652f142511cef14872353ec879365a5fd745c53 Mon Sep 17 00:00:00 2001 From: Thodoris Greasidis Date: Fri, 19 Apr 2024 16:57:55 +0300 Subject: [PATCH] Properly error when using fields of a partial index as an alternate key Update @balena/abstract-sql-compiler from 9.0.4 to 9.1.4 Change-type: patch --- package.json | 2 +- src/odata-to-abstract-sql.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 29d1b6c..46c4d0e 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "author": "", "license": "BSD", "dependencies": { - "@balena/abstract-sql-compiler": "^9.0.4", + "@balena/abstract-sql-compiler": "^9.1.4", "@balena/odata-parser": "^3.0.3", "@types/lodash": "^4.14.202", "@types/memoizee": "^0.4.11", diff --git a/src/odata-to-abstract-sql.ts b/src/odata-to-abstract-sql.ts index f182b72..b772531 100644 --- a/src/odata-to-abstract-sql.ts +++ b/src/odata-to-abstract-sql.ts @@ -790,7 +790,8 @@ export class OData2AbstractSQL { ) && !resource.indexes.some((index) => { return ( - (index.type === 'UNIQUE' || index.type === 'PRIMARY KEY') && + ((index.type === 'UNIQUE' && index.predicate == null) || + index.type === 'PRIMARY KEY') && sqlFieldNames.length === index.fields.length && _.isEqual(index.fields.slice().sort(), sqlFieldNames) );