summaryrefslogtreecommitdiff
path: root/spec/support/database/prevent_cross_joins.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/database/prevent_cross_joins.rb')
-rw-r--r--spec/support/database/prevent_cross_joins.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/spec/support/database/prevent_cross_joins.rb b/spec/support/database/prevent_cross_joins.rb
index e69374fbc70..42c69a26788 100644
--- a/spec/support/database/prevent_cross_joins.rb
+++ b/spec/support/database/prevent_cross_joins.rb
@@ -31,9 +31,13 @@ module Database
# See https://gitlab.com/gitlab-org/gitlab/-/issues/339396
return if sql.include?("DISABLE TRIGGER") || sql.include?("ENABLE TRIGGER")
- # PgQuery might fail in some cases due to limited nesting:
- # https://github.com/pganalyze/pg_query/issues/209
- tables = PgQuery.parse(sql).tables
+ tables = begin
+ PgQuery.parse(sql).tables
+ rescue PgQuery::ParseError
+ # PgQuery might fail in some cases due to limited nesting:
+ # https://github.com/pganalyze/pg_query/issues/209
+ return
+ end
schemas = ::Gitlab::Database::GitlabSchema.table_schemas(tables)