Thread: Re: Bug #491: ERROR: RelationClearRelation: relation using JDBC

Re: Bug #491: ERROR: RelationClearRelation: relation using JDBC

From
Tom Lane
Date:
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

Re: Bug #491: ERROR: RelationClearRelation: relation using JDBC

From
Tom Lane
Date:
I said:
> 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;

I've committed a fix for this problem for 7.2.

            regards, tom lane