diff --git a/src/grammar/functions.ts b/src/grammar/functions.ts index 646205b..77da0f4 100644 --- a/src/grammar/functions.ts +++ b/src/grammar/functions.ts @@ -307,6 +307,8 @@ export const windowFunctions: string[] = [ export const tableValuedFunctions: string[] = [ // CURSOR type — explicitly row-returning + "active_grants", + "active_permissions", "all_permissions", "backups", "generate_series", diff --git a/tests/autocomplete.test.ts b/tests/autocomplete.test.ts index 1500126..86d4117 100644 --- a/tests/autocomplete.test.ts +++ b/tests/autocomplete.test.ts @@ -4384,6 +4384,18 @@ describe("Position-typed suggestions — by statement type", () => { }) }) + it("FROM act| — active_permissions/active_grants suggested as table-valued", () => { + assertAtPosition("SELECT * FROM act", { + hasFunction: ["active_grants", "active_permissions"], + }) + }) + + it("SELECT act| — active_* NOT suggested in expression context", () => { + assertAtPosition("SELECT act", { + noFunction: ["active_grants", "active_permissions"], + }) + }) + it("SELECT b| — bar (scalar) suggested in expression context", () => { assertAtPosition("SELECT b", { hasFunction: ["bar"] }) })