And as is often is the case, figured it out just after posting I was loading the extension too late, when I moved that bit earlier, things Just Works.
Sorry for the noise. On Thu, Jan 5, 2017 at 4:54 PM, Simon Dahlbacka <[email protected]> wrote: > Hi, > > Sequel 4.42.0 > postgres > > > in my real app I have the following issue: the first time I run a query a > JSONB column containing [] > is returned as > > [1] pry(#<#<Class:0x1f1574c>::Stores::DB::CardStore>)> card[:labels].class > => Java::OrgPostgresqlUtil::PGobject > > on subsequent requests it is > > [1] pry(#<#<Class:0x1f1574c>::Stores::DB::CardStore>)> card[:labels].class > => Sequel::Postgres::JSONBArray > > Any idea why this might be? > > FWIW, tried to create a reproducing script (but failed...) > ``` > require 'sequel' > > Sequel.extension :pg_array > Sequel.extension :pg_json > Sequel.extension :pg_json_ops > > DB = Sequel.connect('jdbc:postgresql://localhost/cached_data') > > DB.create_table :test do > primary_key :id > Jsonb :labels > end > > DB[:test].insert(id: 1, labels: Sequel.pg_json([])) > > labels = DB[:test].first[:labels] > > puts "Type is : #{labels.class.inspect}" > > DB.drop_table :test > ``` > This always returns JSONBArray > > regards, > Simon > -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
