From: | Iaam Onkara <iamonkara(at)gmail(dot)com> |
---|---|
To: | Niranjan <niranjan81(at)gmail(dot)com> |
Cc: | pgsql-in-general(at)postgresql(dot)org |
Subject: | Re: md5 checksum of a given/previous row |
Date: | 2017-11-12 19:55:22 |
Message-ID: | CAMz9UCaj1+c7_ktzoC5-1RM8ynSadqfPce+aLjkcfoeJnWyKCA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-in-general |
I have tried the *lag* function but that works one only one column which
means I can get md5 checksum for one column.
But how do I use *lag* or something like lag to get the whole of the
previous row?
Thanks
Onkara
On Nov 12, 2017 1:53 PM, iamonkara(at)gmail(dot)com wrote:
> I have tried the lag function but that works one only one column which
> means I can get md5 checksum for one column.
>
> But how do I use lag or something like lag to get the whole of the
> previous row.
>
> On Nov 12, 2017 1:22 PM, "Niranjan" <niranjan81(at)gmail(dot)com> wrote:
>
> What all combinations have you tried?
>
>
> On 12-Nov-2017 23:56, "Iaam Onkara" <iamonkara(at)gmail(dot)com> wrote:
>
> Hi,
>
> I have a requirement to create an tamper proof chain of records for audit
> purposes. The pseudo code is as follows
>
> before_insert:
> 1. compute checksum of previous row (or conditionally selected row)
> 2. insert the computed checksum in the current row
>
> For now lets assume we are using md5 checksum, I can easily get the md5 of
> current row using
>
> select md5(textin(record_out(test))) as md5_checksum FROM test;
>
> but how do I compute md5 of previous row or of a row selected by where
> column=val;?
>
> Thanks.
> Onkara
>
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Iaam Onkara | 2017-11-12 22:45:28 | Re: md5 checksum of a given/previous row |
Previous Message | Iaam Onkara | 2017-11-12 18:26:33 | md5 checksum of a given/previous row |