summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Light <lightalan@gmail.com>2020-12-08 11:27:34 -0500
committerKyle Meyer <kyle@kyleam.com>2021-02-03 23:08:21 -0500
commit862048d4cb3bf93fb74832ed490c41faebb7d5b5 (patch)
treec184117ce904ad0db142cfcbfe7765e8ce475267
parente87959615904c1de7616fc0d2b33b8b32bd0a766 (diff)
downloadorg-mode-862048d4cb3bf93fb74832ed490c41faebb7d5b5.tar.gz
ob-sql.el: Respect the value of sql-postgres-program
* ob-sql.el (org-babel-execute:sql): Use `sql-postgres-program' as postgresql executable (instead of psql) when defined. psql will be the default. [km: tweaked commit message, added bound-and-true-p guard] TINYCHANGE
-rw-r--r--lisp/ob-sql.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 902194a..b9dd72b 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -245,11 +245,14 @@ 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 postgres) (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 (bound-and-true-p
+ sql-postgres-program)
+ "psql")
(if colnames-p "" "-t")
(org-babel-sql-dbstring-postgresql
dbhost dbport dbuser database)