Richard Huxton <> writes:
> Michael Paesold wrote:
>> I just don't see why non-interactive mode does need such a switch 
>> because there is no way to check if there was an error. So just put two 
>> queries there and hope one will work?


Unconvincing.  What if the drop fails for permission reasons, rather
than because the table's not there?  Then the CREATE will fail too
... but now the script bulls ahead regardless, with who knows what
bad consequences.

I would far rather see people code explicit markers around statements
whose failure can be ignored.  That is, a script that needs this
behavior ought to look like

        DROP TABLE foo;
        CREATE ...

where I'm supposing that we invent psql backslash commands to cue
the sending of SAVEPOINT and RELEASE-or-ROLLBACK commands.  (Anyone
got a better idea for the names than that?)

Once you've got such an infrastructure, it makes sense to allow an
interactive mode that automatically puts such things around each
statement.  But I can't really see the argument for using such a
behavior in a script.  Scripts are too stupid.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to