Snatch any course you want for just $15! Go to “Courses” and find a course ↓
Side-effects in functions
Invoking functions


Okay! There's another option in PL/pgSQL for calling a function: using the PERFORM statement.

When we use SELECT inside a function, we must keep the result of the function.

PERFORM allows us to evaluate an expression or SELECT query but discard the result (e.g., when calling a function that has side effects but no useful return value).

The example below demonstrates how to call a function in PL/pgSQL using the PERFORM statement:

CREATE FUNCTION schedule_event(id integer, name varchar(60), city varchar(60))
RETURNS void AS $$
  PERFORM add_event(id, name, city);
  PERFORM remove_announcement(id);
$$ LANGUAGE plpgsql;


Write a function named remove_post_author() that takes one input parameter post_id of type integer. The function should find the ID of the post author and remove their user account with the help of the function remove_user_account(user_id).