From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Artiom Makarov <artiom(dot)makarov(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6048: TRUNCATE vs TRUNCATE CASCADE: misleading message |
Date: | 2011-06-02 17:37:47 |
Message-ID: | BANLkTikUo+YtLPAh_OssfYPYohYP=YgS-g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Jun 2, 2011 at 11:21 AM, Artiom Makarov
<artiom(dot)makarov(at)gmail(dot)com> wrote:
> 2011/6/2 Alexey Klyukin <alexk(at)commandprompt(dot)com>:
>
>> What would you expect to happen for TRUNCATE .. CASCADE?
>>
>> One thing I find potentially surprising is that TRUNCATE CASCADE doesn't follow the semantics of 'ON DELETE' clause for the foreign key, i.e. it would truncate the dependent table even with ON DELETE RESTRICT foreign key. Do we need a similar 'ON TRUNCATE' FK clause?
>>
>
> Yes, cascade truncating taked place without ON DELETE RESTRICT
> checking. No matter.
> Either TRUNCATE must show message with full objects tree - correct
> behavior like DROP, or TRUNCATE CASCADE should not delete anything
> (strict constraint checking).
It's a fairly unusual case to have two inheritance children one of
which has a foreign key referencing the other, and to then try to
truncate the parent table, so I'm somewhat disinclined to put in the
time to fix this.
However, patches are welcome...
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-06-02 17:39:41 | Re: BUG #5926: information schema dtd_identifier for element_types, columns, parameters views inconsistent |
Previous Message | Robert Haas | 2011-06-02 17:31:33 | Re: Unlogged tables cannot be truncated twice |