Issue #1073108 by moonray, yuriy.babenko | greg.1.anderson: Fixed use of concat in query for better postgres compatibility.