If PostgreSQL failed to compile on your computer or you found a bug that is likely to be specific to one platform then please fill out this form and e-mail it to pgsql-ports@postgresql.org. To report any other bug, fill out the form below and e-mail it to pgsql-bugs@postgresql.org. If you not only found the problem but solved it and generated a patch then e-mail it to pgsql-patches@postgresql.org instead. Please use the command "diff -c" to generate the patch. You may also enter a bug report at http://www.postgresql.org/ instead of e-mail-ing this form. ============================================================================ POSTGRESQL BUG REPORT TEMPLATE ============================================================================ Your name : Franz Korntner Your email address : franz@hippo.xs4all.nl System Configuration --------------------- Architecture (example: Intel Pentium) : p686 Operating System (example: Linux 2.0.26 ELF) : linux 2.2.12 PostgreSQL version (example: PostgreSQL-6.5.2): PostgreSQL-6.5.2 Compiler used (example: gcc 2.8.0) : egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) Please enter a FULL description of your problem: ------------------------------------------------ psql seems to have a problem when combining 'SELECT DISTINCT' with 'ORDER BY'. In some cases it seems to ignore the 'DISTINCT' Below is an example. Please note that the field specified by the 'ORDER BY' is not part of the selected column. The actual query was more complicated, and needed to sort the result in a specific way. Please describe a way to repeat the problem. Please try to provide a concise reproducible example, if at all possible: ---------------------------------------------------------------------- CREATE TABLE Bug ( Nr INT4, Name VARCHAR(8) ); INSERT INTO bug VALUES ( 0, 'A'); INSERT INTO bug VALUES ( 1, 'A'); INSERT INTO bug VALUES ( 2, 'B'); SELECT DISTINCT Name FROM Bug WHERE Name = 'A'; SELECT DISTINCT Name FROM Bug WHERE Name = 'A' ORDER BY Nr; If you know how this problem might be fixed, list the solution below: ---------------------------------------------------------------------