I want to be able to take an array of numbers and turn it into rows so I 
can join with something else.

So SOmething like db.from(Sequel.function(:UNNEST, Sequel.function(::ARRAY, 
[1,2,3])).as(:id_table))

Something like that



On Thursday, February 4, 2021 at 8:01:40 AM UTC-8 Jeremy Evans wrote:

> On Wed, Feb 3, 2021 at 4:10 PM [email protected] <[email protected]> 
> wrote:
>
>> Hey Jeremy,
>>
>> I think I'm missing something here:
>>
>>
>> https://sequel.jeremyevans.net/rdoc-plugins/classes/Sequel/Postgres/ArrayOp.html
>>
>> I did:
>> array_op =  Sequel.pg_array_op :ARRAY
>>
>> ```ruby
>>
>> [24] pry(main)> User.where(1=>array_op[2])
>>
>> => #<Sequel::Postgres::Dataset: "SELECT \"users\".* FROM \"users\" WHERE 
>> (1 = (\"array\")[2])">
>> ```
>>
>> Seems like "array" is always getting escaped as if it were a column. 
>>
>
> It's treating it as an identifier, which is expected since you are using a 
> symbol, and Ruby symbols represent SQL identifiers in Sequel.  The 
> documentation seems to match this, except that the documentation isn't 
> quoting the identifiers, mostly to make the examples easier to read.
>
> What SQL do you want to generate?
>
> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/9f583c6f-d7ce-4404-8c7a-c4a0c280688dn%40googlegroups.com.

Reply via email to