Skip to content

cause SQL scripts to stop immediately when unexpected errors occur

Marcel Huber requested to merge on_error_stop into master
  • cause SQL scripts to stop immediately when unexpected errors occur

  • make the output w.r.t. expected errors (constraints tests) more clear, so that it won't be as easily mistaken for a failed execution of the AngProj setup as it currently might be:

    Instead of

    BEGIN;
    BEGIN
    ALTER TABLE ProjektZuteilung
    ADD CONSTRAINT check_Zeitanteil
       CHECK (Zeitanteil between 10 and 90);
    ALTER TABLE
    UPDATE ProjektZuteilung SET Zeitanteil=99 where persnr = 1100;
    psql:5_queries.sql:108: ERROR:  new row for relation "projektzuteilung" violates check constraint "check_zeitanteil"
    DETAIL:  Failing row contains (1100, 26, 99, null, null).
    select * from ProjektZuteilung WHERE persnr = 1100;
    psql:5_queries.sql:109: ERROR:  current transaction is aborted, commands ignored until end of transaction block
    ROLLBACK;
    ROLLBACK

    it will now output

    psql:6_constraints_tests.sql:53: NOTICE:  The constraint worked and made the UPDATE fail with message: new row for relation "projektzuteilung" violates check constraint "check_zeitanteil"
    DO
Edited by Marcel Huber

Merge request reports