From f2dc06df877ce2f6f1c3f32470205de17f1195f8 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Fri, 10 Jul 2026 09:06:07 +0100 Subject: [PATCH 1/3] Only throw enum tables error if enum table is in exposed schema --- .../src/plugins/PgEnumTablesPlugin.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/graphile-build/graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts b/graphile-build/graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts index fb41bcbe7b..7e20db0a16 100644 --- a/graphile-build/graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts +++ b/graphile-build/graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts @@ -223,7 +223,7 @@ export const PgEnumTablesPlugin: GraphileConfig.Plugin = { * error caused by the statement above failing. */ } - throw new Error(`Introspection could not read from enum table "${ + const message = `Introspection could not read from enum table "${ pgClass.getNamespace()!.nspname }"."${pgClass.relname}", perhaps you need to grant access: GRANT USAGE ON SCHEMA "${pgClass.getNamespace()!.nspname}" TO "${role}"; @@ -231,7 +231,15 @@ export const PgEnumTablesPlugin: GraphileConfig.Plugin = { pgClass.relname }" TO "${role}"; Original error: ${e.message} -`); +`; + // Throw error if this enum table is in an exposed schema, otherwise just warn. + if ( + pgService?.schemas?.includes(pgClass.getNamespace()?.nspname ?? "") + ) { + throw new Error(message); + } else { + console.warn(message); + } } }, async processIntrospection(info, event) { From 4b5b6730748c75a9a94502d933eeb2eae6c8504c Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Fri, 10 Jul 2026 09:08:13 +0100 Subject: [PATCH 2/3] docs(changeset): PostGraphile will only throw an error when it fails to read enum table values from a table in a published schema (one in the `schemas` list in your pgServices); enum tables in other schemas will result in a warning instead (since during the gather phase we don't know whether or not they will be needed come schema build time). --- .changeset/modern-sloths-pick.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .changeset/modern-sloths-pick.md diff --git a/.changeset/modern-sloths-pick.md b/.changeset/modern-sloths-pick.md new file mode 100644 index 0000000000..b9b4bb34f6 --- /dev/null +++ b/.changeset/modern-sloths-pick.md @@ -0,0 +1,10 @@ +--- +"graphile-build-pg": patch +"postgraphile": patch +--- + +PostGraphile will only throw an error when it fails to read enum table values +from a table in a published schema (one in the `schemas` list in your +pgServices); enum tables in other schemas will result in a warning instead +(since during the gather phase we don't know whether or not they will be needed +come schema build time). From 0fff1168bd3bb56384cd969e52eca9734141fe78 Mon Sep 17 00:00:00 2001 From: Benjie Gillam Date: Fri, 10 Jul 2026 09:23:29 +0100 Subject: [PATCH 3/3] Oops, forgot the return value --- .../graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/graphile-build/graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts b/graphile-build/graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts index 7e20db0a16..9818688521 100644 --- a/graphile-build/graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts +++ b/graphile-build/graphile-build-pg/src/plugins/PgEnumTablesPlugin.ts @@ -239,6 +239,7 @@ Original error: ${e.message} throw new Error(message); } else { console.warn(message); + return []; } } },