Thread: Problems invoking psql. Help please.

Problems invoking psql. Help please.

From
Hugh Esco
Date:
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've copied the shell dialogue below.
Everything in: /usr/lib/postgresql/bin is owned by root:root.
Who should these files be owned by?
The database engine is invoked as postgres,
which is the user which created the databse.
Do I harm anything if I chown postgres:postgres
for everything in that directory?

Will this get me past this error and to a psql prompt?

I am operating on a Debian Woody Platform,
with postgreSQL 7.2.1 and ODBC driver 7.1.9.

All help is appreciated.  Thanks.

-- Hugh Esco

>hesco@biko:~$ su postgres
>Password:
>postgres@biko:/home/hesco$ locate psql
>/usr/bin/psql
>/usr/lib/odbc/libodbcpsqlS.so
>/usr/share/man/man1/psql.1.gz
>/var/home/hesco/.psql_history
>postgres@biko:/home/hesco$ ./psql
>sh: ./psql: No such file or directory
>postgres@biko:/home/hesco$ psql
>env: /usr/lib/postgresql/bin/readpgenv: Permission denied
>No database specified
>postgres@biko:/home/hesco$ psql ggp_test
>env: /usr/lib/postgresql/bin/readpgenv: Permission denied
>Could not execv /usr/lib/postgresql/bin/psql
>postgres@biko:/home/hesco$




Re: Problems invoking psql. Help please.

From
jasiek@klaster.net
Date:
On Sat, Nov 16, 2002 at 02:11:58PM -0500, Hugh Esco wrote:
> Hey folks:
> 
> I've copied the shell dialogue below.
> Everything in: /usr/lib/postgresql/bin is owned by root:root.
It's default instalation in Debian Woody and it works fine

> >postgres@biko:/home/hesco$ psql
> >env: /usr/lib/postgresql/bin/readpgenv: Permission denied
Is your readpgenv executable?
Try chmod 755 readpgenv

Regards,
Tomasz Myrta


Re: Problems invoking psql. Help please.

From
Tom Lane
Date:
Hugh Esco <hesco@greens.org> writes:
>> postgres@biko:/home/hesco$ psql
>> env: /usr/lib/postgresql/bin/readpgenv: Permission denied
>> No database specified
>> postgres@biko:/home/hesco$ psql ggp_test
>> env: /usr/lib/postgresql/bin/readpgenv: Permission denied
>> Could not execv /usr/lib/postgresql/bin/psql

You seem to have a very bizarre setup there --- there is no such thing
as "readpgenv" in the standard Postgres distribution, and
/usr/lib/postgresql/bin/ isn't the standard place to put the executable
files either.  Perhaps the above is normal for the Debian package of
Postgres, but I'm afraid you'll have to ask the Debian packager for
help.  Nobody using other platforms is likely to be able to help...
        regards, tom lane


Re: Problems invoking psql. Help please.

From
jasiek@klaster.net
Date:
> You seem to have a very bizarre setup there --- there is no such thing
> as "readpgenv" in the standard Postgres distribution, and
> /usr/lib/postgresql/bin/ isn't the standard place to put the executable
> files either.  Perhaps the above is normal for the Debian package of
> Postgres, but I'm afraid you'll have to ask the Debian packager for
> help.  Nobody using other platforms is likely to be able to help...
I have Debian and Postgres installed from .deb package. Postgres is
installed in /usr/lib/postgresql by default and it contains readpgenv.
Psql stops working as described, when I remove executable attribute
from readpgenv. readpgenv is a bash script and has only 3 lines:
#!/bin/bash
. /etc/postgresql/postgresql.env
env

postgresql.env file is an export of PGDATA/PGLIB/PGACCES_HOME variables

Tomasz Myrta


Re: Problems invoking psql. Help please.

From
Luis Sousa
Date:
Hi there,

I'm using debian woody. If you post your configuration files that are in 
/etc/postgresql/ maybe i can help you.

Regards,
Luis Sousa

Hugh Esco wrote:

> 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've copied the shell dialogue below.
> Everything in: /usr/lib/postgresql/bin is owned by root:root.
> Who should these files be owned by?
> The database engine is invoked as postgres,
> which is the user which created the databse.
> Do I harm anything if I chown postgres:postgres
> for everything in that directory?
>
> Will this get me past this error and to a psql prompt?
>
> I am operating on a Debian Woody Platform,
> with postgreSQL 7.2.1 and ODBC driver 7.1.9.
>
> All help is appreciated.  Thanks.
>
> -- Hugh Esco
>
>> hesco@biko:~$ su postgres
>> Password:
>> postgres@biko:/home/hesco$ locate psql
>> /usr/bin/psql
>> /usr/lib/odbc/libodbcpsqlS.so
>> /usr/share/man/man1/psql.1.gz
>> /var/home/hesco/.psql_history
>> postgres@biko:/home/hesco$ ./psql
>> sh: ./psql: No such file or directory
>> postgres@biko:/home/hesco$ psql
>> env: /usr/lib/postgresql/bin/readpgenv: Permission denied
>> No database specified
>> postgres@biko:/home/hesco$ psql ggp_test
>> env: /usr/lib/postgresql/bin/readpgenv: Permission denied
>> Could not execv /usr/lib/postgresql/bin/psql
>> postgres@biko:/home/hesco$
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

Re: Problems invoking psql. Help please.

From
Oliver Elphick
Date:
On Sun, 2002-11-17 at 20:24, jasiek@klaster.net wrote:
> > You seem to have a very bizarre setup there --- there is no such thing
> > as "readpgenv" in the standard Postgres distribution, and
> > /usr/lib/postgresql/bin/ isn't the standard place to put the executable
> > files either.  Perhaps the above is normal for the Debian package of
> > Postgres, but I'm afraid you'll have to ask the Debian packager for
> > help.  Nobody using other platforms is likely to be able to help...
> I have Debian and Postgres installed from .deb package. Postgres is
> installed in /usr/lib/postgresql by default and it contains readpgenv.
> Psql stops working as described, when I remove executable attribute
> from readpgenv. readpgenv is a bash script and has only 3 lines:
> #!/bin/bash
> . /etc/postgresql/postgresql.env
> env
> 
> postgresql.env file is an export of PGDATA/PGLIB/PGACCES_HOME variables

Yes.

The reaon for its existence is that Debian policy prohibits reliance on
environmental variables, so I jump through this hoop to read them from a
predictable location (if they are not already set).

Permissions on  /usr/lib/postgresql/bin/readpgenv should be 755.  How
did they get unset?


-- 
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
========================================   "A Song for the sabbath day. It is a good thing to      give thanks unto the
LORD,and to sing praises unto      thy name, O most High."   Psalms 92:1 
 



Re: 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: Problems invoking psql. Help please.

From
Tom Lane
Date:
Hugh Esco <hesco@greens.org> writes:
> Any ideas on what my next steps should be would be greatly appreciated.

Start over: delete your PG installation and reinstall the Debian
package.  It seems very clear that you've got an incomplete package.
        regards, tom lane


Re: Problems invoking psql. Help please.

From
Tomasz Myrta
Date:
Uz.ytkownik Hugh Esco napisa?:
> 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
It's like it should be.

