Highlighted

A strange query of queries bug in CF11?

Explorer ,
Jun 27, 2014

Copy link to clipboard

Copied

Hi,

I have this strange query of queries result that could be a bug in CF11.  The result is fine in CF10.

Basically, I have 2 queries, qrA and qrB.  I do a join of the two in joinQr, after which I do a query of qrA.  Since I didn't alter qrA in any way, I would expect newQrA to give me the same result as qrA.  However it only gives me one row ("D").  Now, here's the strange thing:  If I start off qrA with the letters in ascending order ["A", "B", "C", "D"], then newQrA gives me the right result.

<cfset qrA = queryNew("")>

<cfset queryAddColumn( qrA, "size", "varchar", [ "D", "A", "B", "C" ] )>

<cfset qrB = queryNew("")>

<cfset queryAddColumn( qrB, "size", "varchar", [ "A" ] )>

<cfset queryAddColumn( qrB, "quantity", "integer", [ 0 ] )>

<cfquery name="joinQr" dbtype="query">

    select qrA.*, qrB.quantity

    from qrA, qrB

    where qrA.size = qrB.size

</cfquery>

<cfquery name="newQrA" dbtype="query">

    select *

    from qrA

</cfquery>

<cfdump var="#qrA#">

<cfdump var="#qrB#">

<cfdump var="#joinQr#">

<cfdump var="#newQrA#">

Views

886

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

A strange query of queries bug in CF11?

Explorer ,
Jun 27, 2014

Copy link to clipboard

Copied

Hi,

I have this strange query of queries result that could be a bug in CF11.  The result is fine in CF10.

Basically, I have 2 queries, qrA and qrB.  I do a join of the two in joinQr, after which I do a query of qrA.  Since I didn't alter qrA in any way, I would expect newQrA to give me the same result as qrA.  However it only gives me one row ("D").  Now, here's the strange thing:  If I start off qrA with the letters in ascending order ["A", "B", "C", "D"], then newQrA gives me the right result.

<cfset qrA = queryNew("")>

<cfset queryAddColumn( qrA, "size", "varchar", [ "D", "A", "B", "C" ] )>

<cfset qrB = queryNew("")>

<cfset queryAddColumn( qrB, "size", "varchar", [ "A" ] )>

<cfset queryAddColumn( qrB, "quantity", "integer", [ 0 ] )>

<cfquery name="joinQr" dbtype="query">

    select qrA.*, qrB.quantity

    from qrA, qrB

    where qrA.size = qrB.size

</cfquery>

<cfquery name="newQrA" dbtype="query">

    select *

    from qrA

</cfquery>

<cfdump var="#qrA#">

<cfdump var="#qrB#">

<cfdump var="#joinQr#">

<cfdump var="#newQrA#">

Views

887

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jun 27, 2014 0
Engaged ,
Jun 27, 2014

Copy link to clipboard

Copied

it'd help if you showed us what these queries look like, and possibly some sample data.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 27, 2014 0
Explorer ,
Jun 27, 2014

Copy link to clipboard

Copied

Sorry, I had trouble inserting the code earlier.  It's fixed now.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 27, 2014 0
Adobe Community Professional ,
Jun 28, 2014

Copy link to clipboard

Copied

For your interest, by coincidence, my first test was with

<cfset queryAddColumn( qrA, "size", "varchar", [ "A","B","C","D" ] )> 


It turns out that the order "A","B","C","D" works, whereas "D","A","B","C" fails. Quite funny, really.


Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2014 0
Explorer ,
Jun 28, 2014

Copy link to clipboard

Copied

Thanks for confirming that it's a bug.  I will file a bug report.  I don't know what changes they made under the hood to QoQ, but to me this is serious because I can no longer trust the result of QoQ.  I wouldn't have caught this if a user didn't point out a result that made no sense.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2014 0
Explorer ,
Jun 28, 2014

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2014 0
BKBK LATEST
Adobe Community Professional ,
Jun 28, 2014

Copy link to clipboard

Copied

Thanks. In discovering this flaw, you have done the Coldfusion community a big favour.

I have added my vote to your bug report. It reads: "+My vote. Query of Queries is a cornerstone of Coldfusion. This issue is so serious as to raise questions about the reliability of the entire language.".



Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2014 1
Adobe Community Professional ,
Jun 28, 2014

Copy link to clipboard

Copied

I made an error when I first tested your code with array variable names instead. However, I have now been able to reproduce your result. It indeed looks like a bug.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 28, 2014 0