OK, so I'm now even more confused.  I am assuming that there is a direct 
way of asking for records whose hstore field has a single value.  Is this a 
correct assumption?  

I'm also looking at the methods 
here:  
http://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/pg_hstore_rb.html

It shows a .has_value? method, which is exactly what I'm looking for.  It 
seems I have to grab that whole dataset and perform a proc looking for the 
value.  

On Thursday, August 17, 2023 at 10:28:25 AM UTC-4 Jeremy Evans wrote:

> On Thu, Aug 17, 2023 at 3:11 AM bee...@gmail.com <bee...@gmail.com> wrote:
>
>> I'm wanting to find records whose stored hash has a value (eventually 
>> values).  Searching for keys works, but values doesn't:
>>
>> *res = 
>> htable.where(Sequel.hstore(:hstore_col).has_key?(keychoice)).select_map(:id)*
>>
>> While there is a method *has_value?(keychoice)*, it throws a 
>> *NoMethodError*.
>>
>>
>> *res = 
>> htable.where(Sequel.pg_store(:hstore_col).has_value?(valuechoice)).select_map(:id)*
>>
>> I am under the impression this is an iteration of keys or values, so it's 
>> confusing why it's wrong.
>>
>
> I think you are confusing the hstore with hstore_op.  
> Sequel.hstore(:hstore_col) returns an hstore_op. There is no has_value? on 
> hstore_op.  See 
> https://sequel.jeremyevans.net/rdoc-plugins/files/lib/sequel/extensions/pg_hstore_ops_rb.html
>  
> .  There doesn't appear to be a PostgreSQL function or oeprator that 
> has_value? could use, which is why the pg_hstore_ops extension doesn't 
> define such a method: https://www.postgresql.org/docs/current/hstore.html
>
> Thanks,
> Jeremy
>

-- 
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 sequel-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/90672be2-8771-492e-b8ad-720f6a9279f4n%40googlegroups.com.

Reply via email to