Whoever might be interested in a workaround here:
I've written some h2acks ( :D ) providing the missing feature as a SQL
procedure.
https://jadoth.svn.sourceforge.net/svnroot/jadoth/H2acks/src/net/jadoth/h2acks/SQLFunctions.java
(sourceforge home: http://sourceforge.net/projects/jadoth/)

This solution is sufficient for me for the time being, of course I'd
prefer to have a proper fix for the problem in some future version of
H2.



On Dec 10, 2:02 pm, Paigan Jadoth <[email protected]>
wrote:
> I found an issue similar 
> tohttp://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/o...
> ... 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/o...
>
> 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