ColdFusion SQL Error - [Table ....] Is Not Indexable By Name
Posted June 12, 2006 at 6:21 PM by Ben Nadel
I was helping a co-worker of mine tracking down a ColdFusion error he was getting:
- [Table (rows 1 columns ID, PREFIX, FIRST_NAME, MIDDLE_NAME, LAST_NAME, SUFFIX, WORKING_NAME): [ID: coldfusion.sql.QueryColumn@c4736a] [PREFIX:
- coldfusion.sql.QueryColumn@17542e7] [FIRST_NAME:
- coldfusion.sql.QueryColumn@17b5ee7] [MIDDLE_NAME:
- coldfusion.sql.QueryColumn@93ab1f] [LAST_NAME:
- coldfusion.sql.QueryColumn@c79c37] [SUFFIX:
- coldfusion.sql.QueryColumn@e0eb96] [WORKING_NAME:
- coldfusion.sql.QueryColumn@8af270] ] is not indexable by name
I hadn't seen this error before, so the phrase "indexable" immediately made me think about full text indexes and primary keys. After several minutes of moving CFTRY/CFCATCH tags around, we finally found a better error message. It said something like the SELECT column 'name' was not a reference in any of the FROM tables. It was suddenly obvious; in his Query of Queries, the 'name' column was not defined. I find it very funny when simple mistakes take a lot of debugging.
On another note though, I think it is very interesting that the error thrown by the Query of Queries CFQuery tag was different than the one available in CFCATCH. Well, maybe not different at the core, but worded very differently.
Reader Comments
I go this error this morning, however I got it when I tried inserting a structure to a row of a query as in:
<cfset Tmp = StructInsert(QueryName[CurrentRow],OtherQueryName,QueryValue,true)>
I was pretty much trying my luck, half-expected the error. I hope this helps.
I'm working on work-around - thanks!
I recently was faced with the same problem, but for a different reason: I was trying to implement POIUtility into my application and in the ColumnList I left spaces after each comma. Removing the spaces fixed the problem.
@Kamil - thanks for the tip - I just ran into that.
@kamil,
You're a brain-saver. Wow. I */knew/* my column existed as it was being CFDumped in the code immediately preceeding.
For people of the future... I had
listtoarray("col1, <SPACE> col2, <SPACE> Col3")
the fix:
LtA("col1,col2,col3")
Thus, the HTMLEditFormat(Query[Columns[ColID]][Query.CurrentRow]) was being fed the array w/o spaces
You think it's funny....I think it's a pain. Thanks for the documentation though.
-A
Thought I would add to this...
I thought it was because I did not define the column in my query. I was wrong. I was outputting my query in CFScript using a for loop.
if(bldg_resultset.recordCount gt 0){
for(i=1;i<=bldg_resultset.recordCount;i++)
//ArrayAppend(bldgArray,bldg_resultset[i].bldgid); ArrayAppend(bldgArray,bldg_resultset.bldgid[i]);
}
The commented out code gave me this exact error, but instead of name it was '1', the value of the first i.
@Brad,
Good point - the column name always has to come first... which is definitely counter-intuitive if you think of queries as "arrays" of "structs".



