emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <schulte.eric@gmail.com>
To: Joost Helberg <joost@snow.nl>
Cc: Emacs Org mode <emacs-orgmode@gnu.org>
Subject: Re: not handling failing sql statements in ob-sql.el with postgresql
Date: Sun, 01 Dec 2013 11:07:36 -0700	[thread overview]
Message-ID: <8738mctpg7.fsf@gmail.com> (raw)
In-Reply-To: <87y54ab2db.fsf@snow.nl> (Joost Helberg's message of "Wed, 27 Nov 2013 10:49:52 +0100")

Joost Helberg <joost@snow.nl> 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

      parent reply	other threads:[~2013-12-01 18:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27  9:49 not handling failing sql statements in ob-sql.el with postgresql Joost Helberg
2013-11-27 14:28 ` Rick Frankel
2013-12-01 18:07 ` Eric Schulte [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738mctpg7.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=joost@snow.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).