Hi,

Currently, "alter table drop column" is implemented as:

- create a new table (with the name TEMP_TABLE_...)
- copy the data
- rename the old table
- rename the temp table
- drop the old table

The new table is created with a temporary name because at any time,
only one table with a given name can exist.

When renaming a table, the trigger init code isn't called. I wonder if
it should be called - I guess it could be problematic because most
likely it is already initialized.

So, I'm not sure how to fix this problem currently. What do you
suggest? One thing I could do (that wouldn't cause trouble) is to use
a better name for the new table, such as: NEW_<tableName>. So if you
alter a table called TEST the new table would be called NEW_TEST. (If
such a table already exists, the new table would be called NEW1_TEST
and so on.) In this way, at least the trigger has a chance to
understand what the real table name is:

tableName = tableName.replaceFirst("NEW.*_", "")

What do you think? I know it's a bit ugly. As an alternative, the init
method of the trigger could be called with the 'right' table name, but
that would also be problematic because it's not actually correct.

Regards,
Thomas

-- 
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