Skip to content

Commit

Permalink
Change severity of CREATE OR REPLACE FUNCTION
Browse files Browse the repository at this point in the history
This patch changes the severity of CREATE OR REPLACE FUNCTION
from error to warning as it is not exploitable in an extension script
context.
  • Loading branch information
svenklemm committed Aug 17, 2024
1 parent 4117fe9 commit e4411d3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pgspot/visitors.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def visit_CreateFunctionStmt(self, ancestors, node):
elif format_function(node) in self.state.created_functions:
pass
elif node.replace:
self.state.error("PS002", format_function(node))
self.state.warn("PS002", format_function(node))

# keep track of functions created in this script in case they get replaced later
if not node.replace:
Expand Down
2 changes: 1 addition & 1 deletion testdata/expected/createfunc.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ PS005: Function without explicit search_path: safe16() at line 15
PS016: Unqualified function call: unsafe_call18 at line 15
PS002: Unsafe function creation: f22(b integer) at line 26

Errors: 3 Warnings: 10 Unknown: 0
Errors: 0 Warnings: 13 Unknown: 0

2 changes: 1 addition & 1 deletion testdata/expected/replace.out
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ PS006: Unsafe transform creation: type6 at line 6
PS015: Unsafe view creation: view9 at line 7
PS017: Unqualified object reference: view9 at line 7

Errors: 4 Warnings: 5 Unknown: 0
Errors: 2 Warnings: 7 Unknown: 0

0 comments on commit e4411d3

Please sign in to comment.