hi,

> y...@mwd.biglobe.ne.jp (YAMAMOTO Takashi) writes:
>>> There isn't terribly much we can do with this report unless you can
>>> provide a complete test case to reproduce it.
> 
>> after some investigation, i think it is triggered by protocol-level prepare
>> of ROLLBACK in an aborted transaction.  does the following patch make sense?
> 
> Maybe, but I'd still like to see a test case, because I can't reproduce
> any such problem by preparing ROLLBACK in an aborted transaction.

reading GetTransactionSnapshot, it seems that the problem happens
only with IsolationUsesXactSnapshot() true.
the attached program triggers the assertion failure reliably for me.

YAMAMOTO Takashi

> 
>                       regards, tom lane
#include <assert.h>
#include <stdlib.h>
#include <libpq-fe.h>
#include <unistd.h>

int
main()
{
        PGconn *conn;
        PGresult *res;

        conn = PQconnectdb("");
        assert(PQstatus(conn) == CONNECTION_OK);
        res = PQexec(conn, "SET SESSION CHARACTERISTICS AS "
            "TRANSACTION ISOLATION LEVEL REPEATABLE READ");
        assert(PQresultStatus(res) == PGRES_COMMAND_OK);
        PQclear(res);
        res = PQexec(conn, "BEGIN");
        assert(PQresultStatus(res) == PGRES_COMMAND_OK);
        PQclear(res);
        res = PQexec(conn, "hoge"); /* intentional syntax error */
        assert(PQresultStatus(res) != PGRES_COMMAND_OK);
        PQclear(res);
        assert(PQtransactionStatus(conn) == PQTRANS_INERROR);
        res = PQprepare(conn, "r", "ROLLBACK", 0, NULL);
        assert(PQresultStatus(res) == PGRES_COMMAND_OK);
        PQclear(res);
        res = PQexecPrepared(conn, "r", 0, NULL, NULL, NULL, 0);
        assert(PQresultStatus(res) == PGRES_COMMAND_OK);
        PQclear(res);
        exit(0);
}
-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to