I found an issue similar to 
http://groups.google.com/group/h2-database/t/cdef82a168babed5
for the column list of CHECK constraints.

In the information schema, the column CONSTRAINTS.COLUMN_LIST is
always NULL for CHECK constraints.

Now as dropping a column checks if it any references from a CONSTRAINT
prevent that (which is very smart :-) ):
http://code.google.com/p/h2database/source/browse/trunk/h2/src/main/org/h2/table/Table.java?r=3879#500
... it would be desirable (if not even required) to have a means of
querying the I_S if/which constraints reference a certain column
before attempting to drop it to ensure the attempt will succeed or to
drop the hindering constraints beforehand.

For any other constraint, this can be easily done. But for CHECK
constraints, the column list is always null, sadly. :-(.

I did a little reasearch again and found that there already is a
method to determine the columns involved in the CHECK expression
(obviously, because the drop attempt checking in table must have a
means of finding them):
http://code.google.com/p/h2database/source/browse/trunk/h2/src/main/org/h2/constraint/ConstraintCheck.java?r=3879#104

So all that would be necessary to add the column list information to
the CHECK constraint row in I_S.CONSTRAINTS would be to call that
method and store the result in the row.

Could this be considered for a future version of H2? Otherwise,
programmatically dropping columns becomes a gamble as soon as CHECK
constraints are involved. :-(.
Is there an alternative (workaround) way to determine the involved
columns of a CHECK constraint? Maybe by mapping a H2 system function
as an alias or so?

Thanks for answers :)

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