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 ...@@ -907,7 +907,7 @@ GEM
peek (1.1.0) peek (1.1.0)
railties (>= 4.0.0) railties (>= 4.0.0)
pg (1.2.3) pg (1.2.3)
pg_query (2.1.0) pg_query (2.1.1)
google-protobuf (>= 3.17.1) google-protobuf (>= 3.17.1)
plist (3.6.0) plist (3.6.0)
png_quantizator (0.2.1) png_quantizator (0.2.1)
......
...@@ -81,15 +81,8 @@ module Database ...@@ -81,15 +81,8 @@ module Database
# PgQuery might fail in some cases due to limited nesting: # PgQuery might fail in some cases due to limited nesting:
# https://github.com/pganalyze/pg_query/issues/209 # https://github.com/pganalyze/pg_query/issues/209
# parsed_query = PgQuery.parse(sql)
# Also, we disable GC while parsing because of https://github.com/pganalyze/pg_query/issues/226 tables = sql.downcase.include?(' for update') ? parsed_query.tables : parsed_query.dml_tables
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
return if tables.empty? return if tables.empty?
......
...@@ -33,14 +33,7 @@ module Database ...@@ -33,14 +33,7 @@ module Database
# PgQuery might fail in some cases due to limited nesting: # PgQuery might fail in some cases due to limited nesting:
# https://github.com/pganalyze/pg_query/issues/209 # https://github.com/pganalyze/pg_query/issues/209
# tables = PgQuery.parse(sql).tables
# 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
schemas = Database::GitlabSchema.table_schemas(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