From 44900bfabe6ce0ba70ff373aefe4ab205e769237 Mon Sep 17 00:00:00 2001 From: Sarath Date: Wed, 15 Jul 2020 16:48:37 +0530 Subject: [PATCH 1/2] Fix insertTableNameQuotesRegex to support hyphen in dbname Signed-off-by: Sarath --- postgres/postgres.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres/postgres.go b/postgres/postgres.go index 80ca64f..0c3f387 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -98,7 +98,7 @@ func Load() { func init() { removeOperatorRegex = regexp.MustCompile(`\$[a-z]+.`) insertTableNameRegex = regexp.MustCompile(`(?i)INTO\s+([\w|\.]*\.)*(\w+)\s*\(`) - insertTableNameQuotesRegex = regexp.MustCompile(`(?i)INTO\s+([\w|\.|"]*\.)*"(\w+)"\s*\(`) + insertTableNameQuotesRegex = regexp.MustCompile(`(?i)INTO\s+([\w|\.|"|-]*\.)*"([\w|-]+)"\s*\(`) groupRegex = regexp.MustCompile(`\"(.+?)\"`) } From bc0ea48752f8bb2edded8ef1f88f59e52df357ae Mon Sep 17 00:00:00 2001 From: Sarath Date: Wed, 15 Jul 2020 17:17:05 +0530 Subject: [PATCH 2/2] Fix insertTableNameRegex to support hyphen in dbname Signed-off-by: Sarath --- postgres/postgres.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/postgres/postgres.go b/postgres/postgres.go index 0c3f387..58e56ee 100644 --- a/postgres/postgres.go +++ b/postgres/postgres.go @@ -97,7 +97,7 @@ func Load() { func init() { removeOperatorRegex = regexp.MustCompile(`\$[a-z]+.`) - insertTableNameRegex = regexp.MustCompile(`(?i)INTO\s+([\w|\.]*\.)*(\w+)\s*\(`) + insertTableNameRegex = regexp.MustCompile(`(?i)INTO\s+([\w|\.|-]*\.)*([\w|-]+)\s*\(`) insertTableNameQuotesRegex = regexp.MustCompile(`(?i)INTO\s+([\w|\.|"|-]*\.)*"([\w|-]+)"\s*\(`) groupRegex = regexp.MustCompile(`\"(.+?)\"`) }