PG range insertion does not work with rom 5.1.1
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start by running the linked pg_range.rb reproduction with bundle exec ruby and compare the four range inputs and their errors. Read the PostgreSQL range handling around ROM::SQL::Postgres::Values::Range, then review related issue #286. Done means creating a record with a PostgreSQL range column works for the supported range values.
Written by the indexing model from the issue text.
Description
Creating record in table with pg range column does not work.
def try(name)
yield
puts "#{name} works"
rescue => e
puts "#{name} does not work"
puts e.message
ensure
puts
end
ruby_range = Range.new(Time.now, Time.now)
rom_range = ROM::SQL::Postgres::Values::Range.new(Time.now, Time.now)
sequel_range = Sequel::Postgres::PGRange.new(Time.now, Time.now)
custom_range = CustomRange.new(Time.now, Time.now)
try(:ruby_range) { pg_ranges.changeset(:create, range: ruby_range).commit }
try(:sequel_range) { pg_ranges.changeset(:create, range: sequel_range).commit }
try(:rom_range) { pg_ranges.changeset(:create, range: rom_range).commit }
try(:custom_range) { pg_ranges.changeset(:create, range: custom_range).commit }
Output:
$ bundle exec ruby pg_range.rb
ruby_range does not work
2019-08-15 19:37:25 +0300..2019-08-15 19:37:25 +0300 (Range) has invalid type for :range violates constraints (undefined method `exclude_begin?' for 2019-08-15 19:37:25 +0300..2019-08-15 19:37:25 +0300:Range
Did you mean? exclude_end? failed)
sequel_range does not work
#<Sequel::Postgres::PGRange:0x000055f59c094448 @begin=2019-08-15 19:37:25 +0300, @end=2019-08-15 19:37:25 +0300, @empty=false, @exclude_begin=false, @exclude_end=false, @db_type=nil> (Sequel::Postgres::PGRange) has invalid type for :range violates constraints (undefined method `lower' for #<Sequel::Postgres::PGRange:0x000055f59c094448> failed)
rom_range does not work
"[2019-08-15 19:37:25 +0300,2019-08-15 19:37:25 +0300)" (String) has invalid type for :range violates constraints (undefined method `exclude_begin?' for "[2019-08-15 19:37:25 +0300,2019-08-15 19:37:25 +0300)":String failed)
custom_range does not work
"[2019-08-15 19:37:25 +0300,2019-08-15 19:37:25 +0300]" (String) has invalid type for :range violates constraints (undefined method `exclude_begin?' for "[2019-08-15 19:37:25 +0300,2019-08-15 19:37:25 +0300]":String failed)
This issue may be related to #286 (ruby ranges not working), but with latest rom/dry updates even ROM::SQL::Postgres::Values::Range does not work.
- Dominant language
- Ruby
- Stars
- 220
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rom-rb/rom-sql
-
bug help wanted
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
bug help wanted
Difficulty 3/5 1-2 days Newbie friendliness 48/100
-
bug help wanted
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
bug help wanted
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
bug help wanted
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
バグ
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
voxpupuli/puppet-epel#186 · 1 comment ·
-
external_created_at is no longer used for the message timestamp since the new message UI (v4.4.0) OpenBug Frontend
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
TheOdinProject/curriculum#31402 · 1 comment ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100