@@ -586,6 +586,15 @@ def create_pool(dsn=None, *,
586586 finally:
587587 await pool.release(con)
588588
589+ .. warning::
590+ Prepared statements and cursors returned by
591+ :meth:`Connection.prepare() <connection.Connection.prepare>` and
592+ :meth:`Connection.cursor() <connection.Connection.cursor>` become
593+ invalid once the connection is released. Likewise, all notification
594+ and log listeners are removed, and ``asyncpg`` will issue a warning
595+ if there are any listener callbacks registered on a connection that
596+ is being released to the pool.
597+
589598 :param str dsn:
590599 Connection arguments specified using as a single string in
591600 the following format:
@@ -632,6 +641,19 @@ def create_pool(dsn=None, *,
632641 .. versionchanged:: 0.10.0
633642 An :exc:`~asyncpg.exceptions.InterfaceError` will be raised on any
634643 attempted operation on a released connection.
644+
645+ .. versionchanged:: 0.13.0
646+ An :exc:`~asyncpg.exceptions.InterfaceError` will be raised on any
647+ attempted operation on a prepared statement or a cursor created
648+ on a connection that has been released to the pool.
649+
650+ .. versionchanged:: 0.13.0
651+ An :exc:`~asyncpg.exceptions.InterfaceWarning` will be produced
652+ if there are any active listeners (added via
653+ :meth:`Connection.add_listener() <connection.Connection.add_listener>`
654+ or :meth:`Connection.add_log_listener()
655+ <connection.Connection.add_log_listener>`) present on the connection
656+ at the moment of its release to the pool.
635657 """
636658 if not issubclass (connection_class , connection .Connection ):
637659 raise TypeError (
0 commit comments