It is currently possible to define the cursor name used for a Postgres 
dataset using the `Sequel::Postgres::Dataset#use_cursor` method. This is 
handy for preventing duplicate cursors in an iteration, however I'm not 
sure why this would be necessary.

I would think that the Postgresql Cursors should always be unique. I've 
been having issues with parallel background processes throwing 
`Sequel::DatabaseError: 
PG::DuplicateCursor: ERROR: cursor "sequel_cursor" already exists` errors 
on iterations, which I've resolved by using dynamic cursor names based on 
timestamps, i.e.

        cursor_name = "sequel_cursor_%s" % DateTime.now.strftime(
"%Y%m%d_%H%M%S_%L")
        User.use_cursor(cursor_name: cursor_name).paged_each do |user|
        ...



I'm probably missing something, but why not make cursor names unique by 
default to prevent collisions? Is there a specific reason to use the `
sequel_cursor` name for all cursors? If not, I'd be happy to submit a patch 
but figured I'd ask first :)

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