Thread: psql shell problem

psql shell problem

From
Frank Bax
Date:
I have a machine with OpenBSD 2.6 and PSQL 6.5.3 that allows the use of
up-arrow to retreive/edit previous commands.

I recently built a new machine with OpenBSD 2.8 and PSQL 7.0.2 (from
package) and this feature is GONE!

Is there some way to get this functionality back (hopefully without
changing a compile-time option and compiling from source)?

Frank

Re: psql shell problem

From
Patrick Welche
Date:
On Mon, May 21, 2001 at 10:32:37AM -0400, Frank Bax wrote:
> I have a machine with OpenBSD 2.6 and PSQL 6.5.3 that allows the use of
> up-arrow to retreive/edit previous commands.
>
> I recently built a new machine with OpenBSD 2.8 and PSQL 7.0.2 (from
> package) and this feature is GONE!
>
> Is there some way to get this functionality back (hopefully without
> changing a compile-time option and compiling from source)?

Did you install GNU readline on one and not the other?
Does OpenBSD 2.8 come with /usr/include/readline/readline.h and
/usr/lib/libedit.* ?

Cheers,

Patrick

Re: psql shell problem

From
Peter Eisentraut
Date:
Frank Bax writes:

> I have a machine with OpenBSD 2.6 and PSQL 6.5.3 that allows the use of
> up-arrow to retreive/edit previous commands.
>
> I recently built a new machine with OpenBSD 2.8 and PSQL 7.0.2 (from
> package) and this feature is GONE!

Install readline and rebuild.

> Is there some way to get this functionality back (hopefully without
> changing a compile-time option and compiling from source)?

Sorry.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: psql shell problem

From
"Denis A. Doroshenko"
Date:
this is logical flaw in PostgreSQL's psql include file (input.h). I
wrote, but have been told it was ok, and nobody wanted to change it.
Personally i patch every version of PostgreSQL by hand to get readline
edit mode working. Yeah, that sucks...

On Mon, May 21, 2001 at 10:32:37AM -0400, Frank Bax wrote:
> I have a machine with OpenBSD 2.6 and PSQL 6.5.3 that allows the use of
> up-arrow to retreive/edit previous commands.
>
> I recently built a new machine with OpenBSD 2.8 and PSQL 7.0.2 (from
> package) and this feature is GONE!
>
> Is there some way to get this functionality back (hopefully without
> changing a compile-time option and compiling from source)?
>
> Frank

