Re: Fix for a problem with auto reconnection
От | Dave Page |
---|---|
Тема | Re: Fix for a problem with auto reconnection |
Дата | |
Msg-id | CA+OCxoz+sPdtx-Rw-ScvQszzPTSr_YBf3jm+=NxFsuT1Tqg_Cw@mail.gmail.com обсуждение исходный текст |
Ответ на | Fix for a problem with auto reconnection (Christoph Zwerschke <cito@online.de>) |
Ответы |
Re: Fix for a problem with auto reconnection
|
Список | pgadmin-hackers |
Ashesh, can you look at this please? Thanks for the report and investigation Christoph. On Thu, Nov 14, 2013 at 7:04 PM, Christoph Zwerschke <cito@online.de> wrote: > My colleagues and I recently stumbled over a quite perplexing issue with > pgadmin3 (1.18.1), namely that the pgadmin query tool sometimes did not show > values in the database which were definitely set. > > After further investigation it turned out that this happened when the values > contained non-ascii characters and after the database connection had been > reset by pgadmin (which happened sometimes when the database was restarted > or there was a timeout in the firewall), and if that reset happened via the > query tool window, not via the main window. > > The explanation for this behavior is obvious: The connection is reset with > conn->Reset() in frm/frmQuery.cpp, but the Reset() method does not set the > client side encoding for the connection to match the encoding of the > database, as is done in DoConnect(). It also fails to do some other things > that DoConnect() cares about, such as setting the DateStyle to ISO and > setting the default role. This could cause additional problems. > > So my solution was to replace the call to conn->Reset() with a call to > conn->Reconnect() which essentially does the same, but calls DoConnect() > internally so that everything gets initialized. > > This fix works nicely for me. Another solution would be to add the > initialization code in DoConnect() to the Reset() method as well. > > Here are the steps to reproduce the problem: > > * Open the SQL query tool and create a test table like this: > > create table t(a varchar , b varchar); > insert into t values ('Wurst', 'Käse'); > > * Query the table with "select * from t". > You should get "Wurst" and "Käse". > > * Kill the server process for the connection > > * Query the table again with "select * from t". > You should get a Fatal error: connection lost. > > * Rerun the query. > You should now get a dialog box asking > "... attempt to reconnect ... ?" > > * Answer "Yes". > You should get the message "Connection reset." > > * Rerun the query. > Now you get the query result again, > but this time only with the cell "Wurst"; > the cell that should say "Käse" stays empty. > > > -- > Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgadmin-hackers -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EnterpriseDB UK: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgadmin-hackers по дате отправления: