Nevermind. I just saw that this has been fixed in recent releases. I
am using an older version 1.2.137.

Sorry,
Dirk.


On 18 Jan., 18:02, Dirk Möbius <[email protected]> wrote:
> Contrary to the docs 
> athttp://www.h2database.com/html/grammar.html#alter_table_set
> TRUNCATE TABLE is not allowed if referential integrity is disabled:
>
>   CREATE TABLE a (
>     id INT NOT NULL PRIMARY KEY,
>     parent INT,
>     CONSTRAINT fk_parent_child FOREIGN KEY (parent) REFERENCES (id) ON
> DELETE CASCADE
>   );
>
>   INSERT INTO a VALUES (1,NULL);
>   INSERT INTO a VALUES (2,1);
>
>   TRUNCATE TABLE a; -- Error: cannot truncate "PUBLIC.A"; error code
> [90106-137]
>
>   ALTER TABLE a SET REFERENTIAL_INTEGRITY FALSE;
>
>   TRUNCATE TABLE a; -- Error: cannot truncate "PUBLIC.A"; error code
> [90106-137]
>
> I believe the error is in RegularTable.java: method canTruncate()
> doesn't check if referential integrity is disabled for that table or
> the tables that reference it.
>
> A fix is important to me, because I need to clear a set of big tables
> quickly. DELETE FROM ... is too slow for this.
>
> Thanks,
> Dirk.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to