Yes, you can replace current-dateTime() by 1 if it is easier to fix the problem. In fact the real example wasn't using current-dateTime().
On Mon, Jul 16, 2012 at 6:48 PM, Matthias Brantner <1024...@bugs.launchpad.net> wrote: > The problem is that the key expression in the index declaration accesses > a function of the module. However, this function doesn't seem to be > compiled, yet. > > As a side-node, the example above should raise an error because the key > expression tries to access the dynamic context (because of fn:current- > dateTime) which is not allowed. > > -- > You received this bug notification because you are subscribed to the bug > report. > https://bugs.launchpad.net/bugs/1024892 > > Title: > Zorba error [zerr:ZXQP0002]: "theBodyExpr": assertion failed. > > Status in Zorba - The XQuery Processor: > New > > Bug description: > Compiling the following query: > module namespace guestbook = > "http://www.28msec.com/templates/guestbook/guestbook"; > > import module namespace functx = "http://www.functx.com/"; > > import module namespace db = > "http://www.zorba-xquery.com/modules/store/static/collections/dml"; > import module namespace idx = > "http://www.zorba-xquery.com/modules/store/static/indexes/dml"; > > declare namespace an = "http://www.zorba-xquery.com/annotations"; > > declare collection guestbook:entries as node()*; > declare variable $guestbook:entries as xs:QName := > xs:QName("guestbook:entries"); > > (: Access a document range :) > declare %private %an:automatic %an:unique %an:value-range index > guestbook:by-date > on nodes db:collection(xs:QName('guestbook:entries')) > by guestbook:convert-dateTime(@datetime) as xs:dateTime; > declare %private variable $guestbook:by-date as xs:QName := > xs:QName('guestbook:by-date'); > > declare function guestbook:convert-dateTime($dateTime as xs:string) > as xs:dateTime { > current-dateTime() > }; > > Results in > > 0 libzorba_simplestore.2.5.0.dylib 0x000000010932780a > _ZN5zorba16assertion_failedEPKcS1_iS1_ + 74 > 1 libzorba_simplestore.2.5.0.dylib 0x0000000109488cbf > _ZN5zorba13user_function8optimizeEPNS_10CompilerCBE + 1259 > 2 libzorba_simplestore.2.5.0.dylib 0x000000010921ab66 > _ZN5zorba9MarkExprs5applyERNS_15RewriterContextEPNS_4exprERb + 150 > 3 libzorba_simplestore.2.5.0.dylib 0x000000010920ab69 > _ZN5zorba15RuleMajorDriver7rewriteERNS_15RewriterContextE + 125 > 4 libzorba_simplestore.2.5.0.dylib 0x000000010920bdc2 > _ZN5zorba16DefaultOptimizer7rewriteERNS_15RewriterContextE + 304 > 5 libzorba_simplestore.2.5.0.dylib 0x000000010914d938 > _ZN5zorba14TranslatorImpl9end_visitERKNS_12IndexKeyListEPv + 5482 > 6 libzorba_simplestore.2.5.0.dylib 0x00000001090f706c > _ZNK5zorba13AST_IndexDecl6acceptERNS_17parsenode_visitorE + 78 > 7 libzorba_simplestore.2.5.0.dylib 0x00000001090fd4a2 > _ZNK5zorba12VFO_DeclList6acceptERNS_17parsenode_visitorE + 64 > 8 libzorba_simplestore.2.5.0.dylib 0x00000001090f5b12 > _ZNK5zorba6Prolog6acceptERNS_17parsenode_visitorE + 78 > 9 libzorba_simplestore.2.5.0.dylib 0x00000001090f5a9a > _ZNK5zorba13LibraryModule6acceptERNS_17parsenode_visitorE + 96 > 10 libzorba_simplestore.2.5.0.dylib 0x000000010912afa9 > _ZN5zorbaL13translate_auxEPNS_14TranslatorImplERKNS_9parsenodeEPNS_14static_contextEmPNS_11ModulesInfoERKSt3mapINS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEESI_St4lessISI_ESaISt4pairIKSI_SI_EEEbNS_19StaticContextConsts16xquery_version_tE > + 105 > 11 libzorba_simplestore.2.5.0.dylib 0x0000000109142381 > _ZN5zorba14TranslatorImpl9end_visitERKNS_12ModuleImportEPv + 7243 > 12 libzorba_simplestore.2.5.0.dylib 0x00000001090fd432 > _ZNK5zorba13SIND_DeclList6acceptERNS_17parsenode_visitorE + 206 > 13 libzorba_simplestore.2.5.0.dylib 0x00000001090f5b00 > _ZNK5zorba6Prolog6acceptERNS_17parsenode_visitorE + 60 > 14 libzorba_simplestore.2.5.0.dylib 0x00000001090f59fe > _ZNK5zorba10MainModule6acceptERNS_17parsenode_visitorE + 78 > 15 libzorba_simplestore.2.5.0.dylib 0x000000010912afa9 > _ZN5zorbaL13translate_auxEPNS_14TranslatorImplERKNS_9parsenodeEPNS_14static_contextEmPNS_11ModulesInfoERKSt3mapINS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEESI_St4lessISI_ESaISt4pairIKSI_SI_EEEbNS_19StaticContextConsts16xquery_version_tE > + 105 > 16 libzorba_simplestore.2.5.0.dylib 0x000000010912ad3e > _ZN5zorba9translateERKNS_9parsenodeEPNS_10CompilerCBE + 446 > 17 libzorba_simplestore.2.5.0.dylib 0x00000001092344b6 > _ZN5zorba14XQueryCompiler9normalizeENS_8rchandleINS_9parsenodeEEE + 34 > 18 libzorba_simplestore.2.5.0.dylib 0x00000001092345cc > _ZN5zorba14XQueryCompiler7compileERKNS_8rchandleINS_9parsenodeEEEbRNS1_INS_4exprEEERmRNS_5audit12ScopedRecordE > + 130 > 19 libzorba_simplestore.2.5.0.dylib 0x00000001092355a8 > _ZN5zorba14XQueryCompiler7compileERSiRKNS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEERm > + 534 > 20 libzorba_simplestore.2.5.0.dylib 0x0000000109065551 > _ZN5zorba10XQueryImpl9doCompileERSiRK19Zorba_CompilerHintsbRm + 861 > 21 libzorba_simplestore.2.5.0.dylib 0x0000000109065cce > _ZN5zorba10XQueryImpl7compileERSiRKNS_8SmartPtrINS_13StaticContextEEERK19Zorba_CompilerHints > + 518 > 22 zorba 0x00000001090437b9 > _Z17compileAndExecutePN5zorba5ZorbaERK18ZorbaCMDPropertiesRNS_8SmartPtrINS_13StaticContextEEERKSsRSiRSoR10TimingInfo > + 1705 > 23 zorba 0x000000010904592c main + 4108 > 24 zorba 0x0000000109041e94 start + 52 > > To manage notifications about this bug go to: > https://bugs.launchpad.net/zorba/+bug/1024892/+subscriptions -- You received this bug notification because you are a member of Zorba Coders, which is the registrant for Zorba. https://bugs.launchpad.net/bugs/1024892 Title: Zorba error [zerr:ZXQP0002]: "theBodyExpr": assertion failed. Status in Zorba - The XQuery Processor: New Bug description: Compiling the following query: module namespace guestbook = "http://www.28msec.com/templates/guestbook/guestbook"; import module namespace functx = "http://www.functx.com/"; import module namespace db = "http://www.zorba-xquery.com/modules/store/static/collections/dml"; import module namespace idx = "http://www.zorba-xquery.com/modules/store/static/indexes/dml"; declare namespace an = "http://www.zorba-xquery.com/annotations"; declare collection guestbook:entries as node()*; declare variable $guestbook:entries as xs:QName := xs:QName("guestbook:entries"); (: Access a document range :) declare %private %an:automatic %an:unique %an:value-range index guestbook:by-date on nodes db:collection(xs:QName('guestbook:entries')) by guestbook:convert-dateTime(@datetime) as xs:dateTime; declare %private variable $guestbook:by-date as xs:QName := xs:QName('guestbook:by-date'); declare function guestbook:convert-dateTime($dateTime as xs:string) as xs:dateTime { current-dateTime() }; Results in 0 libzorba_simplestore.2.5.0.dylib 0x000000010932780a _ZN5zorba16assertion_failedEPKcS1_iS1_ + 74 1 libzorba_simplestore.2.5.0.dylib 0x0000000109488cbf _ZN5zorba13user_function8optimizeEPNS_10CompilerCBE + 1259 2 libzorba_simplestore.2.5.0.dylib 0x000000010921ab66 _ZN5zorba9MarkExprs5applyERNS_15RewriterContextEPNS_4exprERb + 150 3 libzorba_simplestore.2.5.0.dylib 0x000000010920ab69 _ZN5zorba15RuleMajorDriver7rewriteERNS_15RewriterContextE + 125 4 libzorba_simplestore.2.5.0.dylib 0x000000010920bdc2 _ZN5zorba16DefaultOptimizer7rewriteERNS_15RewriterContextE + 304 5 libzorba_simplestore.2.5.0.dylib 0x000000010914d938 _ZN5zorba14TranslatorImpl9end_visitERKNS_12IndexKeyListEPv + 5482 6 libzorba_simplestore.2.5.0.dylib 0x00000001090f706c _ZNK5zorba13AST_IndexDecl6acceptERNS_17parsenode_visitorE + 78 7 libzorba_simplestore.2.5.0.dylib 0x00000001090fd4a2 _ZNK5zorba12VFO_DeclList6acceptERNS_17parsenode_visitorE + 64 8 libzorba_simplestore.2.5.0.dylib 0x00000001090f5b12 _ZNK5zorba6Prolog6acceptERNS_17parsenode_visitorE + 78 9 libzorba_simplestore.2.5.0.dylib 0x00000001090f5a9a _ZNK5zorba13LibraryModule6acceptERNS_17parsenode_visitorE + 96 10 libzorba_simplestore.2.5.0.dylib 0x000000010912afa9 _ZN5zorbaL13translate_auxEPNS_14TranslatorImplERKNS_9parsenodeEPNS_14static_contextEmPNS_11ModulesInfoERKSt3mapINS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEESI_St4lessISI_ESaISt4pairIKSI_SI_EEEbNS_19StaticContextConsts16xquery_version_tE + 105 11 libzorba_simplestore.2.5.0.dylib 0x0000000109142381 _ZN5zorba14TranslatorImpl9end_visitERKNS_12ModuleImportEPv + 7243 12 libzorba_simplestore.2.5.0.dylib 0x00000001090fd432 _ZNK5zorba13SIND_DeclList6acceptERNS_17parsenode_visitorE + 206 13 libzorba_simplestore.2.5.0.dylib 0x00000001090f5b00 _ZNK5zorba6Prolog6acceptERNS_17parsenode_visitorE + 60 14 libzorba_simplestore.2.5.0.dylib 0x00000001090f59fe _ZNK5zorba10MainModule6acceptERNS_17parsenode_visitorE + 78 15 libzorba_simplestore.2.5.0.dylib 0x000000010912afa9 _ZN5zorbaL13translate_auxEPNS_14TranslatorImplERKNS_9parsenodeEPNS_14static_contextEmPNS_11ModulesInfoERKSt3mapINS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEESI_St4lessISI_ESaISt4pairIKSI_SI_EEEbNS_19StaticContextConsts16xquery_version_tE + 105 16 libzorba_simplestore.2.5.0.dylib 0x000000010912ad3e _ZN5zorba9translateERKNS_9parsenodeEPNS_10CompilerCBE + 446 17 libzorba_simplestore.2.5.0.dylib 0x00000001092344b6 _ZN5zorba14XQueryCompiler9normalizeENS_8rchandleINS_9parsenodeEEE + 34 18 libzorba_simplestore.2.5.0.dylib 0x00000001092345cc _ZN5zorba14XQueryCompiler7compileERKNS_8rchandleINS_9parsenodeEEEbRNS1_INS_4exprEEERmRNS_5audit12ScopedRecordE + 130 19 libzorba_simplestore.2.5.0.dylib 0x00000001092355a8 _ZN5zorba14XQueryCompiler7compileERSiRKNS_7rstringINS_15rstring_classes3repINS_10atomic_intESt11char_traitsIcESaIcEEEEERm + 534 20 libzorba_simplestore.2.5.0.dylib 0x0000000109065551 _ZN5zorba10XQueryImpl9doCompileERSiRK19Zorba_CompilerHintsbRm + 861 21 libzorba_simplestore.2.5.0.dylib 0x0000000109065cce _ZN5zorba10XQueryImpl7compileERSiRKNS_8SmartPtrINS_13StaticContextEEERK19Zorba_CompilerHints + 518 22 zorba 0x00000001090437b9 _Z17compileAndExecutePN5zorba5ZorbaERK18ZorbaCMDPropertiesRNS_8SmartPtrINS_13StaticContextEEERKSsRSiRSoR10TimingInfo + 1705 23 zorba 0x000000010904592c main + 4108 24 zorba 0x0000000109041e94 start + 52 To manage notifications about this bug go to: https://bugs.launchpad.net/zorba/+bug/1024892/+subscriptions -- Mailing list: https://launchpad.net/~zorba-coders Post to : zorba-coders@lists.launchpad.net Unsubscribe : https://launchpad.net/~zorba-coders More help : https://help.launchpad.net/ListHelp