mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-01-31 09:24:07 +03:00
Read the server version only after connection established.
This commit is contained in:
parent
8fed0aa57d
commit
d71520db9a
|
@ -374,8 +374,6 @@ conn_sync_connect(connectionObject *self)
|
|||
|
||||
Dprintf("conn_connect: using protocol %d", self->protocol);
|
||||
|
||||
self->server_version = (int)PQserverVersion(pgconn);
|
||||
|
||||
/* if the connection is green, wait to finish connection */
|
||||
if (green) {
|
||||
wait_rv = psyco_wait(self);
|
||||
|
@ -386,6 +384,8 @@ conn_sync_connect(connectionObject *self)
|
|||
}
|
||||
}
|
||||
|
||||
self->server_version = (int)PQserverVersion(pgconn);
|
||||
|
||||
/* From here the connection is considered ready: with the new status,
|
||||
* poll() will use PQisBusy instead of PQconnectPoll.
|
||||
*/
|
||||
|
|
|
@ -45,8 +45,12 @@ class ConnectionTests(unittest.TestCase):
|
|||
self.assert_(conn.notices)
|
||||
conn.close()
|
||||
|
||||
def test_server_version(self):
|
||||
conn = self.connect()
|
||||
self.assert_(conn.server_version)
|
||||
|
||||
def test_suite():
|
||||
return unittest.TestLoader().loadTestsFromName(__name__)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user