瀏覽代碼

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
Alan Light 4 年之前
父節點
當前提交
862048d4cb
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      lisp/ob-sql.el

+ 4 - 1
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 in-file)
 				   (org-babel-process-file-name out-file)))
 				   (org-babel-process-file-name out-file)))
 		    ((postgresql postgres) (format
 		    ((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"
 footer=off -F \"\t\"  %s -f %s -o %s %s"
 					    (if dbpassword
 					    (if dbpassword
 						(format "PGPASSWORD=%s " dbpassword)
 						(format "PGPASSWORD=%s " dbpassword)
 					      "")
 					      "")
+                                            (or (bound-and-true-p
+                                                 sql-postgres-program)
+                                                "psql")
 					    (if colnames-p "" "-t")
 					    (if colnames-p "" "-t")
 					    (org-babel-sql-dbstring-postgresql
 					    (org-babel-sql-dbstring-postgresql
 					     dbhost dbport dbuser database)
 					     dbhost dbport dbuser database)