Thread: psql and Emacs on Windows

psql and Emacs on Windows

From
Wenjian Yang
Date:
Hi,

I'm trying to get more users to use PostgreSQL more often. Some of them are familiar using the sql-mode in Emacs to access MS-SQL and Oracle from Windows Desktops, but it doesn't work for PostgreSQL.

We currently installed emacs 23.1 and PostgreSQL 8.4.0 for Windows on a windows desktop. When issue "sql-postgres" in emacs, after providing User/Password/Database/Server, nothing happens. There is no prompt from emacs. Checking the server log, it doesn't seem to have received any connection request.

The above works fine on a linux box using emacs to access PostgreSQL.

I'm also sending the question to the emacs help list, since I'm not an expert in emacs either.

Thanks.

Wenjian Yang


Re: psql and Emacs on Windows

From
Sam Mason
Date:
On Fri, Aug 07, 2009 at 11:11:10AM -0500, Wenjian Yang wrote:
> We currently installed emacs 23.1 and PostgreSQL 8.4.0 for Windows on a
> windows desktop. When issue "sql-postgres" in emacs, after providing
> User/Password/Database/Server, nothing happens. There is no prompt from
> emacs. Checking the server log, it doesn't seem to have received any
> connection request.

The current setup on my windows box uses the psql that comes with
cygwin.  Unfortunately I don't use it enough to remember the details of
how or why I settled on this setup.

> The above works fine on a linux box using emacs to access PostgreSQL.

Yes, this is much more reliable in my experience.

--
  Sam  http://samason.me.uk/

Re: psql and Emacs on Windows

From
"Joshua D. Drake"
Date:
On Fri, 2009-08-07 at 17:36 +0100, Sam Mason wrote:
> On Fri, Aug 07, 2009 at 11:11:10AM -0500, Wenjian Yang wrote:
> > We currently installed emacs 23.1 and PostgreSQL 8.4.0 for Windows on a
> > windows desktop. When issue "sql-postgres" in emacs, after providing
> > User/Password/Database/Server, nothing happens. There is no prompt from
> > emacs. Checking the server log, it doesn't seem to have received any
> > connection request.
>
> The current setup on my windows box uses the psql that comes with
> cygwin.  Unfortunately I don't use it enough to remember the details of
> how or why I settled on this setup.

readline?

>
--
PostgreSQL - XMPP: jdrake@jabber.postgresql.org
   Consulting, Development, Support, Training
   503-667-4564 - http://www.commandprompt.com/
   The PostgreSQL Company, serving since 1997

Re: psql and Emacs on Windows

From
"Bill Bartlett"
Date:
On Friday, August 07, 2009 12:44 PM, Joshua D. Drake wrote:
> On Fri, 2009-08-07 at 17:36 +0100, Sam Mason wrote:
> > On Fri, Aug 07, 2009 at 11:11:10AM -0500, Wenjian Yang wrote:
> > > We currently installed emacs 23.1 and PostgreSQL 8.4.0 for Windows on a
> > > windows desktop. When issue "sql-postgres" in emacs, after providing
> > > User/Password/Database/Server, nothing happens. There is no prompt from
> > > emacs. Checking the server log, it doesn't seem to have received any
> > > connection request.
> >
> > The current setup on my windows box uses the psql that comes with
> > cygwin.  Unfortunately I don't use it enough to remember the details of
> > how or why I settled on this setup.
>
> readline?
>

Yes, the problem is readline.  When running the "native" psql.exe from inside
any sort of a "shell" program on Windows (such as from inside emacs, rxvt,
remote SSH command line, etc.), psql thinks it is running in batch mode so you
see no prompts.  It is indeed running, but you'll see no interactive
information.

Re: psql and Emacs on Windows

From
"Joshua D. Drake"
Date:
On Fri, 2009-08-07 at 17:36 +0100, Sam Mason wrote:
> On Fri, Aug 07, 2009 at 11:11:10AM -0500, Wenjian Yang wrote:
> > We currently installed emacs 23.1 and PostgreSQL 8.4.0 for Windows on a
> > windows desktop. When issue "sql-postgres" in emacs, after providing
> > User/Password/Database/Server, nothing happens. There is no prompt from
> > emacs. Checking the server log, it doesn't seem to have received any
> > connection request.
>
> The current setup on my windows box uses the psql that comes with
> cygwin.  Unfortunately I don't use it enough to remember the details of
> how or why I settled on this setup.

readline?

>
--
PostgreSQL - XMPP: jdrake@jabber.postgresql.org
   Consulting, Development, Support, Training
   503-667-4564 - http://www.commandprompt.com/
   The PostgreSQL Company, serving since 1997


Re: psql and Emacs on Windows

From
Wenjian Yang
Date:
Thanks for the replies.

I tried Cygwin and unfortunately failed to get it to work with the "native" emacs binary for windows. I didn't spend too much time to try though, since the version of postgresql with cygwin is still 8.2.*, and I'm not sure how good the future support will be...

I did try another option, using both emacs and psql from Portable Ubuntu, that works fine as expected. The version of psql is 8.3. Now, I need to see how well it can connect to other databases from within Ubuntu, ;-) But the worst case the user can use two emacs (from windows and from Ubuntu) if they have to.

It would be nice to have native psql for Windows and native emacs for Windows work out of box in the future though.

Thanks again.

Wenjian


On Fri, Aug 7, 2009 at 1:12 PM, Bill Bartlett <bbartlett@softwareanalytics.com> wrote:
On Friday, August 07, 2009 12:44 PM, Joshua D. Drake wrote:
> On Fri, 2009-08-07 at 17:36 +0100, Sam Mason wrote:
> > On Fri, Aug 07, 2009 at 11:11:10AM -0500, Wenjian Yang wrote:
> > > We currently installed emacs 23.1 and PostgreSQL 8.4.0 for Windows on a
> > > windows desktop. When issue "sql-postgres" in emacs, after providing
> > > User/Password/Database/Server, nothing happens. There is no prompt from
> > > emacs. Checking the server log, it doesn't seem to have received any
> > > connection request.
> >
> > The current setup on my windows box uses the psql that comes with
> > cygwin.  Unfortunately I don't use it enough to remember the details of
> > how or why I settled on this setup.
>
> readline?
>

Yes, the problem is readline.  When running the "native" psql.exe from inside
any sort of a "shell" program on Windows (such as from inside emacs, rxvt,
remote SSH command line, etc.), psql thinks it is running in batch mode so you
see no prompts.  It is indeed running, but you'll see no interactive
information.

From my 8/4/2007 response to a similar posting:

(start)
We use the Cygwin version of the psql.exe program under Windows instead of the
native psql.exe program, even though the rest of the PostgreSQL installation
uses the standard native Windows versions of all the other PostgreSQL components
(database, tools, etc.).  (So before I get flamed, I want to clarify that the
ONLY component of PostgreSQL that we use from Cygwin is psql.exe, and it's run
from an alternate directory.)

The main advantage that we get by using the Cygwin version of psql is that is
runs in "interactive" mode regardless of how it is run, whereas the native psql
program runs in non-interactive mode (showing almost no output, no prompts, no
readline support, etc.) when run from most "shell" programs.  We frequently run
psql via a remote SSH connection or from the RXVT terminal program or from
inside Emacs, and in all of these cases the native psql program runs in
non-interactive mode whereas the Cygwin version of psql is fully-functional."
(end)




--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general