I have a table with the composite primary key, the migration file 
(fragment) looks like this (sequel 4.1.1/postgres 9.1):

      String :ticker
      column :time, 'timestamp with time zone'
      column :parent_time, 'timestamp with time zone'
      Integer :timescale, :null=>false  
      primary_key [:ticker,:timescale,:time]
      foreign_key [:ticker,:timescale,:parent_time], :monitor_vals, :key=>
      [:ticker,:timescale,:time], :on_delete=>:cascade, :on_update=>:cascade

In my model file I set the rcte_tree plugin up like this:

     plugin :rcte_tree, :key=>[:ticker,:timescale,:parent_time], 
     :primary_key=> [:ticker,:timescale,:time]

The model responds to 'children' method and produces sql like this:

     #<Sequel::Postgres::Dataset: "SELECT * FROM \"monitor_vals\" WHERE
     ((\"monitor_vals\".\"ticker\" = 'RFe2') AND 
(\"monitor_vals\".\"timescale\" = 1440) 
     AND (\"monitor_vals\".\"parent_time\" = '2013-06-21 
00:00:00.000000+0000'))">

But when I try recursive queries (<model>.descendants, for example), it 
produces the error:

    TypeError: [:ticker, :timescale, :time] is not a symbol

I can see that on line 227 in rcte_tree plugin file there is an attempt to 
send(prkey) which in my case is given as an Array. 
Maybe I should specify :key and :primary_key as symbols, but I don't know 
how to do that with composite keys.

Can you give an example how to set up rcte_tree plugin with composite keys?

Thanks for your help. 

-- 
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 http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to