Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/grammar/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 12 additions & 0 deletions tests/autocomplete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"] })
})
Expand Down
Loading