tracker issue : CF-4207962

select a category, or use search below
(searches all categories and all time range)

"first" and "last" are reserved keywords when used in a Query-of-Queries

| View in Tracker

Status/Resolution/Reason: To Fix//BugVerified

Reporter/Name(from Bugbase): James M. / ()

Created: 04/08/2020

Components: Database, Query-of-Query(IMQ)

Versions: 2016

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: 2016.0.14.318307 (but also in CF10, 11, 2016 & 2018) /

Priority/Frequency: Normal /

Locale/System: / Win 2008 Server

Vote Count: 1

Problem Description:
Some column names (provided by a third-party) throw errors when attempting to query within a QofQ in CF10, 11, 2016 & 2018.  More info at

Steps to Reproduce:

<cfset test = queryNew("first,last", "varchar,varchar")>
<cfset queryAddRow(test)>
<cfset querySetCell(test,"first","Mickey")>
<cfset querySetCell(test,"last","Mickey")>

<cfquery name="TestFirst" dbtype="query">SELECT First, Last
FROM test</cfquery>

Actual Result:
Query Of Queries syntax error. Encountered "First. Incorrect Select List, Incorrect select column,

Expected Result:
The query.  If Railo or Lucee are used, the correct results are returned.

Any Workarounds:
Drop down to java and rename all unsafe column names using SetColumnNames(). (Mentioned in the blog post w/sample code + a link to UDF.)