emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] not handling failing sql statements in ob-sql.el with postgresql


From: Eric Schulte
Subject: Re: [O] not handling failing sql statements in ob-sql.el with postgresql
Date: Sun, 01 Dec 2013 11:07:36 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Joost Helberg <address@hidden> writes:

> Hi,
>
> in case psql (version 9.1 and later) encounters a SQL error, e.g. a
> syntax error, it doesn't exit with an error-code. Instead it
> continues and exits with 0. This means that evaluating faulty SQL-code
> in org-mode/babel leaves the user with no clue of why the result set is
> empty. 
>
> I changed the code in ob-sql.el by adding the 
>     --set="ON_ERROR_STOP-1"
> command-line option to the psql command in order to make things work
> correct. This option not only makes psql exit at the first error, it
> also exits with a not 0 error-code.
>
> line 125 and further of my ob-sql.el:
>     ('postgresql (format
>         "psql --set=\"ON_ERROR_STOP=1\" -A -P footer=off -F \"\t\"  -f %s -o 
> %s %s"
>         (org-babel-process-file-name in-file)
>         (org-babel-process-file-name out-file)
>         (or cmdline "")))
>
> Is this a change worth applying? Or will it break things?
>
> regards,
>
> Joost

I just applied this change.  Thanks,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D



reply via email to

[Prev in Thread] Current Thread [Next in Thread]