Subject: sql-mode: sql-comint-postgres can't decide if sql-port is an integer or port
From: Andrew Schein <[email-masked]>
To: [email-masked]
Date: Tue, 20 Sep 2011 18:08:51 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

sql-port is initialized as an integer in sql.el, but later treated as
a string when building up the params variable within the function
sql-comint-postgres.  Below is my small patch that fixes this.

Cheers,

Andy

=== modified file 'lisp/progmodes/sql.el'
*** lisp/progmodes/sql.el       2011-07-06 03:51:48 +0000
--- lisp/progmodes/sql.el       2011-09-21 00:56:35 +0000
*************** Try to set `comint-output-filter-functio
*** 4719,4731 ****
    ;; sql-postgres-options.
    (let ((params options))
      (if (not (string= "" sql-database))
!       (setq params (append params (list sql-database))))
      (if (not (string= "" sql-server))
!       (setq params (append (list "-h" sql-server) params)))
      (if (not (string= "" sql-user))
!       (setq params (append (list "-U" sql-user) params)))
      (if (not (= 0 sql-port))
!       (setq params (append (list "-p" sql-port) params)))
      (sql-comint product params)))

  (defun sql-postgres-completion-object (sqlbuf schema)
--- 4719,4731 ----
    ;; sql-postgres-options.
    (let ((params options))
      (if (not (string= "" sql-database))
!     (setq params (append params (list sql-database))))
      (if (not (string= "" sql-server))
!     (setq params (append (list "-h" sql-server) params)))
      (if (not (string= "" sql-user))
!     (setq params (append (list "-U" sql-user) params)))
      (if (not (= 0 sql-port))
!     (setq params (append (list "-p" (number-to-string sql-port)) params)))
      (sql-comint product params)))

  (defun sql-postgres-completion-object (sqlbuf schema)

--
Andrew I. Schein
www.andrewschein.com