Active Query Builder support area

Stack overflow with circular virtual field reference

Avatar
  • updated
  • Completed

Steps to reproduce

Assume the following table definition as xml loaded into the MetadataContainer of a QueryBuilder:


<table name="VIRTUAL">

<expression>(select * from EMPLOYEES) VIRTUAL</expression>

<field name="RECURSION1"><expression>'one ' + RECURSION2</expression></field>

<field name="RECURSION2"><expression>'two ' + RECURSION1</expression></field>

</table>


Now assume the following query text:

Select RECURSION1 From VIRTUAL


Now use a PlainTextSQLBuilder with ExpandVirtualObjects set to true and get the value of the PlainTextSQLBuilder.SQL property.


Actual Behavior

A StackOverflowException is thrown, presumably because the circular reference is not detected.


Expected Behavior

Am exception of a special type (i.e. CircularReferenceException) that identifies at least one member of the circular reference.

Generally we embrace recursive virtual field resolving and would like to keep using it. We are aware that it does not make sense to have circular references, but no-one is perfect and meaningful error messages are most helpful. :)


Avatar
Andrey Zavyalov, PM

Thank you for your report. Your suggestion will be implemented in the next minor version.

Avatar
Andrey Zavyalov, PM
Recursion loop detection on building result SQL with virtual fields is made.