Reputation: 1189
Here's my evolution 1.sql
CREATE OR REPLACE FUNCTION update_changetimestamp_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.changetimestamp = now();
RETURN NEW;
END;
$$ language 'plpgsql';
But when I apply this evolution, play-slick is giving me this error
we got the following error: ERROR: unterminated dollar-quoted string at or near "$$ BEGIN NEW.changetimestamp = now()" Position: 79 [ERROR:0, SQLSTATE:42601], while trying to run this SQL script:
Any idea what's going on? I could create that function on postgres console directly
Upvotes: 0
Views: 328
Reputation: 71
Hi Steve did you solve your issue?
If you check Play's manual about evolutions you will find the following:
Play splits your .sql files into a series of semicolon-delimited statements before executing them one-by-one against the database. So if you need to use a semicolon within a statement, escape it by entering ;; instead of ;. For example,
INSERT INTO punctuation(name, character) VALUES ('semicolon', ';;');
.
Your script should be modified to:
CREATE OR REPLACE FUNCTION update_changetimestamp_column()
RETURNS TRIGGER AS $$
BEGIN
NEW.changetimestamp = now();;
RETURN NEW;;
END;;
$$ language 'plpgsql';
Upvotes: 1