« Return to Thread: New Topic: create function

New Topic: create function

by LiquiBase Community Forum :: Rate this Message:

Reply to Author | View in Thread

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
Liquibase-user@...
https://lists.sourceforge.net/lists/listinfo/liquibase-user

 « Return to Thread: New Topic: create function