bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20422: 24.3; sql-connect uses local rather than remote client


From: Michael Albinus
Subject: bug#20422: 24.3; sql-connect uses local rather than remote client
Date: Mon, 19 Sep 2016 10:11:48 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Matthew Krauss <m.d.krauss@gmail.com> writes:

> Hi!

Hi Matthew,

> So I have encountered a minor problem. Not sure if this is a bug or a
> feature request...
>
> When using:
>
>     M-x sql-connect
>
> to connect to a SQL server (in my case PostgreSQL but I doubt that is
> relevant) Emacs does not seem to have a way to use the correct backend
> client (e.g. psql) to match the server version.
>
> So suppose the following configuration:
>
>     (setq sql-connection-alist
>           '(("my-older-postgres-server"
>              (sql-product 'postgres)
>              (sql-user "myusername")
>              (sql-password "mypassword")
>              (sql-server "myserver.example.com")
>              (sql-database "mydatabase"))))
>
> My local machine has, let's say, psql 9.3.6. The server has Postgres
> 8.4.14. Because these are different versions, some things will not work
> correctly. I may be able to install an older psql, but that may not work
> if I also am connecting to a different server running 9.3.6, or, say,
> 9.4.1.
>
> The obvious solution is to use the psql client on the server, which
> should match the server version. This is really easy to do, with Emacs
> and Tramp. For instance, I can open an eshell and enter:
>
>     cd /myserver.example.com:
>
> Now from this buffer I can invoke sql-connect and it will run the psql
> client from the remote machine. However, this is kind of a pain to do
> every time, and embarrassing when I am trying to show off in front of my
> non-emacs-using co-workers and fail to remember this step, only to have
> weird errors showing up.
>
> Now if I could use this configuration instead:
>
>     (setq sql-connection-alist
>           '(("my-older-postgres-server"
>              (sql-product 'postgres)
>              (sql-user "myusername")
>              (sql-password "mypassword")
>              (sql-server "myserver.example.com")
>              (sql-database "mydatabase")
>              (default-directory "/myserver.example.com:"))))
>
> and have that change the working directory before connecting, that would
> be really great! Not only does it allow invoking a remote psql process,
> but it also allows changing the working directory for any other purpose
> you might want.

Well, personally I don't use sql.el, so I cannot say too much
about. However, the just released Emacs 25.1 says in etc/NEWS:

--8<---------------cut here---------------start------------->8---
** SQL mode

*** New user variable 'sql-default-directory' enables remote
connections using Tramp.
--8<---------------cut here---------------end--------------->8---

Sounds like this is exactly what you have asked for. Could you, please, check?

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]