Leading hyphen ignored in query ORDER BY

It appears that leading hyphens are ignored in query sorting, as you can see in the example below. The other prefix characters in this example sort to the beginning. (Adobe ColdFusion sorts some to the beginning and some to the end, but that’s not the point. Lucee seems to ignore the hyphen, only, completely.)

The code below uses queryNew(), but only so it’s easy to post an example. I originally saw this behavior with a directory query, and it happened both in the original tag, and in sorting that query with a QoQ.

prefixes = listToArray("-,~,!,@,$,%,^,&,*,(,),_,+");
for(p in prefixes)
{
	q = queryNew("Name", "VARCHAR");
	names = 
	[
		"A",
		"#p#C",
		"B",
		"#p#D",
		"E",
		"#p#B"
	];
	for (name in names)
		q.addRow({name=name});
	q = queryExecute("SELECT * FROM q ORDER BY Name", [], {dbType="query"});
	writeDump(var=q, metainfo=0);
}

Any thoughts? Seems like I should report it as a bug.

Hi @Dave_Merrill,

I’ve checked with QOQ, Lucee doesn’t order by the name starts with ‘-’. But ACF sort as expected. Can you please raise a ticket here.

https://luceeserver.atlassian.net