Re: Calculating a hash / fingerprint for a row / tuple

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Randall Lucas <rlucas(at)tercent(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Calculating a hash / fingerprint for a row / tuple
Date: 2006-04-11 03:21:54
Message-ID: 3410.1144725714@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Randall Lucas <rlucas(at)tercent(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark Aufflick 2006-04-11 04:26:17 Re: LW Boston
Previous Message Randall Lucas 2006-04-11 02:54:46 Calculating a hash / fingerprint for a row / tuple