sql到postgresql

我在sql中有一个代码,我正在使用它.对
postgresql不太熟悉.下面是我想要转换为postgresql的代码.我正在使用dbeaver 3.5.4

Update tablename
set record_hash = cast(hashbytes('MD5',
                  coalesce(id, '') +
                  coalesce(name, '') +
                  coalesce(created_date, '') +
                  coalesce(last_modified_date, '')
                  ) as bigint) 
;

最佳答案 你可以这样做:

Update tablename
set record_hash = ('x'|| substr(
                            md5(
                              coalesce(id, '') ||
                              coalesce(name, '') ||
                              coalesce(created_date, '') ||
                              coalesce(last_modified_date, '')
                            ),1,16)::bit(64)::bigint )

找到here怎么做hash => bigint转换.

点赞