tracker issue : CF-4138764

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

[ANeff] Bug for: QoQ incorrect casting

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): / ext-user (Nimit Sharma)

Created: 04/12/2016

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

Versions: 2016

Failure Type:

Found In Build/Fixed In Build: 298359 / 303807

Priority/Frequency: Normal / Few users will encounter

Locale/System: English / Linux All,Mac 10 All,Solaris All,Win XP All

Vote Count: 1

Related Bugs:
CF-4121934 - Similar to


Problem: [ANeff] Bug for: QoQ incorrect casting

Original bug #4121934 reported by Aaron Neff

Issue:
 
CAST(myBitColumn AS VARCHAR) returns YES/NO instead of 1/0

Code Snippet:

First, define DSN and create table:
--------------------------------------------
myDSN = "";
queryExecute("CREATE TABLE myTable (myBitColumn bit NULL, myVarcharColumn varchar(3) NULL)", [], {datasource=myDSN});
queryExecute("INSERT INTO myTable VALUES (1, 'Foo')", [], {datasource=myDSN});

Repro for #1:
--------------------------------------------
q1 = queryExecute("SELECT CAST(myBitColumn AS VARCHAR) AS myVarcharColumn FROM myTable", [], {datasource=myDSN});
q2 = queryExecute("SELECT myBitColumn FROM myTable", [], {datasource=myDSN});
q3 = queryExecute("SELECT CAST(myBitColumn AS VARCHAR) AS myVarcharColumn FROM q2", [], {dbtype="query"});
writeOutput(q1.myVarcharColumn & ' ' & q3.myVarcharColumn);
//Actual result: 1 YES
//Expected result: 1 1

Method:

Result:

Expected:

Workaround:

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4138764

External Customer Info:
External Company:  
External Customer Name:  
External Customer Email:

Attachments:

Comments:

Hi Nimit, Regarding your comment on CF-4121934: -------------------------------------------- The recommended Java mapping for the JDBC BIT type is as a Java boolean. The current behavior is ideally right but we are converting BIT to Integer while dumping a query to maintain backward compatibility. We can do the same for QoQ as well but that would be a major change of behavior and is risky in a hot fix. -------------------------------------------- The issue is not limited to cfdump/cfoutput. The result of CAST(myBitColumn AS VARCHAR) in QoQ is actually YES/NO, which is incorrect and even inconsistent w/ regular (aka non-QoQ) queries which return 1/0. So I think it is important and should be fixed for QoQ. Thanks very much for considering this for Aether!, -Aaron
Comment by External U.
3107 | October 29, 2016 01:39:03 AM GMT
+1 - Thanks, Nimit, for filing this!
Vote by External U.
3109 | October 29, 2016 01:39:20 AM GMT
This issue is fixed now. The fix for this issue will be available as part of next major release of ColdFusion.
Comment by Nimit S.
3108 | September 12, 2017 02:29:16 PM GMT