emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alan Light <lightalan@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Bug fix attached: org-babel sql postgres, fix hardcode
Date: Tue, 8 Dec 2020 11:39:25 -0500	[thread overview]
Message-ID: <CAGvVPAyQOeikoirn2m35g1r6E0w43=uqVhpWdqtwnDxSo+KDJw@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 129 bytes --]

ob-sql.el does not respect the value of sql-postgres-program, thus causing
problem when running on Windows, etc.
Patch attached.

[-- Attachment #1.2: Type: text/html, Size: 192 bytes --]

[-- Attachment #2: 0001-Respect-the-value-of-sql-postgres-program-as-opposed.patch --]
[-- Type: application/octet-stream, Size: 1062 bytes --]

From 237c5a1d46675de78ccc32bc9a62cc1fd5300383 Mon Sep 17 00:00:00 2001
From: Alan Light <lightalan@gmail.com>
Date: Tue, 8 Dec 2020 11:27:34 -0500
Subject: [PATCH] Respect the value of sql-postgres-program as opposed to
 having psql hard-coded

---
 lisp/org/ob-sql.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
index 59cf19568e..8eca769d02 100644
--- a/lisp/org/ob-sql.el
+++ b/lisp/org/ob-sql.el
@@ -237,11 +237,12 @@ This function is called by `org-babel-execute-src-block'."
 				    (org-babel-process-file-name in-file)
 				    (org-babel-process-file-name out-file)))
 		    (`postgresql (format
-				  "%spsql --set=\"ON_ERROR_STOP=1\" %s -A -P \
+				  "%s%s --set=\"ON_ERROR_STOP=1\" %s -A -P \
 footer=off -F \"\t\"  %s -f %s -o %s %s"
 				  (if dbpassword
 				      (format "PGPASSWORD=%s " dbpassword)
 				    "")
+				  (or sql-postgres-program "psql")
 				  (if colnames-p "" "-t")
 				  (org-babel-sql-dbstring-postgresql
 				   dbhost dbport dbuser database)
-- 
2.25.1


             reply	other threads:[~2020-12-08 16:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08 16:39 Alan Light [this message]
2020-12-12 17:59 ` Bastien
2020-12-12 19:53   ` Alan Light
2020-12-13  0:18     ` Ihor Radchenko
2020-12-13  0:31       ` Alan Light
2020-12-13  0:52         ` Ihor Radchenko
2020-12-13  2:11           ` Tom Gillespie
2021-02-04  4:19         ` Kyle Meyer

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='CAGvVPAyQOeikoirn2m35g1r6E0w43=uqVhpWdqtwnDxSo+KDJw@mail.gmail.com' \
    --to=lightalan@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --subject='Re: Bug fix attached: org-babel sql postgres, fix hardcode' \
    /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

Code repositories for project(s) associated with this 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).