>From 4ca513afe3725fbfbefd7ad9bf54637adfd56ea2 Mon Sep 17 00:00:00 2001 From: Justin Kirby Date: Wed, 18 May 2016 23:14:48 -0400 Subject: [PATCH] add dbport parameter to postgresql dbstring If postgesql is running on a different port or using a ssh tunnel to remote db, the ability to specify a different port is needed. --- lisp/ob-sql.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el index 6488afe..5f96aa3 100644 --- a/lisp/ob-sql.el +++ b/lisp/ob-sql.el @@ -90,12 +90,13 @@ (when password (concat "-p" password)) (when database (concat "-D" database)))))) -(defun org-babel-sql-dbstring-postgresql (host user database) +(defun org-babel-sql-dbstring-postgresql (host port user database) "Make PostgreSQL command line args for database connection. Pass nil to omit that arg." (combine-and-quote-strings (delq nil (list (when host (concat "-h" host)) + (when port (format "-p%d" port)) (when user (concat "-U" user)) (when database (concat "-d" database)))))) @@ -145,7 +146,7 @@ This function is called by `org-babel-execute-src-block'." footer=off -F \"\t\" %s -f %s -o %s %s" (if colnames-p "" "-t") (org-babel-sql-dbstring-postgresql - dbhost dbuser database) + dbhost dbport dbuser database) (org-babel-process-file-name in-file) (org-babel-process-file-name out-file) (or cmdline ""))) -- 2.6.3