PlayFramework Evolutions & PostgreSQL Stored Procedures

22 Feb

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';
Code language: SQL (Structured Query Language) (sql)

Comment Form