Thread: Sorting with relevant blank spaces

Sorting with relevant blank spaces

From
Stefano Bargioni
Date:
Hi,
I need to understand why my Postgres 6.5.2 installation sorts results ignoring blanks.
I obtain

prata
prata gennaro m
prata roberto
prat de la riba enrique h
prat enrique h
pratesi alessandro
pratesi luigi
pratesi marco

How to obtain

prat de la riba enrique h
prat enrique h
prata
prata gennaro m
prata roberto
pratesi alessandro
pratesi luigi
pratesi marco

TIA. Stefano
--
Dott. Stefano Bargioni
Biblioteca della Pontificia Universita' della Santa Croce - Roma
<mailto:bargioni@usc.urbe.it>                  <http://www.usc.urbe.it>
Personal web page:    <http://www.usc.urbe.it/html/php.script?bargioni>
--- "Si apud bibliothecam hortulum habes, nihil deerit"  (Cicerone) ---



Retrieving arrays through JDBC

From
Mart Käsper
Date:
Hi,

if a certain column is declared as:

   TEXT[]

how does one retrieve the individual TEXT's from a ResultSet ?

Thanks in advance

======================================================================
   Mart Käsper                 E-mail            : mart@netsoftlund.se
   Netsoft Lund AB
   Bredgatan 17                Tel (in place)    : +46 46  19 04 95
   SE-222 21 Lund, Sweden      Tel (on the road) : +46 70 319 04 95
======================================================================
#include <std.disclaimer>
======================================================================

   Life can be broken down into just a single unit - either you do a
   certain thing, or you don't.


Re: Sorting with relevant blank spaces

From
Tom Lane
Date:
Stefano Bargioni <bargioni@usc.urbe.it> writes:
> I need to understand why my Postgres 6.5.2 installation sorts results ignoring blanks.

This would be a matter of the LOCALE you are running the code in.
You may want to run the postmaster with environment variable LANG=C
(or possibly LC_ALL=C, depending on your platform).

Caution: this is not something you can change on a whim, because
changing the sort order means any indexes you have on text columns
are now logically out-of-order and thus corrupt.  The safest way to
proceed is pg_dumpall, stop postmaster, change LANG, initdb, restart
postmaster, load data.  Don't forget to change your system boot script
to ensure the same LANG is provided when you reboot...

            regards, tom lane