[MySQL] json_valid() function does not exist in PG/YB
shubham-yb opened this issue · 0 comments
shubham-yb commented
Jira Link: DB-13460
MySQL has a function json_valid() which returns 0 or 1 to indicate whether a value is valid JSON.
We do not have an alternative function to do this in PG/YB.
Workaround:
Create the function manually on the target.:
create or replace function json_valid(p_json text)
returns boolean
as
$$
begin
return (p_json::json is not null);
exception
when others then
return false;
end;
$$
language plpgsql
immutable;