Hi All,


Under some extreme circumstances, our application is seeing this error:


ERROR 42ZA0: Statement too complex. Try rewriting the query to remove complexity. Eliminating many duplicate expressions or breaking up the query and storing interim results in a temporary table can often help resolve this error.

                at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)

                at org.apache.derby.impl.sql.compile.StatementNode.generate(Unknown Source)

                at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)

                at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)

                at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)

                at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(Unknown Source)

                at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(Unknown Source)

                at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(Unknown Source)

                at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Unknown Source)

                at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)

                at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Unknown Source)


Is it documented anywhere what exactly causes this error?  Our application supports different data sources, so we need to have some sort of “testable” circumstances so we can catch this before it happens.  I can generate this error doing a SELECT .. WHERE ID IN of over 925 integer IDs, but it is not easily reproducible in our application.  Any insight would be greatly appreciated,