>> 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
If you still want to fight with your postgres, here is content of my 
(it's default) postgresql.env:>>BEGIN<<
[ -r /etc/postgresql/postmaster.conf ] &&        . /etc/postgresql/postmaster.conf

PGDATA=${POSTGRES_DATA:-/var/lib/postgres/data}
PGLIB=/usr/lib/postgresql/lib
PGACCESS_HOME=/usr/lib/postgresql/share/pgaccess
PGHOST=

export PGLIB PGDATA PGACCESS_HOME PGHOST>>END<<

I think you should just reinstall postgres from .deb package as said Tom 
Lane. I had never troubles like yours with default .deb package.

> Then I changed user from root to postgres,
> under which this database had been created:
Psql works also as root, but you should run it as postgres for security 
reason.


Tomasz Myrta



Re: Problems invoking psql. Help please.

From
Luis Sousa
Date:
Tom Lane wrote:

>Hugh Esco <hesco@greens.org> writes:
>  
>
>>Any ideas on what my next steps should be would be greatly appreciated.
>>    
>>
>
>Start over: delete your PG installation and reinstall the Debian
>package.  It seems very clear that you've got an incomplete package.
>
>            regards, tom lane
>  
>
I agree with Tom Lane. Probably is the best thing to do. When you 
install all it over, in theory, all the problems will solve by them selfs.

Luis Sousa

Re: Problems invoking psql. Help please.

From
Hugh Esco
Date:
I have reinstalled before.  I wonder though, how I ensure that I have 
cleanly un-installed it first, so that I leave no residue from the 
previously botched installation around to mess things up the next time.

-- Hugh Esco

At 09:03 AM 11/19/02 +0000, Luis Sousa wrote:
>Tom Lane wrote:
>Start over: delete your PG installation and reinstall the Debian
>package.  It seems very clear that you've got an incomplete package.
>regards, tom lane
>I agree with Tom Lane. Probably is the best thing to do. When you install 
>all it over, in theory, all the problems will solve by them selfs.
>
>Luis Sousa




Re: Problems invoking psql. Help please.

From
Luis Sousa
Date:
Did you install your package using apt-get ?
All the instalations that I do are using those tools from debian. You 
have to see all the packages that you have instaled in your computer like:

dpkg -l | grep postgresql
ii  postgresql     7.2.1-2        Object-relational SQL database, 
descended fr
ii  postgresql-cli 7.2.1-2        Front-end programs for PostgreSQL
ii  postgresql-con 7.2.1-2        Additional facilities for PostgreSQL

Then you do: dpkg --purge postgresql. You can now run the first command 
to see if something is still installed. If some are instaled, the you 
remove it using again dpkg --purge.

Luis Sousa

Hugh Esco wrote:

> I have reinstalled before.  I wonder though, how I ensure that I have 
> cleanly un-installed it first, so that I leave no residue from the 
> previously botched installation around to mess things up the next time.
>
> -- Hugh Esco
>
> At 09:03 AM 11/19/02 +0000, Luis Sousa wrote:
>
>> Tom Lane wrote:
>> Start over: delete your PG installation and reinstall the Debian
>> package.  It seems very clear that you've got an incomplete package.
>> regards, tom lane
>> I agree with Tom Lane. Probably is the best thing to do. When you 
>> install all it over, in theory, all the problems will solve by them 
>> selfs.
>>
>> Luis Sousa
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
>

Re: Problems invoking psql. Help please.

From
Hugh Esco
Date:
I did this tonight

dpkg --purge postgresql
apt-get install postgresql

and am now still getting the following:

>biko:/usr/bin# psql -U postgres
>No database specified
>biko:/usr/bin# psql -U postgres template1
>Could not execv /usr/lib/postgresql/bin/psql
>biko:/usr/bin# psql -U postgres template0
>Could not execv /usr/lib/postgresql/bin/psql
>biko:/usr/bin# psql -U postgres ggp_test
>Could not execv /usr/lib/postgresql/bin/psql
>biko:/usr/bin#

My pg_hba.conf temporarily reads:
>local      all                                          trust
>host       all         127.0.0.1     255.255.255.255    trust
>host       template1   192.168.2.21  255.255.255.0      trust
>host         all         0.0.0.0       0.0.0.0             reject

(Eventually, before I take this live, I'll figure out the crypt part).

The postgresql installation is at 192.168.10.  I'm working from a shell at 
192.168.2.21.  But I also tried running this from the application server at 
2.10 as well and got the same errors.

And now pgAdmin II is giving me a connection error:
>An error has occured in pgAdmin II:frmConnect.cmdConnect_Click
>Number -2147467259
>Description: Could not connect to the server;
>Could not connect to remote socket.

/etc/postgresql/postgresql.conf includes a line reading:
>tcpip_socket = 1

which I assume means that I _should_ be able to make a TCP connection 
across the network.  Although I cannot seem to do so.

Working in Debian 3.0 Woody, with postgreSQL 7.2.  Still looking for clues, 
in fact I seem to be looking for more clues now than I was yesterday.

-- Hugh

At 05:20 PM 11/19/02 +0000, you wrote:
>Did you install your package using apt-get ?
>All the instalations that I do are using those tools from debian. You have 
>to see all the packages that you have instaled in your computer like:
>
>dpkg -l | grep postgresql
>ii  postgresql     7.2.1-2        Object-relational SQL database, descended fr
>ii  postgresql-cli 7.2.1-2        Front-end programs for PostgreSQL
>ii  postgresql-con 7.2.1-2        Additional facilities for PostgreSQL
>
>Then you do: dpkg --purge postgresql. You can now run the first command to 
>see if something is still installed. If some are instaled, the you remove 
>it using again dpkg --purge.
>
>Luis Sousa
>
>Hugh Esco wrote:
>
>>I have reinstalled before.  I wonder though, how I ensure that I have 
>>cleanly un-installed it first, so that I leave no residue from the 
>>previously botched installation around to mess things up the next time.
>>
>>-- Hugh Esco
>>
>>At 09:03 AM 11/19/02 +0000, Luis Sousa wrote:
>>
>>>Tom Lane wrote:
>>>Start over: delete your PG installation and reinstall the Debian
>>>package.  It seems very clear that you've got an incomplete package.
>>>regards, tom lane
>>>I agree with Tom Lane. Probably is the best thing to do. When you 
>>>install all it over, in theory, all the problems will solve by them selfs.
>>>
>>>Luis Sousa



Re: Problems invoking psql. Help please.

From
Rudi Starcevic
Date:
>> biko:/usr/bin# psql -U postgres template1

Maybe try : biko:/usr/bin# psql tempate1 -U postgres

I use PG on Debian too. I much prefer to compile from source. It's very 
easy why don't you give it a try.
I've never had a problem compiling from source, just make sure to follow 
the instruction's carefully in the INSTALL file.

Good luck
Regards Rudi.



Re: Problems invoking psql. Help please.

From
Hugh Esco
Date:
Here are the results from reversing the arguments.

>hesco@biko:~$ su postgres
>Password:
>postgres@biko:/home/hesco$ cd
>postgres@biko:~$ cd /usr/bin
>postgres@biko:/usr/bin$ psql tempate1 -U postgres
>Could not execv /usr/lib/postgresql/bin/psql
>postgres@biko:/usr/bin$ psql template1 -U postgres
>Could not execv /usr/lib/postgresql/bin/psql
>postgres@biko:/usr/bin$

If I compile from source, will the apt-get database know what I've 
done?  Or will I have to do the updates from source as well?

-- Hugh

At 04:40 PM 11/20/02 +1000, you wrote:

> >> biko:/usr/bin# psql -U postgres template1
>
>Maybe try : biko:/usr/bin# psql tempate1 -U postgres
>
>I use PG on Debian too. I much prefer to compile from source. It's very 
>easy why don't you give it a try.
>I've never had a problem compiling from source, just make sure to follow 
>the instruction's carefully in the INSTALL file.
>
>Good luck
>Regards Rudi.



Re: Problems invoking psql. Help please.

From
"Tomasz Myrta"
Date:
> Here are the results from reversing the arguments.
> 
>  >hesco@biko:~$ su postgres
>  >Password:
>  >postgres@biko:/home/hesco$ cd
>  >postgres@biko:~$ cd /usr/bin
>  >postgres@biko:/usr/bin$ psql tempate1 -U postgres
>  >Could not execv /usr/lib/postgresql/bin/psql
>  >postgres@biko:/usr/bin$ psql template1 -U postgres
>  >Could not execv /usr/lib/postgresql/bin/psql
>  >postgres@biko:/usr/bin$
Check the permissions. Psql is only a symbolic link to pg_wrapper. You should 
have:
ls -al /usr/bin/pg_wrapper
-rwxr-xr-x    1 root     root         6584 sie 25 23:55 /usr/bin/pg_wrapper

> If I compile from source, will the apt-get database know what I've 
> done?  Or will I have to do the updates from source as well?
No. If you want to create package .deb from your sources, look at debian 
packages source site. There is special debian patch in postgres directory. 
Apply it, compile your sources and create .deb package. The last step is to 
install this package with dpkg.

Regards, Tomasz Myrta



Re: Problems invoking psql. Help please.

From
Luis Sousa
Date:
>
>
>> biko:/usr/bin# psql -U postgres
>> No database specified
>
Instead, do: su - postgres
Then do: psql template1 or psql -h <name of your computer> template1

> My pg_hba.conf temporarily reads:
>
>> local all trust
>> host all 127.0.0.1 255.255.255.255 trust
>> host template1 192.168.2.21 255.255.255.0 trust 
>
For now, just remove any security and put this line:

host all 192.168.2.21 255.255.255.255 trust


Re: Problems invoking psql. Help please.

From
Oliver Elphick
Date:
On Wed, 2002-11-20 at 06:30, Hugh Esco wrote:
> I did this tonight
> 
> dpkg --purge postgresql
> apt-get install postgresql
> 
> and am now still getting the following:
> 
> >biko:/usr/bin# psql -U postgres
> >No database specified
> >biko:/usr/bin# psql -U postgres template1
> >Could not execv /usr/lib/postgresql/bin/psql

There is something wrong with permissions here.

You ought to be able, as _any_ user, to run /usr/lib/postgresql/bin/psql
Can you?  It seems clear that pg_wrapper can't.

If not, why not?

I assume the file must exist, since you have just reinstalled the
package.  Is the file itself executable by all users?  (Use "ls -l" to
check this.)

Has someone made an intermediate directory unsearchable?  Every
directory in its path should have search (i.e. execute) permission for
all users.  Check /usr, /usr/lib, /usr/lib/postgresql, and so on.

-- 
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
========================================   "If my people, which are called by my name, shall      humble themselves,
andpray, and seek my face, and      turn from their wicked ways; then will I hear from      heaven, and will forgive
theirsin, and will heal      their land."               II Chronicles 7:14 
 



Re: Problems invoking psql. Help please.

From
Hugh Esco
Date:
Everything in the path is executable for others.
That is true for:        /usr/lib/postgresql/bin
and for:        /usr/bin
where psql is located.

-- Hugh

At 12:49 PM 11/20/02 +0000, Oliver Elphick wrote:
>There is something wrong with permissions here.
>
>You ought to be able, as _any_ user, to run /usr/lib/postgresql/bin/psql
>Can you?  It seems clear that pg_wrapper can't.
>
>If not, why not?
>
>I assume the file must exist, since you have just reinstalled the
>package.  Is the file itself executable by all users?  (Use "ls -l" to
>check this.)
>
>Has someone made an intermediate directory unsearchable?  Every
>directory in its path should have search (i.e. execute) permission for
>all users.  Check /usr, /usr/lib, /usr/lib/postgresql, and so on.




Re: Problems invoking psql. Help please.

From
Oliver Elphick
Date:
On Wed, 2002-11-20 at 14:23, Hugh Esco wrote:
> Everything in the path is executable for others.
> That is true for:
>          /usr/lib/postgresql/bin
> and for:
>          /usr/bin
> where psql is located.

So can you run the executable directly?
   /usr/lib/postgresql/bin/psql -d template1


-- 
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
========================================   "If my people, which are called by my name, shall      humble themselves,
andpray, and seek my face, and      turn from their wicked ways; then will I hear from      heaven, and will forgive
theirsin, and will heal      their land."               II Chronicles 7:14 
 



Re: Problems invoking psql. Help please.

From
Hugh Esco
Date:
Thank you Tom Lane and Oliver Elphick.

Here is the latest shell dialogue.

>postgres@biko:/home/hesco$ ./usr/lib/postgresql/bin/psql -d template1
>sh: ./usr/lib/postgresql/bin/psql: No such file or directory
>postgres@biko:/home/hesco$ /usr/lib/postgresql/bin/psql -d template1
>sh: /usr/lib/postgresql/bin/psql: No such file or directory
>postgres@biko:/home/hesco$ cd /usr/lib/postgresql/bin
>postgres@biko:/usr/lib/postgresql/bin$ ls -al | grep psql
>postgres@biko:/usr/lib/postgresql/bin$

Returned a blank prompt.  My copy of psql is in /usr/bin.
Is that a problem?  Its where apt-get install postgresql put it.
Should I move it?  Someone earlier suggested building this
from source, which I guess would allow me to do that.
I don't know.

>postgres@biko:/usr/lib/postgresql/bin$ ./usr/bin/psql -d template1
>sh: ./usr/bin/psql: No such file or directory
>postgres@biko:/usr/lib/postgresql/bin$ /usr/bin/psql -d template1
>Could not execv /usr/lib/postgresql/bin/psql
>postgres@biko:/usr/lib/postgresql/bin$

Same error again.

>postgres@biko:/usr/lib/postgresql/bin$ cd /usr/bin
>postgres@biko:/usr/bin$ ls -al | grep psql
>lrwxrwxrwx    1 root     root           10 Oct 10 16:24 psql -> pg_wrapper
>postgres@biko:/usr/bin$ ls -al | grep pg_wrapper
><snip>
>-rwxr-xr-x    1 root     root         6584 Sep 11 04:30 pg_wrapper
>lrwxrwxrwx    1 root     root           10 Oct 10 16:24 psql -> pg_wrapper
>postgres@biko:/usr/bin$

So, no.  to answer Mr. Elphick's question below.
I can not run it directly.

I'm not sure what I would do with /sbin/ldconfig to let it know where 
/usr/lib/libpq.so.2 is located at.  My attempts to run it return a blank 
shell prompt.  I assume that Mr. Elphick's demonstration of the error 
generated by renaming the file shows there is no cheese down that hole, 
anyway.

-- Hugh Esco

At 02:46 PM 11/20/02 +0000, Oliver Elphick wrote:
>On Wed, 2002-11-20 at 14:23, Hugh Esco wrote:
> > Everything in the path is executable for others.
> > That is true for:
> >          /usr/lib/postgresql/bin
> > and for:
> >          /usr/bin
> > where psql is located.
>
>So can you run the executable directly?
>
>     /usr/lib/postgresql/bin/psql -d template1
>
>
>--
>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
>                  ========================================
>      "If my people, which are called by my name, shall
>       humble themselves, and pray, and seek my face, and
>       turn from their wicked ways; then will I hear from
>       heaven, and will forgive their sin, and will heal
>       their land."               II Chronicles 7:14
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)



Re: Problems invoking psql. Help please.

From
"jasiek"
Date:
> Here are the results from reversing the arguments.
> 
> >hesco@biko:~$ su postgres
> >Password:
> >postgres@biko:/home/hesco$ cd
> >postgres@biko:~$ cd /usr/bin
> >postgres@biko:/usr/bin$ psql tempate1 -U postgres
> >Could not execv /usr/lib/postgresql/bin/psql
> >postgres@biko:/usr/bin$ psql template1 -U postgres
> >Could not execv /usr/lib/postgresql/bin/psql
> >postgres@biko:/usr/bin$
Check the permissions. Psql is only a symbolic link to pg_wrapper. You should 
have:
ls -al /usr/bin/pg_wrapper
-rwxr-xr-x    1 root     root         6584 sie 25 23:55 /usr/bin/pg_wrapper

> If I compile from source, will the apt-get database know what I've 
> done?  Or will I have to do the updates from source as well?
No. If you want to create package .deb from your sources, look at debian 
packages source site. There is special debian patch in postgres directory. 
Apply it, compile your sources and create .deb package. The last step is to 
install this package with dpkg.

Regards, Tomasz Myrta