diff options
| author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-07-21 18:32:02 +0100 |
|---|---|---|
| committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-07-24 21:16:36 +0100 |
| commit | 6d8f4f9f0d357beceb4a112e0ba9e3c1f314b8bb (patch) | |
| tree | f6b59893b0e38bcfe8b2d0af8a9cae19ba7ae54b /tests/test_cursor.py | |
| parent | 0e89b9de2ca254b11c0221727a502522ab238fa5 (diff) | |
| download | psycopg2-6d8f4f9f0d357beceb4a112e0ba9e3c1f314b8bb.tar.gz | |
Close named cursor if exist, even if we didn't run execute
Close #746
Diffstat (limited to 'tests/test_cursor.py')
| -rwxr-xr-x | tests/test_cursor.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_cursor.py b/tests/test_cursor.py index b48fe7f..b0a3789 100755 --- a/tests/test_cursor.py +++ b/tests/test_cursor.py @@ -441,6 +441,19 @@ class CursorTests(ConnectingTestCase): cur = self.conn.cursor('test') cur.close() + @skip_before_postgres(8, 2) + def test_stolen_named_cursor_close(self): + cur1 = self.conn.cursor() + cur1.execute("DECLARE test CURSOR WITHOUT HOLD " + " FOR SELECT generate_series(1,7)") + cur2 = self.conn.cursor('test') + cur2.close() + + cur1.execute("DECLARE test CURSOR WITHOUT HOLD " + " FOR SELECT generate_series(1,7)") + cur2 = self.conn.cursor('test') + cur2.close() + @skip_before_postgres(8, 0) def test_scroll(self): cur = self.conn.cursor() |
