I\'m trying to check if a key exists in a JSON sent as parameter in a PL/pgSQL function.
Here is the function.
CREATE FUNCTION sp_update_user(user_in
Found a simpler solution that checks if the json key have a value.
IF (user_info->>'username') IS NOT NULL
THEN
RAISE NOTICE 'username';
UPDATE users SET username = user_info->>'username' WHERE id = sp_update_user.user_id;
END IF;
This checks if the key 'username' in the json have a volume other than NULL.