Hi, Jeremy, after do some research, i can reproduce same (expected) behavior as ruby-pg gem.
I add one code like this, i guess it means always create a new thread to run following SQL statement. sequel-5.50.0/lib/sequel/connection_pool/threaded.rb:139 def acquire(thread) + return make_new(:default) Now, when run "DB.run(Sequel.lit("update investing_latest_news set title=title"))", it works now. So, i guess this should be a thread issue, right? 在2021年11月23日星期二 UTC+8 上午1:08:36<Jeremy Evans> 写道: > On Mon, Nov 22, 2021 at 8:57 AM Billy Zheng <vil...@gmail.com> wrote: > >> > In order not to block the interpreter, Sequel uses #async_exec and not >> #exec on the PG::Connection. Perhaps that's the cause of the problem? Do >> you get the same results as Sequel if you use #async_exec on the >> PG::Connection (with #block afterward)? >> >> >> After change from >> >> db = PG.connect(URI(DB_URL)) >> >> db.exec("UPDATE investing_latest_news SET title = title;") >> >> To >> >> db.async_exec("UPDATE investing_latest_news SET title = title;") >> >> It still work. >> >> ---------------------------- >> >> I don't sure about what is you means of "with #block afterward" , maybe >> you want >> > > "With #block after" means: > > db.async_exec("UPDATE investing_latest_news SET title = title;") > db.block > > #block just waits for the async execution to finish. > > >> DB.synchronize do |conn| >> conn.async_exec("UPDATE investing_latest_news SET title = title;") >> end >> >> or >> >> DB.synchronize do |conn| >> conn.exec("UPDATE investing_latest_news SET title = title;") >> end >> >> Above two cases both NOT work. >> > > If the above doesn't work, unfortunately, I'm out of ideas. If you can > put together a self-contained example that only depends on Sequel and > nothing else, I can do more research. However, if you cannot, I will not be > able to help further. Sorry. > > 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/bdbc2b66-9874-4ca2-89f5-384f73758f54n%40googlegroups.com.