How do I create a function in PostgreSQL using evolutions in the Play framework? How do I create a function in PostgreSQL using evolutions in the Play framework? postgresql postgresql

How do I create a function in PostgreSQL using evolutions in the Play framework?


This is an artifact of how Play parses evolutions. Since it parses each statement on semicolons, it can't handle stored procedure definitions. The problem has been addressed in Play 2.1 by allowing you to specify embedded semicolons by doubling them. See https://github.com/playframework/Play20/pull/649, for instance.

Using ;; solved a similar problem for me, using Play 2.1. I'd suggest that you redefine your evolution as follows, and try again:

CREATE OR REPLACE FUNCTION idx(myArray anyarray, myElement anyelement) RETURNS int AS $$ SELECT i FROM (  SELECT generate_series(array_lower(myArray,1),array_upper(myArray,1)) ) g(i) WHERE myArray[i] = anyElement LIMIT 1;; $$ LANGUAGE sql IMMUTABLE;