Is it possible to simulate a while loop using Liquibase XML or other formats?

Hello

Here is an example of heavy DB migration (postgresql):
run the following statement in a separate transaction unless it returns zero
      WHERE id in
(      RETURNING
1FROM updatedUpdating not so many rows in each step saves the live database from suffering from long transactions and locked rows, and looping guarantees all rows to be updated.

Is it possible to perform such a loop (execute some statement in a separate transaction repeatedly unless it returns zero) using any of Liquibase migration formats, e.g. using XML includes or whatever?

Regards,
  Alexey

This would need to be done inside a change tag or a custom change tag you write yourself. Liquibase itself does not have anything built-in like this.

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/

Unfortunately it is not possible to do it in SQL in PostgreSQL, at least not using JDBC (it is only possible to write it in psql scripting language in some ugly way).

Does Liquibase design allow to write a custom tag that results not in a fixed sequence of SQL statements, but to an interactive one, such as “run the following SQL repeatedly until it returns 0” or “run this SQL, if it failed run that one” ?

When you write a custom tag, you can do pretty much anything you want. We have written a custom tag for Oracle that allows you to run the sqlplus command line tool, which allows for the kinds of things you are talking about. Doing something similar for the psql scripting language wouldn’t be too difficult. There is also the change tag, which isn’t well documented, but might work for you. It looks something like this:

    

Steve Donie
Principal Software Engineer
Datical, Inc. http://www.datical.com/