loadUpdateData doesn't work in PSQL less than 9.0

It generates statements like 


  1. DO
  2. $$
  3. BEGIN
  4. UPDATE network SET name = 'ben' WHERE id = 3;
  5. IF not found THEN
  6. INSERT INTO network (id, name) VALUES (3, 'ben');
  7. END IF;
  8. END;
  9. $$
  10. LANGUAGE plpgsql;
And PSQL 8.4 is throwing when it sees the DO:


org.postgresql.util.PSQLException: ERROR: syntax error at or near “DO”

Has anyone else seen this? Is there a workaround?


I’ve also tried running the SQL generated by updateSQL, and it throws at the same place in psql. 


I’m on Liquibase 2.0.


Thanks,


–ben

Hi, I have also the same problem. I’m on Postgres 8.2.

Hi, I did the test and i confirm that it works only with a version of Postgres greater than 9.0. Is there a way to work with Postgres 8.x ?

Thanks.

Created http://forum.liquibase.org/topic/loaddataupdate-doesn-t-work-in-psql-less-than-9-0#49382000000134002 to track the issue. 


If anyone has postgres 8.x compatible syntax they think will work, let me know.


Nathan

Hi,


this error happens to me.

  • CREATE OR REPLACE FUNCTION test()
  •     RETURNS integer AS
  • $$
  • DECLARE
  •     mtrp RECORD;
  • BEGIN

  • can anyone help?


    PostgreSQL version: 8.3

    Liquibase version: 2.0.1


    Thanks

    hi you wrote this function in sql tag in your change set and use statement.


    ex:

           
               
           
          
           
               CREATE OR REPLACE FUNCTION test()

    1.     RETURNS integer AS
    2. $$
    3. DECLARE
    4.     mtrp RECORD;
    5. BEGIN


    /changeSet>