ALTER TABLE social.feedback_task ADD COLUMN object_id bigint;

UPDATE social.feedback_task
SET object_id =
    CASE
    WHEN attrs->>'nmaps_link' like 'https://n.maps.yandex.ru/#!/objects/%' THEN
        (substring(attrs->>'nmaps_link' from length('https://n.maps.yandex.ru/#!/objects/') + 1))::bigint
    ELSE
        (attrs->>'nmaps_link')::bigint
    END
WHERE attrs->'nmaps_link' IS NOT NULL;
