Files
ubicloud/Gemfile
Jeremy Evans 481383e572 Do not have query SQL vary based on number of array elements
SQL for queries using value lists (e.g. `column IN (value_list)`) varies
by the number of elements in the value list, because a separate placeholder
is generally used for each element in the value list.  You can get consistent
SQL by using the equivalent `column = ANY(array_expr::type[])`, which will
only use a single placeholder for the array expression.  This is useful if
you want to view/audit the queries that the application is generating.

Sequel has had a pg_auto_parameterize_in_array Database extension for
a while that handles most of this.  However, in the case where the
value list is Ruby strings, it is ambiguous what the type of the array
should be. Postgres use the unknown type, not the text type, when there
is not an explicit/implicit cast for a single quoted string. The
pg_auto_parameterize_in_array extension can assume the text[] type
in such cases, but it will break queries that need a different cast.
However, such breakage is explicit (DatabaseError raised), and not
silent, and can be fixed.  This affects queries where the column
values are plain strings in Ruby, but use a non-text database type,
such as the uuid type or an enum type.

This adds a couple singleton methods on Sequel, any_uuid and any_type,
which allow conversion of arrays (normally treated as value lists) to
an `ANY(array_expr::type[])` expression.  This converts the cases that
would fail with an explicit cast to text[] to use a uuid[] or
lb_node_state[] cast instead. This handles most of the explicit use
of `IN (value_list)`.

There is a significant amount of implicit `IN (value_list)`, because
that is what is used by default for eager loading.  This uses a new
pg_eager_any_typed_array plugin I developed to handle this case. This
will automatically use `column = ANY(array_expr::type[])`, using the
appropriate database type of the predicate key using for eager
loading.
2025-02-06 13:10:04 -08:00

87 lines
1.7 KiB
Ruby

# frozen_string_literal: true
source "https://rubygems.org"
ruby "3.2.6"
gem "argon2"
gem "committee"
gem "nokogiri"
gem "bcrypt_pbkdf"
gem "ed25519"
gem "net-ssh"
gem "netaddr"
gem "tilt", ">= 2.6"
gem "erubi", ">= 1.5"
gem "puma", ">= 6.2.2"
gem "roda", github: "jeremyevans/roda", ref: "7c51b9b50bc1ab9021c6ef23cd162fa26f6ecdea"
gem "rodauth", ">= 2.38"
gem "rotp"
gem "rqrcode"
gem "mail"
gem "shellwords"
gem "refrigerator", ">= 1"
gem "sequel", github: "jeremyevans/sequel", ref: "5336fb646a7736ce3c1f53ed954064d61e6bafe2"
gem "sequel_pg", ">= 1.8", require: "sequel"
gem "rack-unreloader", ">= 1.8"
gem "rake"
gem "warning"
gem "pry"
gem "excon"
gem "jwt"
gem "pagerduty", ">= 4.0"
gem "stripe"
gem "countries"
gem "octokit"
gem "argon2-kdf"
gem "rodauth-omniauth", github: "janko/rodauth-omniauth", ref: "477810179ba0cab8d459be1a0d87dca5b57ec94b"
gem "omniauth-github", "~> 2.0"
gem "omniauth-google-oauth2", "~> 1.2"
group :development do
gem "awesome_print"
gem "by", ">= 1.1.0"
gem "foreman"
gem "pry-byebug"
gem "rackup"
gem "cuprite"
end
group :rubocop do
gem "rubocop-capybara"
gem "rubocop-erb"
gem "rubocop-performance"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "rubocop-sequel"
gem "standard", ">= 1.24.3"
end
group :lint do
gem "erb-formatter", github: "ubicloud/erb-formatter", ref: "a9ff0001a1eb028e2186b222aeb02b07c04f9808"
gem "brakeman"
end
group :test do
gem "capybara"
gem "capybara-validate_html5", ">= 2"
gem "rspec"
gem "webmock"
gem "pdf-reader"
gem "turbo_tests"
gem "simplecov"
end
group :test, :development do
gem "sequel-annotate"
end
gem "webauthn", "~> 3.2"
gem "aws-sdk-s3", "~> 1.177"
gem "acme-client", "~> 2.0"
gem "prawn", "~> 2.5"
gem "prawn-table", "~> 0.2.2"