Re: checksum

From: "Henriksen, Jonas F" <jonas(dot)f(dot)henriksen(at)imr(dot)no>
To: "Federico Balbi" <fbalbi(at)cs(dot)utsa(dot)edu>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: checksum
Date: 2004-09-27 10:45:30
Message-ID: 1612616523F26F48AB55BC8F5D47917C03CBD211@post2.imr.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

not sure I quite understand, but could you not just concatenate all the fields and test on that? like:

select test1, test2, test3 from testtable
where test1 || test2 || test3 = 'whateveryouwanttotest'

you might have to do some typecasting/conversion on data types other than strings...

regards Jonas:))

-----Original Message-----
From: Federico Balbi [mailto:fbalbi(at)cs(dot)utsa(dot)edu]
Sent: 26. september 2004 20:32
To: postgresql-general
Subject: Re: checksum

> David Helgason wrote:
>
> >> I was wondering if PGSQL has a function similar to
> >> binary_checksum() of
> >> MS SQL Server 2000. It is pretty handy when it comes to compare rows of
> >> data instead of having to write long boolean expressions.
> >> binary_checksum() takes a list of fields and it returns an integer value
> >> which sumarize the row content.
> >
> >
> You could use the md5 function.... such as :
>
> select md5(foo) from bar where baz = 2;

Looks like md5() takes only a string. I need to pass alist of fields
instead. I was looking at the documentattion and I think I can write
soemthing like:

field1, field2, ..., fieldn = expr1, expr2, ..., exprn

This way one operator will check all the fields for equality.

Fed

Browse pgsql-general by date

  From Date Subject
Next Message Mike Rylander 2004-09-27 12:15:08 Re: checksum
Previous Message frederic.germaneau 2004-09-27 09:57:26 Réf. : Re: R?f. : Re: v8 on AIX5 .2