Re: [SQL] Problems invoking psql. Help please.
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 smime.p7s Description: S/MIME Cryptographic Signature
Re: [SQL] Problems invoking psql. Help please.
On Sun, 2002-11-17 at 20:24, [EMAIL PROTECTED] 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[EMAIL PROTECTED] 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 ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
Re: [SQL] Trees: maintaining pathnames
On 18 Nov 2002 at 1:09, [EMAIL PROTECTED] wrote: > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > NotDashEscaped: You need GnuPG to verify this message > > > Instead of storing the path in each row, why not let Postgres > take care of computing it with a function? Then make a view > and you've got the same table, without all the triggers. This is how it is now done. I wanted to be able to so this fairly quickly: select * from tree where pathname like '/usr/local/%' in order to get the subtree below a given point. Sorry I didn't mention that before. > > CREATE TABLE tree ( > idINTEGER NOT NULL, > parent_id INTEGER, > "name"TEXT NOT NULL, > PRIMARY KEY (id) > ); > > > INSERT INTO tree VALUES (1,NULL,''); > INSERT INTO tree VALUES (2,1,'usr'); > INSERT INTO tree VALUES (3,1,'tmp'); > INSERT INTO tree VALUES (4,1,'home'); > INSERT INTO tree VALUES (5,4,'greg'); > INSERT INTO tree VALUES (6,5,'etc'); > > CREATE OR REPLACE FUNCTION pathname(INTEGER) > RETURNS TEXT AS > ' > > DECLARE > mypath TEXT; > myname TEXT; > myid INTEGER; > > BEGIN > > SELECT parent_id,name FROM tree WHERE id=$1 INTO myid,mypath; > IF mypath IS NULL THEN > RETURN ''No such id\n''; > END IF; > > LOOP > SELECT parent_id,name FROM tree WHERE id=myid INTO myid,myname; > mypath := ''/'' || mypath; > EXIT WHEN myid IS NULL; > mypath := myname || mypath; > END LOOP; > > RETURN mypath; > > END; > ' LANGUAGE 'plpgsql'; > > CREATE VIEW mytree AS SELECT *, PATHNAME(id) AS path FROM tree; > > SELECT * FROM tree ORDER BY id; > > id | parent_id | name > +---+-- > 1 | | > 2 | 1 | usr > 3 | 1 | tmp > 4 | 1 | home > 5 | 4 | greg > 6 | 5 | etc > (6 rows) > > SELECT * FROM mytree ORDER BY id; > > id | parent_id | name | path > +---+--+ > 1 | | | / > 2 | 1 | usr | /usr > 3 | 1 | tmp | /tmp > 4 | 1 | home | /home > 5 | 4 | greg | /home/greg > 6 | 5 | etc | /home/greg/etc > (6 rows) > > UPDATE tree SET name='users' WHERE id=4; > > SELECT * FROM mytree ORDER BY id; > > id | parent_id | name | path > +---+---+- > 1 | | | / > 2 | 1 | usr | /usr > 3 | 1 | tmp | /tmp > 4 | 1 | users | /users > 5 | 4 | greg | /users/greg > 6 | 5 | etc | /users/greg/etc > (6 rows) That's good. Thank you. -- Dan Langille : http://www.langille.org/ ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: [SQL] Problems invoking psql. Help please.
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 and post the error encountered. > 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. ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html
Re: [SQL] Problems invoking psql. Help please.
Hugh Esco <[EMAIL PROTECTED]> 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 ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster