Commit 0720763d authored by Stan Hu's avatar Stan Hu

Update pg_query to v2.1.1

We disabled GC due in pg_query to work around
https://github.com/pganalyze/pg_query/issues/226, but this turned out to
be a bug where the Ruby garbage collector might incorrectly garbage
collect an intermediate variable
(https://bugs.ruby-lang.org/issues/18140#note-2).

https://github.com/pganalyze/pg_query/pull/227 works around the problem
by calling to_ary to ensure the Ruby interpreter does not do this. As a
result, we can remove the workaround.
parent 1ec7ca07
......@@ -907,7 +907,7 @@ GEM
peek (1.1.0)
railties (>= 4.0.0)
pg (1.2.3)
pg_query (2.1.0)
pg_query (2.1.1)
google-protobuf (>= 3.17.1)
plist (3.6.0)
png_quantizator (0.2.1)
......
......@@ -81,15 +81,8 @@ module Database
# PgQuery might fail in some cases due to limited nesting:
# https://github.com/pganalyze/pg_query/issues/209
#
# Also, we disable GC while parsing because of https://github.com/pganalyze/pg_query/issues/226
begin
GC.disable
parsed_query = PgQuery.parse(sql)
tables = sql.downcase.include?(' for update') ? parsed_query.tables : parsed_query.dml_tables
ensure
GC.enable
end
parsed_query = PgQuery.parse(sql)
tables = sql.downcase.include?(' for update') ? parsed_query.tables : parsed_query.dml_tables
return if tables.empty?
......
......@@ -33,14 +33,7 @@ module Database
# PgQuery might fail in some cases due to limited nesting:
# https://github.com/pganalyze/pg_query/issues/209
#
# Also, we disable GC while parsing because of https://github.com/pganalyze/pg_query/issues/226
begin
GC.disable
tables = PgQuery.parse(sql).tables
ensure
GC.enable
end
tables = PgQuery.parse(sql).tables
schemas = Database::GitlabSchema.table_schemas(tables)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment