postgresql 判断某个字段是否为json数据,进行排查
·
创建检查字段是否为json的function,有些版本没有专门用来检查字段是否为json的函数,我们自己创建一个使用即可;sql当中使用这个函数即可筛选出不是json的数据
create or replace function is_valid_json(p_json text)
returns boolean
as
$$
begin
return (p_json::json is not null);
exception
when others then
return false;
end;
$$
language plpgsql
immutable;
更多推荐


所有评论(0)