Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

A strange query of queries bug in CF11?

Guest
Jun 27, 2014 Jun 27, 2014

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#">

1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 27, 2014 Jun 27, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 27, 2014 Jun 27, 2014

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2014 Jun 28, 2014

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.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 28, 2014 Jun 28, 2014

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 28, 2014 Jun 28, 2014
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2014 Jun 28, 2014
LATEST

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.".



Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 28, 2014 Jun 28, 2014

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.

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