mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-26 02:43:43 +03:00
connection.reset() implemented using DISCARD ALL
This commit is contained in:
parent
7a33ebd580
commit
f9a13eb563
2
NEWS
2
NEWS
|
@ -7,6 +7,8 @@ What's new in psycopg 2.4.6
|
||||||
- Dropped GIL release during string adaptation around a function call
|
- Dropped GIL release during string adaptation around a function call
|
||||||
invoking a Python API function, which could cause interpreter crash.
|
invoking a Python API function, which could cause interpreter crash.
|
||||||
Thanks to Manu Cupcic for the report (ticket #110).
|
Thanks to Manu Cupcic for the report (ticket #110).
|
||||||
|
- connection.reset() implemented using DISCARD ALL on server versions
|
||||||
|
supporting it.
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.4.5
|
What's new in psycopg 2.4.5
|
||||||
|
|
|
@ -557,12 +557,18 @@ pq_reset_locked(connectionObject *conn, PGresult **pgres, char **error,
|
||||||
if (retvalue != 0) return retvalue;
|
if (retvalue != 0) return retvalue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (conn->server_version >= 80300) {
|
||||||
|
retvalue = pq_execute_command_locked(conn, "DISCARD ALL", pgres, error, tstate);
|
||||||
|
if (retvalue != 0) return retvalue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
retvalue = pq_execute_command_locked(conn, "RESET ALL", pgres, error, tstate);
|
retvalue = pq_execute_command_locked(conn, "RESET ALL", pgres, error, tstate);
|
||||||
if (retvalue != 0) return retvalue;
|
if (retvalue != 0) return retvalue;
|
||||||
|
|
||||||
retvalue = pq_execute_command_locked(conn,
|
retvalue = pq_execute_command_locked(conn,
|
||||||
"SET SESSION AUTHORIZATION DEFAULT", pgres, error, tstate);
|
"SET SESSION AUTHORIZATION DEFAULT", pgres, error, tstate);
|
||||||
if (retvalue != 0) return retvalue;
|
if (retvalue != 0) return retvalue;
|
||||||
|
}
|
||||||
|
|
||||||
/* should set the tpc xid to null: postponed until we get the GIL again */
|
/* should set the tpc xid to null: postponed until we get the GIL again */
|
||||||
conn->status = CONN_STATUS_READY;
|
conn->status = CONN_STATUS_READY;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user