--
Denis A. Doroshenko  [GPRS/IN/WAP, VAS group engineer] .-.        _|_  |
[Omnitel Ltd., T.Sevcenkos st. 25, Vilnius, Lithuania] | | _ _  _ .| _ |
[Phone: +370 9863486 E-mail: d.doroshenko@omnitel.net] |_|| | || |||(/_|_

Re: psql shell problem

From
"Denis A. Doroshenko"
Date:
On Mon, May 21, 2001 at 05:28:22PM +0200, Peter Eisentraut wrote:
> Frank Bax writes:
>
> > I have a machine with OpenBSD 2.6 and PSQL 6.5.3 that allows the use of
> > up-arrow to retreive/edit previous commands.
> >
> > I recently built a new machine with OpenBSD 2.8 and PSQL 7.0.2 (from
> > package) and this feature is GONE!
>
> Install readline and rebuild.

no need for that. OpenBSD has GNU readline. may be not the
latest-coolest-super-duper-GNU-tool-that-fits-all-and-even-more, but
normal library which _works_ if before making you move one line in
psql's input.h. why install new if the older one works like a charm?

--
Denis A. Doroshenko  [GPRS/IN/WAP, VAS group engineer] .-.        _|_  |
[Omnitel Ltd., T.Sevcenkos st. 25, Vilnius, Lithuania] | | _ _  _ .| _ |
[Phone: +370 9863486 E-mail: d.doroshenko@omnitel.net] |_|| | || |||(/_|_

Re: psql shell problem

From
"Richard Huxton"
Date:
From: "Frank Bax" <fbax@sympatico.ca>

> I have a machine with OpenBSD 2.6 and PSQL 6.5.3 that allows the use of
> up-arrow to retreive/edit previous commands.
>
> I recently built a new machine with OpenBSD 2.8 and PSQL 7.0.2 (from
> package) and this feature is GONE!
>
> Is there some way to get this functionality back (hopefully without
> changing a compile-time option and compiling from source)?

Check the docs/FAQ for mentions of the "readline" library - you either
haven't got it or install didn't find it.

You are going to need a recompile, but if you're cunning you might be able
to get away with just recompiling the client (don't ask me how).

- Richard Huxton


RE: psql shell problem

From
Abhimanyu_Bhola
Date:
Does postgresql has any windows clients(like there is psql for unix
environment) ?if there, where can i download from?

Regards,
Abhi



http://www.postgresql.org/users-lounge/docs/faq.html

Re: psql shell problem

From
Peter Eisentraut
Date:
Denis A. Doroshenko writes:

> On Mon, May 21, 2001 at 05:28:22PM +0200, Peter Eisentraut wrote:
> > Frank Bax writes:
> >
> > > I have a machine with OpenBSD 2.6 and PSQL 6.5.3 that allows the use of
> > > up-arrow to retreive/edit previous commands.
> > >
> > > I recently built a new machine with OpenBSD 2.8 and PSQL 7.0.2 (from
> > > package) and this feature is GONE!
> >
> > Install readline and rebuild.
>
> no need for that. OpenBSD has GNU readline. may be not the
> latest-coolest-super-duper-GNU-tool-that-fits-all-and-even-more, but
> normal library which _works_ if before making you move one line in
> psql's input.h. why install new if the older one works like a charm?

You must have a peculiar definition of "works" and "charm", if you read
the original poster's message.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


RE: psql shell problem

From
Peter Eisentraut
Date:
Abhimanyu_Bhola writes:

> Does postgresql has any windows clients(like there is psql for unix
> environment) ?if there, where can i download from?

You can build psql on Windows.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


RE: psql shell problem

From
Peter Eisentraut
Date:
Abhimanyu_Bhola writes:

> Can u elaborate please??
> how to build psql??

http://www.ca.postgresql.org/devel-corner/docs/postgres/install-win32.html

Never tried it, though.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


RE: psql shell problem

From
Abhimanyu_Bhola
Date:
Can u elaborate please??
how to build psql??


(never worked on unix etc.)

Regards,
Abhi.


-----Original Message-----
From: Peter Eisentraut [mailto:peter_e@gmx.net]
Sent: Monday, May 21, 2001 11:33 PM
To: Abhimanyu_Bhola
Cc: pgsql-general@postgresql.org
Subject: RE: [GENERAL] psql shell problem


Abhimanyu_Bhola writes:

> Does postgresql has any windows clients(like there is psql for unix
> environment) ?if there, where can i download from?

You can build psql on Windows.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

Re: psql shell problem

From
"Denis A. Doroshenko"
Date:
On Mon, May 21, 2001 at 07:17:23PM +0200, Peter Eisentraut wrote:
> Denis A. Doroshenko writes:
>
> > On Mon, May 21, 2001 at 05:28:22PM +0200, Peter Eisentraut wrote:
> > > Frank Bax writes:
> > >
> > > > I have a machine with OpenBSD 2.6 and PSQL 6.5.3 that allows the use of
> > > > up-arrow to retreive/edit previous commands.
> > > >
> > > > I recently built a new machine with OpenBSD 2.8 and PSQL 7.0.2 (from
> > > > package) and this feature is GONE!
> > >
> > > Install readline and rebuild.
> >
> > no need for that. OpenBSD has GNU readline. may be not the
> > latest-coolest-super-duper-GNU-tool-that-fits-all-and-even-more, but
> > normal library which _works_ if before making you move one line in
> > psql's input.h. why install new if the older one works like a charm?
>
> You must have a peculiar definition of "works" and "charm", if you read
> the original poster's message.

well, i feel like you must have a peculiar definition of word "peculiar".
:-P what's wrong with my answer? the original poster writes he
installed pgsql from _packages_, that is binary distribution, which
was compiled simply with configure/gmake. i just said that configure
picks up libreadline shipped with OpenBSD, but because of way defines
are defined (brrr), input.h doesn't define one more define (huh) and
thus history is out of the psql binary. if you change the history a
bit (btw, it will look _more logical_), then history will be ok with
the very same vanilla OS (that is no additional readline library).

well, i has been ranting a bit :-) this GPRS devices with label
"SAMPLE" drive me mad... sorry...

--
Denis A. Doroshenko  [GPRS/IN/WAP, VAS group engineer] .-.        _|_  |
[Omnitel Ltd., T.Sevcenkos st. 25, Vilnius, Lithuania] | | _ _  _ .| _ |
[Phone: +370 9863486 E-mail: d.doroshenko@omnitel.net] |_|| | || |||(/_|_

Re: psql shell problem

From
Tom Lane
Date:
"Denis A. Doroshenko" <d.doroshenko@omnitel.net> writes:
> if you change the history a
> bit (btw, it will look _more logical_), then history will be ok with
> the very same vanilla OS (that is no additional readline library).

You've now asserted that three times, without ever once giving the
details of what it is you claim would be an improvement.

            regards, tom lane

Re: psql shell problem

From
"Denis A. Doroshenko"
Date:
On Mon, May 21, 2001 at 03:38:08PM -0400, Tom Lane wrote:
> "Denis A. Doroshenko" <d.doroshenko@omnitel.net> writes:
> > if you change the history a
> > bit (btw, it will look _more logical_), then history will be ok with
> > the very same vanilla OS (that is no additional readline library).
>
> You've now asserted that three times, without ever once giving the
> details of what it is you claim would be an improvement.

Sorry Tom, i've been sending it to pgsql-general a while ago (at times
of 7.0.2). it's not a problem to do it again. the patch would look
like

--- ./src/bin/psql/input.h.orig    Tue May 22 08:54:43 2001
+++ ./src/bin/psql/input.h    Tue May 22 08:55:00 2001
@@ -25,12 +25,11 @@
 #endif

 #if defined(HAVE_HISTORY_FUNCTIONS)
+#define USE_HISTORY 1
 #if defined(HAVE_READLINE_HISTORY_H)
 #include <readline/history.h>
-#define USE_HISTORY 1
 #elif defined(HAVE_HISTORY_H)
 #include <history.h>
-#define USE_HISTORY 1
 #endif
 #endif

as you can see i define USE_HISTORY whenever we have HAVE_HISTORY_FUNCTIONS
defined. isn't that logical, to use history when configure found history
functions? OpenBSD does not have readline/history.h nor it has
history.h, so with vanilla PostgreSQL (up to 7.1.1) we get psql with
no history support. Eh, then psql loses half of its functionality ;-)

--
Denis A. Doroshenko  [GPRS/IN/WAP, VAS group engineer] .-.        _|_  |
[Omnitel Ltd., T.Sevcenkos st. 25, Vilnius, Lithuania] | | _ _  _ .| _ |
[Phone: +370 9863486 E-mail: d.doroshenko@omnitel.net] |_|| | || |||(/_|_

Re: psql shell problem

From
Peter Eisentraut
Date:
Denis A. Doroshenko writes:

> please, be good and tell me why can't we use history _really found in
> libreadline_, just because of some headers missing? if example proggie
> using readline with history has been successfully compiled and linked,
> with no headers, who cares about the header files?

ISO 9899:1999 cares about the header files.  In C99 you can't use a
function without declaring it.  Note that the test case in configure does
declare the function in a phony way.

> > What edition of readline does OpenBSD supply?
>
> heh, sounds weird, but i can't tell you :-) it seems to be readline
> which comes with GNU binutils (version 2.9 for OpenBSD 2.8, AFAIK).

All GNU readline releases and all readline-compatible NetBSD libedit
releases provide a history.h header.  If OpenBSD wants to create a new
readline[-compatible] package that does not include a history.h file
because it declares the history functions in readline.h then that's okay,
but I need to know that this is the plan and not just an accident.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: psql shell problem

From
Peter Eisentraut
Date:
Denis A. Doroshenko writes:

> isn't that logical, to use history when configure found history
> functions?

That means it found the functions in a library, but it does not mean it
found them in a header file.

> OpenBSD does not have readline/history.h nor it has
> history.h,

What edition of readline does OpenBSD supply?

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: psql shell problem

From
"Denis A. Doroshenko"
Date:
On Tue, May 22, 2001 at 05:00:14PM +0200, Peter Eisentraut wrote:
> Denis A. Doroshenko writes:
>
> > isn't that logical, to use history when configure found history
> > functions?
>
> That means it found the functions in a library, but it does not mean it
> found them in a header file.

please, be good and tell me why can't we use history _really found in
libreadline_, just because of some headers missing? if example proggie
using readline with history has been successfully compiled and linked,
with no headers, who cares about the header files?

i just can't understand the point... :-(

> > OpenBSD does not have readline/history.h nor it has
> > history.h,
>
> What edition of readline does OpenBSD supply?

heh, sounds weird, but i can't tell you :-) it seems to be readline
which comes with GNU binutils (version 2.9 for OpenBSD 2.8, AFAIK).

--
Denis A. Doroshenko  [GPRS/IN/WAP, VAS group engineer] .-.        _|_  |
[Omnitel Ltd., T.Sevcenkos st. 25, Vilnius, Lithuania] | | _ _  _ .| _ |
[Phone: +370 9863486 E-mail: d.doroshenko@omnitel.net] |_|| | || |||(/_|_