So, last night I was running into broken behavior in Sybase 12.5.3 with regards to its behavior with SELECT COUNT(DISTINCT columnname) ... which surprised me, but I could at least rationalize why it was happening. Today, I found an outright bug, where mixing SELECT DISTINCT ... with an ORDER BY clause gives the wrong behavior. Here’s a quick session that demonstrates what I’m talking about:
1> SELECT @@version; -m bcp
Adaptive Server Enterprise/12.5.3/EBF 12331 ESD#1/P/Sun_svr4/OS 5.8/ase1253/1900/64-bit/FBO/Tue Jan 25 08:52:58 2005|
1> CREATE TABLE #test (x int, y int);
1> INSERT INTO #test (x, y) VALUES (1, 2);
(1 row affected)
1> INSERT INTO #test (x, y) VALUES (1, 10);
(1 row affected)
1> INSERT INTO #test (x, y) VALUES (2, 1);
(1 row affected)
1> INSERT INTO #test (x, y) VALUES (2, 5);
(1 row affected)
1> INSERT INTO #test (x, y) VALUES (3, 4);
(1 row affected)
1> INSERT INTO #test (x, y) VALUES (3, 7);
(1 row affected)
1> SELECT DISTINCT x FROM #test ORDER BY y DESC;
x
-----------
1
3
2
3
1
2
Has this been fixed in a newer version of Sybase? I can’t imagine anyone actually thinks this the right behavior.











Latest comments