Skip to content

fix: exclude aggregates and window functions from search path lint#148

Open
oniani1 wants to merge 1 commit intosupabase:mainfrom
oniani1:fix/exclude-aggregates-from-search-path-lint
Open

fix: exclude aggregates and window functions from search path lint#148
oniani1 wants to merge 1 commit intosupabase:mainfrom
oniani1:fix/exclude-aggregates-from-search-path-lint

Conversation

@oniani1
Copy link
Copy Markdown

@oniani1 oniani1 commented Mar 23, 2026

Fixes #139

The function_search_path_mutable lint queries pg_proc without filtering on prokind, so it flags aggregate and window functions. These can't have search_path configured -- PostgreSQL rejects it:

ALTER FUNCTION public.mysum(integer) SET search_path = '';
ERROR:  "public.mysum" is an aggregate function

This adds p.prokind not in ('a', 'w') to exclude aggregates and window functions from the lint.

Changes:

  • lints/0011_function_search_path_mutable.sql -- filter on prokind
  • splinter.sql -- same
  • test/sql/0011_function_search_path_mutable.sql -- test case creating an aggregate, verifying it's not flagged
  • test/expected/0011_function_search_path_mutable.out -- expected output

The function_search_path_mutable lint flags aggregates and window
functions even though PostgreSQL rejects setting search_path on them.
Filter these out via prokind.

Fixes supabase#139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid function_search_path_mutable lint warning for aggregates

1 participant