It is because by default the <sql> tag is going to try to split statements on ;'s. There is a splitStatements="true|false" attribute you can set on the sql tag.
There is also a <createProcedure> tag that should do that for you automatically. Nathan -----Original Message----- From: LiquiBase Community Forum [mailto:[email protected]] Sent: Wednesday, June 24, 2009 10:10 AM To: [email protected] Subject: [Liquibase-user] New Topic: create function A new topic, 'create function', has been made on a board you are watching. You can see it at http://liquibase.org/forum/index.php?topic=60.new#new The text of the topic is shown below: Hi, I've got a Problem with creating a function: Code: <sql> <![CDATA[ CREATE FUNCTION heimtipps( tsp_id int4 ) RETURNS int4 AS' DECLARE anzahl int4; BEGIN SELECT count(*) INTO anzahl FROM spieltipp WHERE tippspiel_id = tsp_id AND spieltipp_heimtipp > spieltipp_gasttipp; RETURN anzahl; END' LANGUAGE 'plpgsql'; ]]> </sql> When I create the function direct to the postgres-database via console, it's created correctly doing this via liquibase, I got the following error: Code: Migration Failed: Error executing SQL CREATE FUNCTION heimtipps( tsp_id int4 ) RETURNS int4 AS' DECLARE anzahl int4. For more information, use the --logLevel flag) 24.06.2009 16:58:22 liquibase.commandline.Main main SCHWERWIEGEND: Error executing SQL CREATE FUNCTION heimtipps( tsp_id int4 ) RETURNS int4 AS' DECLARE anzahl int4 liquibase.exception.MigrationFailedException: Migration failed for change set de/kicktipp/liquibase/changelogs/changelog-0139.xml::1::janning: Reason: liquibase.exception.JDBCException: Error executing SQL CREATE FUNCTION heimtipps( tsp_id int4 ) RETURNS int4 AS' DECLARE anzahl int4: Caused By: Error executing SQL CREATE FUNCTION heimtipps( tsp_id int4 ) RETURNS int4 AS' DECLARE anzahl int4: Caused By: ERROR: unterminated quoted string at or near "' DECLARE anzahl int4" at liquibase.ChangeSet.execute(ChangeSet.java:238) at liquibase.parser.visitor.UpdateVisitor.visit(UpdateVisitor.java:26) at liquibase.parser.ChangeLogIterator.run(ChangeLogIterator.java:41) at liquibase.Liquibase.update(Liquibase.java:112) at liquibase.commandline.Main.doMigration(Main.java:646) at liquibase.commandline.Main.main(Main.java:95) Seems that liquibase expect a " ' " when it gets to the first " ; "!? But, of course the terminating " ' " is at the end of the function. Can anybody help me? Thanks for all answers. kind regards peter Unsubscribe to new topics from this board by clicking here: http://liquibase.org/forum/index.php?action=notifyboard;board=1.0 Regards, The LiquiBase Community Forum Team. ------------------------------------------------------------------------------ _______________________________________________ Liquibase-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/liquibase-user
