Thanks, Christian, for the quick and helpful explanation! On Mon, Nov 3, 2025 at 11:52 AM Christian Grün <[email protected]> wrote:
> Hi David, > > > I notice in the BaseX GUI that when I execute an XQuery script that > includes type checks (e.g., *let $x as element(stuff) := <stuff/>*) the > compilation report tells me that BaseX removes the type checks. How should > I understand this removal? I can see that BaseX is performing type-checking > because if I specify the wrong type, an error is thrown. I'd be grateful > for any insights anyone can provide about what the "remove type check" > messages mean? > > This info reflects what the optimizer does before evaluating your query. > In the given case, the explicit type check is removed from the internal > query execution plan. The reason is that it can be determined at compile > time that the bound expression will always have the requested type. If the > input type may differ from the requested one, the check will be preserved. > > Hope this helps, > Christian > >

