在PostgreSQL中查找行的哈希值 [英] Finding the hash value of a row in postgresql
本文介绍了在PostgreSQL中查找行的哈希值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法在postgresql中获取行的哈希码?
Is there a way to get the hash code of a row in postgresql?
仅在上次导出后数据发生某些变化时才需要导出一些数据,最后导出的数据行可以存储在表中,当同样,我需要导出数据,我可以获取所有数据的哈希值,并且仅导出哈希值与上次导出不同的行。
I need to export some data only if there is some changes in the data after the last export, the last exported data rows can be stored in a table, the when the again I need to export the data I can get the hash values of all the data and export only those rows who has a different hash value than the last export.
是吗可以使用postgresql实现吗?
Is it possible to achieve using postgresql?
谢谢
推荐答案
行到文本并使用md5进行哈希处理:
Cast the row to text and use md5 to make a hash:
SELECT
md5(CAST((f.*)AS text))
FROM
foo f;
这篇关于在PostgreSQL中查找行的哈希值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文