From: | David Johnston <polobo(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Stop execution without ERROR |
Date: | 2013-10-16 01:28:10 |
Message-ID: | 1381886890392-5774689.post@n5.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
james.sewell wrote
> Hello all,
>
> Let's say I'm running the following SQL script via psql -f
>
> BEGIN
> \set ON_ERROR_STOP
> SELECT myFunction();
> CREATE TABLE x(id int);
> END;
>
> Is there anything I can do in myFunction which will:
>
> a) Stop execution of the script so that x will not be created
> b) Not throw an error (return value of 0, no ERROR in output)
>
> I am currently using an EXCEPTION, which satisfies a, but not b.
No. To accomplish that kind of flow control requires that you use a
procedural language. pl/pgsql can serve that purpose. You can use a
function or a DO block to implement. Or code a shell script.
David J.
--
View this message in context: http://postgresql.1045698.n5.nabble.com/Stop-execution-without-ERROR-tp5774688p5774689.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Karsten Hilbert | 2013-10-16 06:32:41 | Re: Stop execution without ERROR |
Previous Message | James Sewell | 2013-10-16 01:04:53 | Stop execution without ERROR |