PlayFramework Evolutions & PostgreSQL Stored Procedures

If you have to create a stored procedure in your PlayFramework Database Evolution Script, make sure to properly escape your semicolons (by using two semicolons):

CREATE OR REPLACE FUNCTION user_insert_update_query_function()
RETURNS TRIGGER AS $$
BEGIN
  NEW.query := lower(NEW.firstname) || '|' || lower(NEW.lastname);;
  RETURN NEW;;
END;;
$$ LANGUAGE 'plpgsql';

Leave a comment

Your email address will not be published. Required fields are marked *