Subject: bug#11908: 24.1; "Unable to locate SQL program" when using sql-mysql with tramp and the client does not have the SQL program (but the server does)

From: Michael Albinus <[email-masked]>
Date: Fri, 13 Jul 2012 16:31:23 +0200

Francis Devereux <[email-masked]> writes:

> However, if you comment out the following lines in sql-comint in sql.el:
> ;    (unless (executable-find program)
> ;      (error "Unable to locate SQL program \'%s\'" program))
> then it works - you get an SQLi buffer running mysql in an ssh session on
> the server.

Indeed, `executable-find' does not work in this case. I would propose
the following check, which keeps the test for local processes:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs/lisp/progmodes/sql.el.~109053~	2012-07-13 16:25:32.863194360 +0200
--- /home/albinus/src/emacs/lisp/progmodes/sql.el	2012-07-13 16:24:52.026991734 +0200
***************
*** 4146,4153 ****
  passed as command line arguments."
    (let ((program (sql-get-product-feature product :sqli-program))
          (buf-name "SQL"))
!     ;; make sure we can find the program
!     (unless (executable-find program)
        (error "Unable to locate SQL program \'%s\'" program))
      ;; Make sure buffer name is unique
      (when (sql-buffer-live-p (format "*%s*" buf-name))
--- 4146,4155 ----
  passed as command line arguments."
    (let ((program (sql-get-product-feature product :sqli-program))
          (buf-name "SQL"))
!     ;; Make sure we can find the program.  `executable-find' does not
!     ;; work for remote hosts; we suppress the check there.
!     (unless (or (file-remote-p default-directory)
! 		(executable-find program))
        (error "Unable to locate SQL program \'%s\'" program))
      ;; Make sure buffer name is unique
      (when (sql-buffer-live-p (format "*%s*" buf-name))
--8<---------------cut here---------------end--------------->8---

Could you, please, check, whether this works for you?

> Francis

Best regards, Michael.