Thread: cannot connect to database
Hello, I have a problem when trying to connect to a specific database with postgres. I'm logged as a user helpdesk group helpdesk in my environment : helpdesk@phoenix:~ > env |grep -i pg PGLIB=/var/lib/pgsql/lib PGDATA=/helpdesk/dbserver/db/data PATH=/support/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/lib/java/bin:/usr/games/bin:/usr/games:/opt/gnome/bin: /opt/kde/bin:/usr/openwin/bin:.:/var/lib/pgsql/bin:/var/lib/pgsql/bin:/var/lib/pgsql/bin Postgresql is installed in /var/lib/pgsql - version 6.4.2 In data : helpdesk@phoenix:/helpdesk/dbserver/db/data > ll total 56 -rwxr-xr-x 1 helpdesk helpdesk 4 Jan 23 16:18 PG_VERSION drwxr-xr-x 5 helpdesk helpdesk 4096 Dec 5 1999 base -rwxr-xr-x 1 helpdesk helpdesk 8192 Dec 5 1999 pg_database -rwxr-xr-x 1 helpdesk helpdesk 3407 Dec 5 1999 pg_geqo.sample -rwxr-xr-x 1 helpdesk helpdesk 0 Dec 5 1999 pg_group -rwxr-xr-x 1 helpdesk helpdesk 5192 Dec 5 1999 pg_hba.conf -rwxr-xr-x 1 helpdesk helpdesk 8192 Dec 5 1999 pg_log -rwxr-xr-x 1 helpdesk helpdesk 52 Dec 5 1999 pg_pwd -rwxr-xr-x 1 helpdesk helpdesk 8192 Dec 5 1999 pg_shadow -rwxr-xr-x 1 helpdesk helpdesk 8192 Dec 5 1999 pg_variable In data/base : drwxr-xr-x 2 helpdesk helpdesk 4096 Dec 5 1999 postgres drwxr-xr-x 2 helpdesk helpdesk 4096 Dec 5 1999 problem_track drwxr-xr-x 2 helpdesk helpdesk 4096 Dec 5 1999 template1 A postmaster process is running : 6709 pts/13 S 0:00 postmaster -B 256 -i -D /helpdesk/dbserver/db/data In this environment I try : psql template1 Ok psql problem_track : Connection to database 'problem_track' failed. FATAL 1: Database problem_track does not exist in pg_database Can someone help me and point me to my mistake TIA Laurent
On Mon, 29 Jan 2001, Laurent GALAIS wrote: > > psql problem_track : > Connection to database 'problem_track' failed. > FATAL 1: Database problem_track does not exist in pg_database > > Can someone help me and point me to my mistake > Does the database exist? Have you created it with createdb? createdb problem_track psql problem_track If you have created the database check whether the files from the database exist. - Einar Karttunen
Einar Karttunen wrote: > On Mon, 29 Jan 2001, Laurent GALAIS wrote: > >> psql problem_track : >> Connection to database 'problem_track' failed. >> FATAL 1: Database problem_track does not exist in pg_database >> >> Can someone help me and point me to my mistake >> > Does the database exist? Have you created it with createdb? > createdb problem_track > psql problem_track > > If you have created the database check whether the files from the > database exist. > > - Einar Karttunen Thanks for your reply, In fact the database problem_track comes with a software. I have done a createdb, because I though the createdb was already done because in data/base there is a directory problem_track with a lot of files - one of these is staff for example : file staff : staff: data I have tried a createdb problem_track : now psql problem_track exists for pl_sql but no tables are inside whereas they are in data/base/problem_track. Any ideas ? Thank you Laurent > > > >
I have a table called student from which I want to return all students to an application. If I do a query like SELECT * FROM STUDENT; explain tells me that the cost is between 0 and 13.44. The result is same if the table is ordered by fname, lname or class. If I order by id, then postgresql uses index scan which takes from 0 to 43.09. Are the values given by explain just bad or why does it appear that sorting a table is in this case, better with any other than the index key? I have used VACUUM and VACUUM ANALYZE periodically. - Einar Karttunen ekarttun=# \d student Table "student" Attribute | Type | Modifier -----------+----------+-------------------------------------------------- id | integer | not null default nextval('student_id_seq'::text) fname | char(15) | lname | char(15) | class | char(3) | Index: student_pkey Constraint: (class ~ '^[0-9][0-9][A-Z]$'::text) ekarttun=# explain select * from student; NOTICE: QUERY PLAN: Seq Scan on student (cost=0.00..13.44 rows=644 width=40) EXPLAIN ekarttun=# explain select * from student order by fname; NOTICE: QUERY PLAN: Sort (cost=43.49..43.49 rows=644 width=40) -> Seq Scan on student (cost=0.00..13.44 rows=644 width=40) EXPLAIN ekarttun=# explain select * from student order by lname; NOTICE: QUERY PLAN: Sort (cost=43.49..43.49 rows=644 width=40) -> Seq Scan on student (cost=0.00..13.44 rows=644 width=40) EXPLAIN ekarttun=# explain select * from student order by class; NOTICE: QUERY PLAN: Sort (cost=43.49..43.49 rows=644 width=40) -> Seq Scan on student (cost=0.00..13.44 rows=644 width=40) EXPLAIN ekarttun=# explain select * from student order by id; NOTICE: QUERY PLAN: Index Scan using student_pkey on student (cost=0.00..43.09 rows=644 width=40) EXPLAIN
On Wed, 31 Jan 2001, Einar Karttunen wrote: >... ignore the previous message, I dismissed the sort times... - Einar