You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Some blocks like BEGIN/END or IF/END IF are not handled.
To Reproduce
This code is formatted like that:
CREATE OR REPLACE PROCEDURE lock_object(
IN obj_uid UUID,
IN id_user VARCHAR(255)
) AS $$
DECLARE found_id_user VARCHAR(255);
BEGIN found_id_user := (
SELECTlocked_objects.id_userFROM locked_objects
WHERElocked_objects.uid= obj_uid
);
IF id_user <> found_id_user THEN raise exception 'The object % is already locked by someone else',
obj_uid;
END IF;
UPDATE locked_objects
SET instant =CURRENT_TIMESTAMPWHERE uid = obj_uid;
ELSE
INSERT INTO locked_objects (uid, id_user)
VALUES (obj_uid, id_user);
END IF;
COMMIT;
END;
$$ LANGUAGE plpgsql;
Expected behavior
It should look something like that:
CREATE OR REPLACE PROCEDURE lock_object(
IN obj_uid UUID,
IN id_user VARCHAR(255)
) AS $$
DECLARE
found_id_user VARCHAR(255);
BEGIN
found_id_user := (
SELECTlocked_objects.id_userFROM locked_objects
WHERElocked_objects.uid= obj_uid
);
IF found_id_user IS NOT NULL THEN
IF id_user <> found_id_user THEN
raise exception 'The object % is already locked by someone else', obj_uid;
END IF;
UPDATE locked_objects
SET instant =CURRENT_TIMESTAMPWHERE uid = obj_uid;
ELSE
INSERT INTO locked_objects (uid, id_user)
VALUES (obj_uid, id_user);
END IF;
COMMIT;
END;
$$ LANGUAGE plpgsql;
The text was updated successfully, but these errors were encountered:
Describe the bug
Some blocks like BEGIN/END or IF/END IF are not handled.
To Reproduce
This code is formatted like that:
Expected behavior
It should look something like that:
The text was updated successfully, but these errors were encountered: