以下是我正在使用的查询语句,用于清洗JSONB列中的某些字段。我试图随机化名字,因此想要使用类似于md5(random() :: text)作为值的内容。
update people set
data = to_jsonb(data) || '{"firstName": "random_text", "lastName": "random_text"}'
where id = 'b3c09005-7afb-4ad6-922d-76078875e59e';
我尝试将 "random_text" 替换为 md5(...),但是出现了错误 "DETAIL: Token "md5" is invalid."。我还尝试使用 || 进行连接,但也没有成功。