소스 검색

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