Skip to content

Commit 7551df9

Browse files
authored
Omit .* regex filter (#19470)
* Omit .* regex filter * Changelog * Changelog * Stub filter
1 parent ffeb442 commit 7551df9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

postgres/changelog.d/19470.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Omit .* regex filter to avoid unnecessary work in query

postgres/datadog_checks/postgres/relationsmanager.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,11 @@ def filter_relation_query(self, query, schema_field):
408408
relation_filter = []
409409
if r.get(RELATION_NAME):
410410
relation_filter.append("( relname = '{}'".format(r[RELATION_NAME]))
411-
elif r.get(RELATION_REGEX):
411+
elif r.get(RELATION_REGEX) and r.get(RELATION_REGEX) != ".*":
412412
relation_filter.append("( relname ~ '{}'".format(r[RELATION_REGEX]))
413+
else:
414+
# Stub filter to allow for appending
415+
relation_filter.append("( 1=1")
413416

414417
if ALL_SCHEMAS not in r[SCHEMAS]:
415418
schema_filter = ','.join("'{}'".format(s) for s in r[SCHEMAS])

0 commit comments

Comments
 (0)