> When author hasn't articles, than table must have fake relation:(uid, -1)
Terrible idea. It complicates almost every operation that you can perform upon a table, because 99% of the time your application must pretend this row doesn't exist. Almost every SELECT statement will require modification. Suddenly you need special logic to handle these "special" non-existent rows. You can never permit the deletion of any row whose PK is fake. And finally, this solution is based on a misunderstanding of basic relational principles. Redesign without the fake IDs.
Two stages in debugging database logic in sprocs ...
1. Debug each step outside the sproc in the mysql client till they all work.
2. Then assemble the sproc from the debugged atomic statements, add handlers and signal stubs, eg ...
begin
declare exit handler for sqlexception -- or not found, or an error that you define
begin
signal sqlstate value '99999' set message_text='your err msg here';
end;
select 'running' as 'block 1';
-- your code here ...
end;