Обсуждение: Bug #796: Problem after upgrading to v. 723

Поиск
Список
Период
Сортировка

Bug #796: Problem after upgrading to v. 723

От
pgsql-bugs@postgresql.org
Дата:
Michael Brusser (michael@syncinc.com) reports a bug with a severity of 1
The lower the number the more severe it is.

Short Description
Problem after upgrading to v. 723

Long Description
After upgrading from v. 721 to 723 some of regression tests failed.
(We're running on Solaris)
Looking into problem, it appears that sometimes transaction
(we use serializable) gets aborted when we drop the sequence.

Test case below reflects my understanding of the problem.
In reality we have much more code between those lines in my test
sample - we create and drop table that utilizes this sequence,
we insert, update and delete data. But that does not look relevant
to the problem.

The sample code should fail if run from psql session - interactively
or using either "\i" or "-f" option.

I would appreciate if you reply to me directly with at least a hint of what's going on.
Thank you much,
Michael.


Sample Code
TEST CASE:
------------------------------
BEGIN;
   CREATE SEQUENCE s_ASeq;
   SELECT nextval('s_ASeq') ;
   DROP SEQUENCE s_ASeq ;
   /* some sql statement might be here */
COMMIT;
------------------------------

1) Problem occurs when attempt is made to drop the sequence:
   ERROR:  RelationForgetRelation: relation <rel_no> is still open

2) If there is an SQL statement following after that -
   it will understandably fail with this message:
   NOTICE:  current transaction is aborted, queries ignored
            until end of transaction block.

3) If "SELECT nextval" is never called - everything works.

4) If this code is run NOT within a transaction -
   everything's almost good, I see only a notice:
   NOTICE:  s_aseq.nextval: sequence was re-created
   This notice is generated when "SELECT nextval" is called.

  -Why Postgres needs to re-create the seq. table?



No file was uploaded with this report

Re: Bug #796: Problem after upgrading to v. 723

От
Tom Lane
Дата:
pgsql-bugs@postgresql.org writes:
> After upgrading from v. 721 to 723 some of regression tests failed.

> BEGIN;
>    CREATE SEQUENCE s_ASeq;
>    SELECT nextval('s_ASeq') ;
>    DROP SEQUENCE s_ASeq ;
>    /* some sql statement might be here */
> COMMIT;

> 1) Problem occurs when attempt is made to drop the sequence:
>    ERROR:  RelationForgetRelation: relation <rel_no> is still open

Yes; 7.2.3 will basically not let you drop a sequence that was touched
in the current transaction.  This was a hack added to prevent core dumps
of the sort illustrated in bug #671,
http://archives.postgresql.org/pgsql-bugs/2002-05/msg00106.php
http://archives.postgresql.org/pgsql-bugs/2002-05/msg00113.php
There is a proper fix in 7.3, but it was deemed too risky to back-patch
into the 7.2 series.

I am surprised that you did not have horrible stability problems under
previous releases, if your application was in the habit of issuing
transactions like the above.

            regards, tom lane