Implemented inner chain to validate the custom SQL queries. refs #454