On Friday, February 1, 2019 at 6:54:59 AM UTC-8, genc wrote:
>
> Hi Jeremy,
>
> On PostgreSQL there is a string_to_array function. This is currently What 
> I am doing:
>
> UPDATE files SET date="2007-10-10 10:50:22" WHERE id in(1,2,3,4,5......)
>
>
> However, IDs can be very large and can be oversize for a query. Due to 
> this I woulşd like to send them as text and split on psql side like this:
>
>
> UPDATE files SET date="2007-10-10 10:50:22" WHERE id IN (SELECT unnest (
> string_to_array('16767,16766' ,  ',')::bigint[]))
>
> How can I achieve this with Sequel?
>

DB[:files].where(:id=>DB.select{unnest(string_to_array('16767', 
'16766').cast('bigint[]'))}).update(:date=>'2007-10-10 10:50:22')

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 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.

Reply via email to