Thread: Re: [SQL] Problems invoking psql. Help please.

Re: [SQL] Problems invoking psql. Help please.

From
Hugh Esco
Date:
Thank you so much, Mallah, Tomasz Myrta, Luis Sousa,
Achilleus Mantzios, Tom Lane, Bill Eaton and Oliver Elphick.

I have chmod 755 my readpgenv file, and then copied the
shell script suggested by Tomasz Myrta into that file,
yielding these results:

>biko:/usr/lib/postgresql/bin# cd /usr/bin
>biko:/usr/bin# ./psql -U postgres
>No database specified
>biko:/usr/bin# ./psql -U postgres template1
>/usr/lib/postgresql/bin/readpgenv: ./etc/postgresql/postgresql.env: No
>such file
>  or directory

How should that file read?

>Could not execv /usr/lib/postgresql/bin/psql

Then I copied the readpgenv shell script to readpgenv.bu,
and deleted all the text from the readpgenv script,
leaving an empty file with 755 permissions.

>biko:/usr/bin# ./psql -U postgres template1
>Could not execv /usr/lib/postgresql/bin/psql

tried a different database (which exists according to pgAdmin II).

>biko:/usr/bin# ./psql -U postgres ggp_test2
>Could not execv /usr/lib/postgresql/bin/psql

Then I changed user from root to postgres,
under which this database had been created:

>biko:/usr/bin# su postgres
>biko:/usr/bin$ ./psql -U postgres ggp_test2
>Could not execv /usr/lib/postgresql/bin/psql
>biko:/usr/bin$

That's the current crop of errors following the advice to date.
As postgres, here is how my .profile in that user's home directory reads:

>biko:/usr/bin$ whoami
>postgres
>biko:/usr/bin$ cd
>biko:~$ pwd
>/var/lib/postgres
>biko:~$ ls -al
>total 20
>drwx------    3 postgres postgres     4096 Oct 15 08:42 .
>drwxr-xr-x   20 root     root         4096 Oct 14 06:43 ..
>-rw-------    1 postgres postgres     1343 Nov 16 17:45 .bash_history
>-rw-r--r--    1 postgres postgres      175 Oct 14 06:43 .profile
>drwx------    7 postgres postgres     4096 Nov 18 18:55 data
>biko:~$ cat .profile
>. /etc/postgresql/postmaster.conf
>PATH=/bin:/usr/bin:/usr/lib/postgresql/bin
>PGDATA=${POSTGRES_DATA:-/var/lib/postgres/data}
>PGLIB=/usr/lib/postgresql/lib
>export PGLIB PGDATA
>biko:~$

Shouldn't these environmental variables handle what the readpgenv file is
supposed to do for me?

Any ideas on what my next steps should be would be greatly appreciated.

Thanks,
-- Hugh Esco

At 10:39 AM 11/17/02 +0530, Mallah wrote:
>try
>$ psql -U <username> <databasename>
>and post the error encountered.
>
><and I had previously written, in part:>
> > Hey folks:
> >
> > I am able to consistently start and stop the postgreSQL server and
> to  access it across our
> > office network with pgAdmin II.  I have had no luck  invoking the psql
> command line prompt,
> > from where I can enter queries and  start to surmount the learning
> curve from background with
> > mySQL to my next  step with postgreSQL.  Can anyone help me figure out,
> please, what this is
> > about and what I can do about it?
> >
> > I am operating on a Debian Woody Platform,
> > with postgreSQL 7.2.1 and ODBC driver 7.1.9.



Re: [SQL] Problems invoking psql. Help please.

From
Oliver Elphick
Date:
On Tue, 2002-11-19 at 04:48, Hugh Esco wrote:
> Thank you so much, Mallah, Tomasz Myrta, Luis Sousa,
> Achilleus Mantzios, Tom Lane, Bill Eaton and Oliver Elphick.
>
> I have chmod 755 my readpgenv file, and then copied the
> shell script suggested by Tomasz Myrta into that file,
> yielding these results:
>
> >biko:/usr/lib/postgresql/bin# cd /usr/bin
> >biko:/usr/bin# ./psql -U postgres
> >No database specified
> >biko:/usr/bin# ./psql -U postgres template1
> >/usr/lib/postgresql/bin/readpgenv: ./etc/postgresql/postgresql.env: No
> >such file
> >  or directory
>
> How should that file read?
>
> >Could not execv /usr/lib/postgresql/bin/psql

I don't really know what is going on here.  I suggest the quickest and
easiest thing to do is to purge and reinstall the packages, since they
seem to have got into a total mess, somehow.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "To show forth thy lovingkindness in the morning, and
      thy faithfulness every night."     Psalms 92:2


Re: [SQL] Problems invoking psql. Help please.

From
Oliver Elphick
Date:
On Tue, 2002-11-19 at 04:48, Hugh Esco wrote:
> Shouldn't these environmental variables handle what the readpgenv file is
> supposed to do for me?

Yes, and they do.  But readpgenv will read any unset variables from
/etc/postgresql/postgresql.env.

It is required because Debian policy forbids me to rely on their being
set.  So I have to ensure that I can read them even if the user hasn't
set them.

--
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
                 ========================================
     "To show forth thy lovingkindness in the morning, and
      thy faithfulness every night."     Psalms 92:2


Re: [SQL] Problems invoking psql. Help please.

From
Hugh Esco
Date:
Hey folks,

I'm back having made some limited progress, of sorts.

I attempted to run pg_ctl reload to update the pg_hba.conf file, which had
been edited while the postgreSQL server was running.  It gave me an error
message indicating that psql was not in my /usr/lib/postgresql/bin
directory.  So, on a whim, I copied it from my /usr/bin directory, dropping
an additional copy in the /usr/lib/postgresql/bin directory and ran pg_ctl
reload again, with good results.

That got me excited, thinking perhaps somehow my psql file just got
mis-filed and that perhaps I could invoke it's copy from its new home.  So
I ran:
>biko:/usr/lib/postgresql/bin# ./psql -U postgres ggp_test

and I didn't get an error message this time!  Oh happy day!  Top says that
psql is running using 3.7% of CPU and 0.5% of memory.  The hard disk has
been spinning ever since.  But I got no prompt.  Half an hour later, still
no prompt.

So I am back asking, what now?

I'm close.  I can sense it.

All help is appreciated.

-- Hugh Esco