Skip to content

Instantly share code, notes, and snippets.

View yahonda's full-sized avatar

Yasuo Honda yahonda

View GitHub Profile
  • Run non prepared statement using psql
$ bin/psql -d test
psql (17devel)
Type "help" for help.

test=# \d
                 List of relations
 Schema |         Name         |   Type   |  Owner
#!/usr/bin/env ruby

require 'pg'

# Output a table of current connections to the DB
conn = PG.connect( dbname: 'test' )
conn.exec('DROP TABLE IF EXISTS posts')
  • active_record2_non_prepared.rb that disables prepared statement prepared_statements: false
# frozen_string_literal: true

require "bundler/inline"

gemfile(true) do
  source ""

  git_source(:github) { |repo| "{repo}.git" }
yahonda /
Last active April 4, 2024 23:25
Test pg_stat_statements and "IN" conditions patches

This entry shows the test result of

Steps to reproduce

  1. Download these 4 patch files
$ wget
$ wget
$ wget
yahonda / gist:7f5ee2861ecce0cdfcb422ef8735838a
Last active February 1, 2024 02:52
Rails CI using Ruby master branch

RailsのRuby masterブランチでのCIについて複数回聞かれたのでメモしておきます。

Rails 7.2で予定される変化

Rails CIとRubyバージョン

  • macOS Software Update
  • Install Xcode
  • git config --global "Your Real Name" git config --global
  • Connecting to GitHub with SSH
  • ulimit -n 10240 in ~/.zshrc or whatever
  • Install Homebrew /bin/bash -c "$(curl -fsSL"
  • Install libyaml for Ruby 3.2 brew install libyaml
  • Install Ruby 3.2
  • git clone
git grep 'require "observer"'
git grep 'require "drb"'
git grep 'require "abbrev"'
git grep 'require "observer"'
git grep 'require "getoptlong"'
tiup playground nightly
ssh -L -N
mysql --comments --host --port 4000 -u root
CREATE USER 'rails'@'localhost';
GRANT ALL PRIVILEGES ON activerecord_unittest.*
% bundle exec rake test_mysql2
/Users/yahonda/.rbenv/versions/3.2.2/bin/ruby -w -I"lib:test" /Users/yahonda/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/rake-13.0.6/lib/rake/rake_test_loader.rb "test/cases/active_record_schema_test.rb" "test/cases/adapter_prevent_writes_test.rb" "test/cases/adapter_test.rb" "test/cases/aggregations_test.rb" "test/cases/annotate_test.rb" "test/cases/arel/attributes/attribute_test.rb" "test/cases/arel/attributes/math_test.rb" "test/cases/arel/attributes_test.rb" "test/cases/arel/collectors/bind_test.rb" "test/cases/arel/collectors/composite_test.rb" "test/cases/arel/collectors/sql_string_test.rb" "test/cases/arel/collectors/substitute_bind_collector_test.rb" "test/cases/arel/crud_test.rb" "test/cases/arel/delete_manager_test.rb" "test/cases/arel/factory_methods_test.rb" "test/cases/arel/insert_manager_test.rb" "test/cases/arel/nodes/and_test.rb" "test/cases/arel/nodes/as_test.rb" "test/cases/arel/nodes/ascending_test.rb" "test/cases/arel/nodes/bin_test.rb" "test/cases/arel/no
$ RUBY_IMAGE=ruby:3.2 docker-compose -f .buildkite/docker-compose.yml build base && CI=1 docker-compose -f .buildkite/docker-compose.yml run -e PRE_STEPS -e RACK --rm actionview runner actionview 'rake test:ujs'
Building base
Sending build context to Docker daemon 1.716GB
Step 1/22 : ARG RUBY_IMAGE
Step 2/22 : FROM ${RUBY_IMAGE:-ruby:latest}
3.2: Pulling from library/ruby
bba7bb10d5ba: Pull complete
ec2b820b8e87: Pull complete
284f2345db05: Pull complete
fea23129f080: Pull complete