emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug fix attached: org-babel sql postgres, fix hardcode
@ 2020-12-08 16:39 Alan Light
  2020-12-12 17:59 ` Bastien
  0 siblings, 1 reply; 8+ messages in thread
From: Alan Light @ 2020-12-08 16:39 UTC (permalink / raw)
  To: emacs-orgmode


[-- 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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-02-04  4:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-08 16:39 Bug fix attached: org-babel sql postgres, fix hardcode Alan Light
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

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).