Am Donnerstag, 25. Oktober 2012 11:08:55 UTC+2 schrieb Noel Grandin:
>
>
> On 2012-10-24 14:18, Ben Gardener wrote: 
> > A userdefined function MYFUNC(VALUE), bound to a DOMAIN 
> > CHECK(MYFUNC(VALUE)) 
> > does not work from second DB start onwards. 
> > Reason: The DB reloads meta data by a fixed ordering where FUNCTIONS 
> > loaded after DOMAINS. 
> > This results in a "FUNCTION not found" exception when recreating the 
> > DOMAIN. 
>
> Do you have a small self-contained test case for this? 
> Because we have a unit test in 
> TestCases#testCheckConstraintWithFunction() which tests this very 
> situation, and it seems to be working for me. 
>
> Or maybe you are running an older version? 
>

I don't have a simple testcase available, but you can look into 
Database.open() at those lines:

        Collections.sort(records);
        for (MetaRecord rec : records)
        {
            rec.execute(this, systemSession, eventListener);
        }

Original MetaRecord code sorts object types by a fixed order with 
USER_DATATYPE first, then USER_FUNCTION. This is wrong in cases where the 
DOMAIN references an ALIAS.
It must result in a missing function dependency when resolving the DOMAIN, 
because no functions available at that time.
There is no problem in the DOMAIN/ALIAS defining session. After reopening 
the DB internal ordering takes place with mentioned dependency problem.


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/1Q2e4PLP2U0J.
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