Re: Calculating a hash / fingerprint for a row / tuple - Mailing list pgsql-general

From Tom Lane
Subject Re: Calculating a hash / fingerprint for a row / tuple
Date
Msg-id 3410.1144725714@sss.pgh.pa.us
Whole thread Raw
In response to Calculating a hash / fingerprint for a row / tuple  (Randall Lucas <rlucas@tercent.com>)
List pgsql-general
Randall Lucas <rlucas@tercent.com> writes:
> I'm looking for a way to calculate a hashcode or fingerprint for a row /
> tuple of arbitrary width.  The goal is to be able to store, in an audit
> table, a fingerprint which could be compared against a later fingerprint
> to detect changes (this application does not call for cryptographic
> level security, so a simple checksum would be adequate for now).
> Something like:

> SELECT id, row_hashcode(*) FROM my_table;

> id   |   row_hashcode
>  1    a3843587d893589ef321d31
>  2    934983497f9083298cb0843

Try "select md5(textin(record_out(mytbl.*))) from mytbl;" ... a bit
klugy, but it works.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Date & Time with time zone
Next
From: "Wei Wei"
Date:
Subject: Re: Date & Time with time zone