我一直在尝试更新哈希存储的错误迁移值,
"area_unit"=>NULL, "building_type"=>"{:building_type=>"apartment"}",
"area_unit"=>NULL, "building_type"=>"apartment"}",
的值应该保持不变,我不想使用正则表达式。有简单的方法吗?
我能够像下面这样做,而不是像我想要的通用解决方案,但它有效。
SELECT id, properties::hstore ->'building_type' FROM stops WHERE (properties->'building_type' like '{:building_type=>"apartment"}');
UPDATE stops SET properties = properties || '"building_type"=>"apartment"'::hstore
WHERE (properties->'building_type' like '{:building_type=>"apartment"}');