Assertion failure with a subtransaction and cursor

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Assertion failure with a subtransaction and cursor
Дата
Msg-id 4B0912BC.4090803@enterprisedb.com
обсуждение исходный текст
Ответы Re: Assertion failure with a subtransaction and cursor  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On all versions starting from 8.0 where subtransactions were introduced,
this causes an assertion failure:

postgres=# BEGIN;
BEGIN
postgres=# DECLARE foocur CURSOR FOR SELECT a FROM
generate_series(1,500000) a;
DECLARE CURSOR
postgres=# SAVEPOINT sp;
SAVEPOINT
postgres=# FETCH foocur;
 a
───
 1
(1 row)

postgres=# error; -- cause subxact abort
ERROR:  syntax error at or near "error"
LINE 1: error;
        ^
postgres=# ROLLBACK TO SAVEPOINT sp;
ROLLBACK
postgres=# FETCH ALL FROM foocur;
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

In server log:

TRAP: FailedAssertion("!(((file) > 0 && (file) < (int) SizeVfdCache &&
VfdCache[file].fileName != ((void *)0)))", File: "fd.c", Line: 1101)

When the first row is fetched from the cursor, the function scan is
materialized in a temporaray file. At the error, the temporary file is
deleted. But the FETCH ALL command expects the cursor to be still open,
and the file to exist, so it fails.

If assertions are disabled, you get an "ERROR:  unexpected end of tape"
error instead.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Hiroshi Inoue
Дата:
Сообщение: Re: BUG #5204: ODBC connection NOT working
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Assertion failure with a subtransaction and cursor