RangeError: more than 256 columns in query

Issue #201 closed
schneems
created an issue

I'm attempting to connect to a database in a Sinatra project (pliny https://github.com/interagent/pliny to be specific). This was previously working, but recently stopped.

I'm using version 4.18.0 of Sequel. I get an exception when running this code:

Sequel.extension :pg_hstore, :pg_hstore_ops
DB = Sequel.connect(ENV["DATABASE_URL"])

# => RangeError: more than 256 columns in query
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:636:in `yield_hash_rows'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:636:in `block in fetch_rows'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:150:in `execute'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:492:in `_execute'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:316:in `block (2 levels) in execute'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:513:in `check_database_errors'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:316:in `block in execute'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/database/connecting.rb:250:in `block in synchronize'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/connection_pool/threaded.rb:104:in `hold'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/database/connecting.rb:250:in `synchronize'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:316:in `execute'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/dataset/actions.rb:906:in `execute'
/Users/richardschneeman/.gem/ruby/2.2.0/gems/sequel-4.14.0/lib/sequel/adapters/postgres.rb:636:in `fetch_rows'

I did a bundle open and added a some logging puts, this is the sql call it is failing on:

"SELECT \"oid\", \"typname\" FROM \"pg_type\" WHERE ((\"typtype\" = 'b') AND (\"typname\" IN ('hstore')))"

This fails with PG 0.18.1 but passes with PG 0.17.1, not sure if this is a Sequel issue or a pg issue. Any ideas what's going on here?

Comments (8)

  1. Murty Korada

    Besides using the correct version of sequel_pg, one has to install the gem with DSPG_MAX_FIELDS option as mentioned at https://github.com/jeremyevans/sequel_pg

    gem install sequel_pg -- --with-cflags=\"-DSPG_MAX_FIELDS=512\"
    

    when using a Gemfile, bundle config needs to be set by running:

    bundle config build.sequel_pg -v 1.6.17 --with-cflags="-DSPG_MAX_FIELDS=512"
    
  2. Log in to comment