ExecuteTruncate quirk: expects a unique list of relations

From: Nikhils <nikkhils(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: ExecuteTruncate quirk: expects a unique list of relations
Date: 2008-06-05 14:51:21
Message-ID: d3c4af540806050751v788fb730hd3d790e4b8482f13@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Consider this simple case:

postgres=# TRUNCATE foo, foo;
ERROR: cannot TRUNCATE "foo" because it is being used by active queries in
this session

The above occurs because the ExecuteTruncate() function invokes
truncate_check_rel() in a loop. Since the same table name appears twice, the
rd_refcnt for table "foo" is bumped up to 2, causing the above failure.

We might want to add a step to ExecuteTruncate(), or whatever calls it, to
make the list unique.

Regards,
Nikhils
--
EnterpriseDB http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2008-06-05 15:18:02 Re: Overhauling GUCS
Previous Message Heikki Linnakangas 2008-06-05 13:35:10 Re: pg_dump restore time and Foreign Keys