Thank's Tom Lane & Stephan Szabo for pointing out the problem to me. After some testing it turned out that the swedish locale, 'sv_SE', doesn't handle sorting spaces as expected, which probably made the SELECT fail. On the other hand, if I use the 'C' locale, the SELECT works but not the sort order of the swedish characters 'åäö'.
Does anyone know a solution to this problem, or could give me a hint? > -----Ursprungligt meddelande----- > Från: Tom Lane [mailto:[EMAIL PROTECTED]] > Skickat: den 19 september 2002 16:32 > Till: [EMAIL PROTECTED] > Kopia: [EMAIL PROTECTED] > Ämne: Re: [SQL] Stripping white-space in SELECT statments > > > =?iso-8859-1?Q?Thorbj=F6rn_Eriksson?= <[EMAIL PROTECTED]> writes: > > I've encountered a strange behavior in postgres 7.2.1 regarding how psql > > handles strings ending with space characters. > > Perhaps you are running in a non-C locale? A lot of locales have > sorting rules that are pretty weird about whitespace. > > > The reason that we don't use 'LIKE 201901 %' is that it don't use > > the index > > This suggests strongly that you are in a non-C locale. Your external > software seems to be emulating the standard LIKE-to-index optimization; > which as you are now discovering, does not work with non-C sorting > rules (so the system doesn't try to apply it). > > regards, tom lane > > ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster