开发者

Running M-x sql-postgres in emacs on windows

开发者 https://www.devze.com 2023-01-08 11:25 出处:网络
When I try to run an inferior psql process in emacs on windows, I seem to be getting no response.This seems to be a known problem the solution of which is to install the cygwin version of psql.Unfortu

When I try to run an inferior psql process in emacs on windows, I seem to be getting no response. This seems to be a known problem the solution of which is to install the cygwin version of psql. Unfortunately, the cygwin psql appears to do absolutely nothing, 开发者_如何学Ceven psql -V does nothing. Does anyone have a solution to either of these problems or an easy way of sending queries from emacs to postgresql.


This is probably not going to be a good answer, but I am not currently on a Windows machine with Emacs or PostGres, so I can't work out a better solution for you.

That said, are you able to run psql in a command shell? If so, perhaps you can try starting the shell (M-x shell) or the Eshell (M-x eshell) to start an inferior shell and running psql from there.

I was originally going to suggest that you call M-x shell-command (also M-!) and then specify psql & for your command. The & lets Emacs know that you want to run the shell command asynchronously. However, this entry on the EmacsWiki indicates that it will not work on Windows. You might try it anyway and see what happens...


Ok, I finally figured out how to get the cygwin psql to run. It seems that the provided cygpq.dll was missing some entry point,

strace -o /dev/null psql --version

Responded with "The procedure entrypoint PQencryptPassword could not be located in the dynamic link library cygpq.dll."

I replaced the cygwin provided cygpq.dll with a locally compiled one and it appears that we are now cooking with gas. I need to learn more about cygwin dynamic linking. I thank all of you for your patient support.


I had similar problem (but could not make the cygwin psql work).

Eventually, I discovered that both M-x sql-postgres and psql call in M-x shell are in fact interactive but without a visible prompt; i.e., one can type commands (at the very beginning of the last line) and they get executed as expected.

Before I realized that I had modified my postgres password file in order to avoid the password prompt and the initial hang of the psql call in M-x shell:

When the defaults aren't quite right, you can save yourself some typing by setting the environment variables PGDATABASE, PGHOST, PGPORT and/or PGUSER to appropriate values. (For additional environment variables, see the documentation.) It is also convenient to have a ~/.pgpass file to avoid regularly having to type in passwords. See the documentation for more information. (http://linux.die.net/man/1/psql)

0

精彩评论

暂无评论...
验证码 换一张
取 消