Re: [GENERAL] problem with ORDER BY

2008-02-04 Thread Nicolas KOWALSKI
"Vyacheslav Kalinin" <[EMAIL PROTECTED]> writes: > I am guessing that collation rules are not applied to bytea columns, so one > can compare text according to C locale anyway if he populates bytea column > or just does something like > > select * from url order by byteain(textout(url)) Thanks for

Re: [GENERAL] problem with ORDER BY

2008-02-01 Thread Vyacheslav Kalinin
I am guessing that collation rules are not applied to bytea columns, so one can compare text according to C locale anyway if he populates bytea column or just does something like select * from url order by byteain(textout(url))

Re: [GENERAL] problem with ORDER BY

2008-02-01 Thread Nicolas KOWALSKI
Tom Lane <[EMAIL PROTECTED]> writes: > The ordering you showed is correct according to en_US (and most other > non-C locales). The ordering you want is used in "C" locale. > Unfortunately you have to re-initdb to change the locale of a > database :-( > initdb --locale=C Thanks Tom, using t

Re: [GENERAL] problem with ORDER BY

2008-02-01 Thread Tom Lane
Nicolas KOWALSKI <[EMAIL PROTECTED]> writes: > Martijn van Oosterhout <[EMAIL PROTECTED]> writes: >> Show us your collation order: >> show lc_collate; > Here it is: > mon=> show lc_collate; > lc_collate > - > en_US.UTF-8 > (1 row) The ordering you showed is correct according to en_

Re: [GENERAL] problem with ORDER BY

2008-02-01 Thread Nicolas KOWALSKI
Martijn van Oosterhout <[EMAIL PROTECTED]> writes: > On Fri, Feb 01, 2008 at 11:06:07AM +0100, Nicolas KOWALSKI wrote: >> >> I do not understand why the following ORDER BY statment does not work >> as I would expect: >> >> 3) When I want to sort them, I get this "strange" ordering: > > Show us y

Re: [GENERAL] problem with ORDER BY

2008-02-01 Thread Martijn van Oosterhout
On Fri, Feb 01, 2008 at 11:06:07AM +0100, Nicolas KOWALSKI wrote: > Hello, > > I do not understand why the following ORDER BY statment does not work > as I would expect: > > 3) When I want to sort them, I get this "strange" ordering: Show us your collation order: show lc_collate; Have a nice da

[GENERAL] problem with ORDER BY

2008-02-01 Thread Nicolas KOWALSKI
Hello, I do not understand why the following ORDER BY statment does not work as I would expect: 1) I defined a simple table with only one column, containing urls: mon=> \d url Table "public.url" Column | Type | Modifiers +--+--- url| text | not null Indexes: "ur

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread Christopher Browne
Centuries ago, Nostradamus foresaw when [EMAIL PROTECTED] would write: > I'm trying to retrieve a limited number of random rows, and order them by a > column, and am not having any luck with that last part: > > SELECT * FROM tablename ORDER BY random(), id LIMIT 10 > > Returns everything more or le

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread Williams, Travis L, NEO
t: Re: [GENERAL] Problem with ORDER BY and random() ? On Tue, 23 Sep 2003 [EMAIL PROTECTED] wrote: > Hello, > > I'm trying to retrieve a limited number of random rows, and order them by a > column, and am not having any luck with that last part: > > SELECT * FROM tab

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread Nigel J. Andrews
On Tue, 23 Sep 2003 [EMAIL PROTECTED] wrote: > Hello, > > I'm trying to retrieve a limited number of random rows, and order them by a > column, and am not having any luck with that last part: > > SELECT * FROM tablename ORDER BY random(), id LIMIT 10 So it's sorting by random() then id. > Retu

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread Jean-Francois . Doyon
ot it working! Thanks to you all for the quick replies! J.F. -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 23, 2003 6:31 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [GENERAL] Problem with ORDER BY and random() ? [EMAIL PROTECTED] w

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread scott.marlowe
On Tue, 23 Sep 2003 [EMAIL PROTECTED] wrote: > Hello, > > I'm trying to retrieve a limited number of random rows, and order them by a > column, and am not having any luck with that last part: > > SELECT * FROM tablename ORDER BY random(), id LIMIT 10 > > Returns everything more or less as expec

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread Dennis Gearon
I just searched all the 7.2 manuals, the latest I have, and there is not one explanation of using random to order a query [EMAIL PROTECTED] wrote: Hello, I'm trying to retrieve a limited number of random rows, and order them by a column, and am not having any luck with that last part: S

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread Stephan Szabo
On Tue, 23 Sep 2003 [EMAIL PROTECTED] wrote: > Hello, > > I'm trying to retrieve a limited number of random rows, and order them by a > column, and am not having any luck with that last part: > > SELECT * FROM tablename ORDER BY random(), id LIMIT 10 > > Returns everything more or less as expecte

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread Tom Lane
[EMAIL PROTECTED] writes: > I'm trying to retrieve a limited number of random rows, and order them by a > column, and am not having any luck with that last part: > SELECT * FROM tablename ORDER BY random(), id LIMIT 10 > Returns everything more or less as expected, except for the fact that the > re

Re: [GENERAL] Problem with ORDER BY and random() ?

2003-09-23 Thread Mike Mascari
[EMAIL PROTECTED] wrote: > Hello, > > I'm trying to retrieve a limited number of random rows, and order them by a > column, and am not having any luck with that last part: > > SELECT * FROM tablename ORDER BY random(), id LIMIT 10 How about: SELECT * FROM (SELECT * FROM tablename ORDER BY rand