From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Nikhils <nikkhils(at)gmail(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: ExecuteTruncate quirk: expects a unique list of relations |
Date: | 2008-07-16 16:55:00 |
Message-ID: | 200807161655.m6GGt0K19653@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Nikhils wrote:
> 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.
Fixed with attached, applied patch. I didn't see any other cases that
need fixing; LOCK foo, foo already works fine.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachment | Content-Type | Size |
---|---|---|
/rtmp/diff | text/x-diff | 640 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2008-07-16 17:54:25 | Re: PATCH: CITEXT 2.0 v4 |
Previous Message | Bruce Momjian | 2008-07-16 16:54:08 | pgsql: Allow TRUNCATE foo, foo to succeed, per report from Nikhils. |