From b715f6d1be7dd19e39830b4329fa3c758e5ae91b Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Wed, 12 May 2021 15:04:00 +0100 Subject: [PATCH] fix: uniqueKey/pgViewUniqueKey applies to views (#739) --- packages/graphile-build-pg/src/plugins/PgAllRows.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/graphile-build-pg/src/plugins/PgAllRows.js b/packages/graphile-build-pg/src/plugins/PgAllRows.js index fa10c9e37..80ba0b87f 100644 --- a/packages/graphile-build-pg/src/plugins/PgAllRows.js +++ b/packages/graphile-build-pg/src/plugins/PgAllRows.js @@ -64,7 +64,7 @@ export default (async function PgAllRows( const uniqueIdAttribute = viewUniqueKey ? attributes.find(attr => attr.name === viewUniqueKey) : undefined; - if (isView && table.tags.uniqueKey && !uniqueIdAttribute) { + if (isView(table) && table.tags.uniqueKey && !uniqueIdAttribute) { throw new Error( `Could not find the named unique key '${table.tags.uniqueKey}' on view '${table.namespaceName}.${table.name}'` );