From 62e7acba8f2cedafd0dcbd9436098e9dc72ca0f1 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Tue, 1 Aug 2023 12:04:33 +0100 Subject: [PATCH] docs: drop example about using nextset() in pipeline mode The feature is sort of accidental, not tested, and proved to be not reliable, so we will remove it in 3.2. See #604. --- docs/advanced/pipeline.rst | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/docs/advanced/pipeline.rst b/docs/advanced/pipeline.rst index 980fea70d..a56049ccb 100644 --- a/docs/advanced/pipeline.rst +++ b/docs/advanced/pipeline.rst @@ -185,26 +185,8 @@ several operations, using `Connection.execute()`, `Cursor.execute()` and Unlike in normal mode, Psycopg will not wait for the server to receive the result of each query; the client will receive results in batches when the -server flushes it output buffer. - -When a flush (or a sync) is performed, all pending results are sent back to -the cursors which executed them. If a cursor had run more than one query, it -will receive more than one result; results after the first will be available, -in their execution order, using `~Cursor.nextset()`: - -.. code:: python - - >>> with conn.pipeline(): - ... with conn.cursor() as cur: - ... cur.execute("INSERT INTO mytable (data) VALUES (%s) RETURNING *", ["hello"]) - ... cur.execute("INSERT INTO mytable (data) VALUES (%s) RETURNING *", ["world"]) - ... while True: - ... print(cur.fetchall()) - ... if not cur.nextset(): - ... break - - [(1, 'hello')] - [(2, 'world')] +server flushes it output buffer. You can receive more than a single result +by using more than one cursor in the same pipeline. If any statement encounters an error, the server aborts the current transaction and will not execute any subsequent command in the queue until the -- 2.47.2