all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#23242: [PATCH] ob-sql.el: set PGPASSWORD environment
@ 2016-04-08 10:24 Andreas Gerler
  2016-04-08 15:45 ` Andreas Schwab
  2017-06-14 23:57 ` npostavs
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Gerler @ 2016-04-08 10:24 UTC (permalink / raw)
  To: 23242; +Cc: Andreas Gerler

* postgresql: set environment variable PGPASSWORD if dbpassword was supplied
---
 lisp/ob-sql.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 6488afe..bd3a51e 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -141,8 +141,9 @@ 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
-				  "psql --set=\"ON_ERROR_STOP=1\" %s -A -P \
+				  "%s psql --set=\"ON_ERROR_STOP=1\" %s -A -P \
 footer=off -F \"\t\"  %s -f %s -o %s %s"
+				  (if dbpassword (concat "PGPASSWORD='" dbpassword "'") "")
 				  (if colnames-p "" "-t")
 				  (org-babel-sql-dbstring-postgresql
 				   dbhost dbuser database)
-- 
2.4.5






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

* bug#23242: [PATCH] ob-sql.el: set PGPASSWORD environment
  2016-04-08 10:24 bug#23242: [PATCH] ob-sql.el: set PGPASSWORD environment Andreas Gerler
@ 2016-04-08 15:45 ` Andreas Schwab
  2017-06-14 23:57 ` npostavs
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2016-04-08 15:45 UTC (permalink / raw)
  To: Andreas Gerler; +Cc: 23242

Andreas Gerler <baron@bundesbrandschatzamt.de> writes:

>  		    (`postgresql (format
> -				  "psql --set=\"ON_ERROR_STOP=1\" %s -A -P \
> +				  "%s psql --set=\"ON_ERROR_STOP=1\" %s -A -P \
>  footer=off -F \"\t\"  %s -f %s -o %s %s"
> +				  (if dbpassword (concat "PGPASSWORD='" dbpassword "'") "")

This will fail if dbpassword contains ?\'.  Environment variables should
be passed via process-environment.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#23242: [PATCH] ob-sql.el: set PGPASSWORD environment
  2016-04-08 10:24 bug#23242: [PATCH] ob-sql.el: set PGPASSWORD environment Andreas Gerler
  2016-04-08 15:45 ` Andreas Schwab
@ 2017-06-14 23:57 ` npostavs
  1 sibling, 0 replies; 3+ messages in thread
From: npostavs @ 2017-06-14 23:57 UTC (permalink / raw)
  To: Andreas Gerler; +Cc: 23242

severity 23242 minor
close 23242 
quit

Andreas Gerler <baron@bundesbrandschatzamt.de> writes:

> * postgresql: set environment variable PGPASSWORD if dbpassword was supplied

This has been implemented in the org-mode repository.

2016-09-17 08:34:59 (GMT)
ob-sql: Add dbport and dbpassword options to postgresql
* lisp/ob-sql.el (org-babel-sql-dbstring-postgresql): Add port parameter.
(org-babel-execute:sql): Handle password and port in `postgresql' SQL engine.

http://orgmode.org/cgit.cgi/org-mode.git/commit/?id=c257e31d10128f0c6705cee9586e9fc436ddfc28





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

end of thread, other threads:[~2017-06-14 23:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-08 10:24 bug#23242: [PATCH] ob-sql.el: set PGPASSWORD environment Andreas Gerler
2016-04-08 15:45 ` Andreas Schwab
2017-06-14 23:57 ` npostavs

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.