[BISERVER-11687] The following unexpected error has occurred during adding fields to the IR: "The generated SQL-query did not execute successfully".

Unit test

(cherry picked from commit 92b529e)