Re: Bug #491: ERROR: RelationClearRelation: relation using JDBC - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug #491: ERROR: RelationClearRelation: relation using JDBC
Date
Msg-id 14600.1004028832@sss.pgh.pa.us
Whole thread Raw
Responses Re: Bug #491: ERROR: RelationClearRelation: relation using JDBC  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
Hmm.  This seems to be a slightly different variant of the problem than
the one we fixed.  You could avoid it by not letting your clients hold
open transactions while they're sitting idle.  The path that's causing
a problem (or at least the problem I reproduced here) is

    Backend 1            Backend 2

    use table users;

    commit; begin;

                    drop table users;

                    create new users table

    use table users;

The problem is essentially that backend 1 is prepared to notice the
old users table having gone away when it does "begin", but not later
in its transaction.  It's still trying to use its old cached relation
entry, which is for the now-deleted table.

This is a bug, agreed, but not one that I can easily back-patch a fix
for into 7.1.*.

Another possible workaround for you is to not drop and recreate the
users table.  Couldn't you just truncate it?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Martin Würtele
Date:
Subject: postgres crash
Next
From: Bill Studenmund
Date:
Subject: Re: Enabling --debug causes regression test failure.