[Nitro] Question for all you postgres users.

Bryan Soto bryan.a.soto at gmail.com
Sun Apr 9 03:24:55 EDT 2006


I'm looking at the docs for postgres, and they say:

=> SELECT * FROM test1;
 x | y
---+---
 a | 3
 c | 2
 b | 5
 a | 1
(4 rows)

=> SELECT x FROM test1 GROUP BY x;
 x
---
 a
 b
 c
(3 rows)

Notice that when using group by, the x column is sorted.

However, when I duplicate a query from a failing test:

test=# select section, sum(age) from ogtc_ogaggrcalc_user group by section;
 section | sum
---------+-----
 c       |  58
 d       |  67
 a       |  28
(3 rows)

It's not sorted. Is sorting not guaranteed in postgres when using
group by? It does for the other stores?

Just curious cause there's a test failing because it assumes that the
result will be sorted. If sorting isn't guaranteed, then it's not an
issue.

Thanks.

--
"Never tell people how to do things. Tell them what to do and they
will surprise you with their ingenuity." —General George S. Patton




More information about the Nitro-general mailing list