emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rick Frankel <rick@rickster.com>
To: emacs-orgmode@gnu.org
Subject: Re: not handling failing sql statements in ob-sql.el with postgresql
Date: Wed, 27 Nov 2013 09:28:17 -0500	[thread overview]
Message-ID: <925ec24caf24dbf184ea266ac3b77fc6@mail.rickster.com> (raw)
In-Reply-To: <87y54ab2db.fsf@snow.nl>

On 2013-11-27 04:49, Joost Helberg wrote:
> 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
> 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?

Did a quick check, and this option goes all the way back to postgresql
7.1, so it looks like it won't break anything that shouldn't be
broken :), and should be applied.

rick

  reply	other threads:[~2013-11-27 14:28 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 [this message]
2013-12-01 18:07 ` Eric Schulte

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=925ec24caf24dbf184ea266ac3b77fc6@mail.rickster.com \
    --to=rick@rickster.com \
    --cc=emacs-orgmode@gnu.org \
    /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).