Re: md5() sorting

From: "Marko Kreen" <markokr(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: md5() sorting
Date: 2007-11-07 15:36:47
Message-ID: e51f66da0711070736u64717c36nb0b1f82b9038e8ac@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/7/07, Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net> wrote:
> On Wed, Nov 07, 2007 at 03:54:02PM +0100, Martijn van Oosterhout wrote:
> > > Should I be going about this sorting or hashing or detection
> > > business in another way entirely which can be done at the
> > > SQL level ?
> >
> > I'm wondering if you cast the md5sum as a bytea instead of text and
> > then sort, if that would solve it simply.
>
> Along the lines of
>
> ... ORDER BY decode(md5('...'), 'hex');
>
> ? I knew I'd ask here ;-)

Maybe using digest(.., 'md5') function from pgcrypto would be better?
It gives bytea immidiately.

--
marko

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Riggs 2007-11-07 15:37:12 Re: any way for ORDER BY x to imply NULLS FIRST in 8.3?
Previous Message Karsten Hilbert 2007-11-07 15:27:54 Re: md5() sorting