Skip to content

Commit

Permalink
Handle empty statement in psycopg instrumentation
Browse files Browse the repository at this point in the history
Fixes #2643
  • Loading branch information
Holi0317 authored Jun 28, 2024
1 parent 58a6d3a commit d1ec928
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ def get_operation_name(self, cursor, args):
if isinstance(statement, Composed):
statement = statement.as_string(cursor)

if isinstance(statement, str):
# `statement` can be empty string. See #2643
if isinstance(statement, str) and statement != "":
# Strip leading comments so we get the operation name.
return self._leading_comment_remover.sub("", statement).split()[0]

Expand Down

0 comments on commit d1ec928

Please sign in to comment.