El Lunes, 28 de Diciembre de 2009, Iñaki Baz Castillo escribió:
> Hi, I'm testing Sequel with 'pg' driver using Posgres-8.4 database. I use
> prepared statements.
> 
> After restarting the database the next query fails with the following
>  error.
> 
> NOTE: First phrase in error message is in Spanish, I couldn't get it in
>  English by exporting "env LANG=en_US", but translated it means:
> 
>   "connection terminated due to a order from the administrator"
> 
> --------------------------------------------------------
> PGError: FATAL:  terminando la conexión debido a una orden del
>  administrador server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.
> 
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/pos
> tgres.rb:287:in `exec_prepared'
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/pos
> tgres.rb:287:in `block in execute_prepared_statement'
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/connection_p
> ool.rb:313:in `hold'
>  /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/database.rb
> :532:in `synchronize'
>  /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/po
> stgres.rb:275:in `execute_prepared_statement'
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/pos
> tgres.rb:221:in `execute'
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/dataset/acti
> ons.rb:100:in `execute'
> --------------------------------------------------------
> 
> 
> For the next queries the error is the following forever:
> 
> --------------------------------------------------------
> PGError: no connection to the server
> 
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/pos
> tgres.rb:287:in `exec_prepared'
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/pos
> tgres.rb:287:in `block in execute_prepared_statement'
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/connection_p
> ool.rb:313:in `hold'
>  /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/database.rb
> :532:in `synchronize'
>  /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/po
> stgres.rb:275:in `execute_prepared_statement'
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/adapters/pos
> tgres.rb:221:in `execute'
> /usr/local/lib/ruby1.9/gems/1.9.1/gems/sequel-3.7.0/lib/sequel/dataset/acti
> ons.rb:100:in `execute
> --------------------------------------------------------


I've checked 'pg' driver separately. When the conenction is lost (i.e. DB 
restart) a new "connect" is required:


-------------------------
irb> require "pg"

irb> db = PGconn.connect("localhost", 5432, "", "", "me", "1234", "somedb")

irb> puts db.exec("select count(*) from sometable;").result_status
=> 12

### Posgres restart now ###

irb> puts db.exec("select count(*) from sometable;").result_status
PGError: FATAL:  terminando la conexión debido a una orden del administrador
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

        from (irb):18:in `exec'

irb> puts db.exec("select count(*) from sometable;").result_status
PGError: FATAL:  terminando la conexión debido a una orden del administrador
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.

        from (irb):18:in `exec'

irb> db = PGconn.connect("localhost", 5432, "", "", "me", "1234", "somedb")

irb> puts db.exec("select count(*) from sometable;").result_status
=> 12
-------------------------


Could Sequel react and regenerate the connection to the database?


-- 
Iñaki Baz Castillo <[email protected]>

--

You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.


Reply via email to