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 "https://rubygems.org"

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

This entry shows the test result of https://www.postgresql.org/message-id/flat/CA%2Bq6zcWtUbT_Sxj0V6HY6EZ89uv5wuG5aefpe_9n0Jr3VwntFg%40mail.gmail.com

Steps to reproduce

  1. Download these 4 patch files
$ wget https://www.postgresql.org/message-id/attachment/154675/v18-0001-Prevent-jumbling-of-every-element-in-ArrayExpr.patch
$ wget https://www.postgresql.org/message-id/attachment/154676/v18-0002-Reusable-decimalLength-functions.patch
$ wget https://www.postgresql.org/message-id/attachment/154677/v18-0003-Merge-constants-in-ArrayExpr-into-groups.patch
@yahonda
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 user.name "Your Real Name" git config --global user.email me@example.com
  • Connecting to GitHub with SSH
  • ulimit -n 10240 in ~/.zshrc or whatever
  • Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • Install libyaml for Ruby 3.2 brew install libyaml
  • Install Ruby 3.2
  • git clone git@github.com:rails/rails.git
mutex_m
drb
base64
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 127.0.0.1:3306127.0.0.1:4000 -N 127.0.0.1
mysql --comments --host 127.0.0.1 --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