ColdFusion: Error Occurred While Processing Request 10 >= 10

Posted June 27, 2006 at 10:11 AM by Ben Nadel

Tags: ColdFusion, SQL

People are always posting questions about this form of ColdFusion SQL error on the House of Fusion CF-Talk list. It can be a really frustrating error if you have never seen it before since you look at it an you are like "What is this crap?!? 10 IS greater than or equal to 10!" The numbers will change from time to time, but once you've seen the error, it never surprises you.

It's a matter of query structure caching. I am not talking from textbook knowledge here (these are my assumptions - call me an ass if you will), but, SQL server caches the form of your query so that it can optimize data retrieval. That's fine. Actually it's really good, so long as your SQL code is well thought out. Most people run into this problem when they use "SELECT *".

SELECT * does not call any columns explicitly, but instead asks the SQL server to return all columns. This has huge potential to conflict with the query structure caching. Let's say that you have a table with columns [ A(int), B(int), C(int) ] and you run a SELECT * query. The SQL server caches the structure of your query for later use. Then you go in and change the table structure to have columns [ A(int), B(int), Z(char), C(int) ] and run the SELECT * query again. Suddenly you get the error:

ColdFusion: Error Occurred While Processing Request N >= N

... where (N) is some random number, usually an integer. Wait, what happened??? The problem is that when you ran the second query, suddenly the third column is a different name AND datatype. From your standpoint, it shouldn't matter since you just wanted everything, but from the SQL server's standpoint, suddenly something doesn't line up, but it's not sure what (since it's working off of a cached structure).

There are two fixes for this issues:

1. The BAD Fix

Go into the ColdFusion Administrator, select the appropriate datasource, view the advanced options, and uncheck the box that tells ColdFusion to maintain connections. This forces the SQL server to NOT use cached query structures. If you then go back to the page and run it again, no more errors. This is a HACK.

2. The REALLY BAD Fix

Since you know that it's a structure caching issue, if you are going to use SELECT *, always add new table columns to the end of the table (if using Enterprise Manager). If you always add columns to the end of the table, then while the cached structure doesn't line up, columns won't mis-match (since physical locations do not change).

3. The GOOD Fix

Don't use SELECT *. It's just not good query technique. You should always write out your queries with explicit column names. The benefits of this are many-fold, so just take my word for it; from maintenance, to readability, to performance... always always always write out your column names.



Reader Comments

There are no comments posted for this web log entry.

Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Supported HTML tags for formatting: <strong>bold</strong>   <em>italic</em>   <code>code</code>







  • Help Wanted - Find Your Next ColdFusion Job
InVision App - Prototyping Made Beautiful With Prototyping Tools Ben Nadel's Company - Epicenter Consulting Recent Blog Comments
Feb 10, 2012 at 7:21 PM
jQuery AJAX Strips Script Tags And Inserts Them After Parent-Most Elements
Update! Instead of $(eval(options.insertAfter)).after(data['insertData']); I now use: var ajaxNode = document.createElement('span'); var parent = $(eval(options.insertAfter))[0].parentNode; ... read »
Feb 10, 2012 at 6:18 PM
jQuery AJAX Strips Script Tags And Inserts Them After Parent-Most Elements
encountered this same, what I consider, jQuery bug last week. I'm building a site in which I load some content via AJAX. This content contains Linkedin share button placeholders which Linkedin API ne ... read »
Feb 10, 2012 at 11:30 AM
Cross-Origin Resource Sharing (CORS) AJAX Requests Between jQuery And Node.js
After you understand the concepts here, this is an awesome cheatsheet for enabling CORS in just about anything http://enable-cors.org/ ... read »
JM
Feb 10, 2012 at 9:10 AM
My Safari Browser SQLite Database Hello World Example
@Amy, Here is a very good tutorial on how to use JOIN: http://www.sqltutorial.org/sqljoin-innerjoin.aspx ... read »
Feb 10, 2012 at 4:42 AM
Building A Twitter-Inspired RESTful API Architecture In ColdFusion
This is great, very useful Ben. I spotted a small typo in the api.cgm listing: <cfthrow type="Unauthroized" /> Cheers Stefan ... read »
Feb 9, 2012 at 10:35 PM
CFDirectory Filtering Uses Pipe Character For Multiple Filters (Thanks Steve Withington)
I was wondering if there would be a filter you could apply so that you got everything but what you included in the filter. As in show me all docs that are not a .pdf. ... read »
Feb 9, 2012 at 10:29 PM
Learning ColdFusion 9: Application-Specific Data Sources
@Ben, No offence, but if people were really wanting advanced features they would be using a platform like ASP.NET MVC. CFML is so structurally compromised as a tag-based scripting language that ... read »
Feb 9, 2012 at 10:03 PM
Subversion - Cleanup Failed To Process The Following Paths
@Leviaguirre, do you still have problems with this? ... read »