I want to execute a SQL script in a client using JDBC (not the postgreSQL pslq client). In this script I would like to do something like that:
skip errors on;
alter table foo ...;
skip errors off;
Is there a way to do this with PostgreSQL >= 9.1?
I found this thread with a good solution usind
DO
blocks and error codes: How to continue sql script on error?And creating a function for my problem:
...use it: