Thread: Error: Relation 'testdb' does not exist
Hi All
I am trying to add a user to a specified database
Steps taken
1. createdb testdb
2. createuser (then follow the prompts)
3. psql testdb
4. GRANT ALL ON testdb TO administrator
At this point an error is returned - "Error: Relation 'testdb' does not exist"
I have gone over the documentation several times but can't find an explanation for this error. Any pointers?
______________________________
Craig Jarman
Director, Source IT
Ph: 612 9974 1480
Fx: 612 9974 1280
cjarman@source.com.au
______________________________
Director, Source IT
Ph: 612 9974 1480
Fx: 612 9974 1280
cjarman@source.com.au
______________________________
> 3. psql testdb > 4. GRANT ALL ON testdb TO administrator > At this point an error is returned - "Error: Relation 'testdb' does not exist" This is because testdb is the database, not an object in the database. You can grant priveleges on individual objects in the db, but not the entire db. (Inconvenient, but it's pretty easy to write a script to create a set of grants.) -Nick -------------------------------------------------------------------------- Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788 Ray Ontko & Co. Software Consulting Services http://www.ontko.com/
>1. createdb testdb pgsql template1; CREATE DATABASE testdb \q >2. createuser (then follow the prompts) createuser -p This sets password >3. psql testdb >4. GRANT ALL ON testdb TO administrator No need to hope this helps. Jean-Michel POURE
hi all- I have a problem with pg_language_oid_index on one db. This problem makes vacuum fail, both from the command line (vacuumdb) and within the DB, but therwise the db is still working ok. prompt> /usr/bin/vacuumdb -a -z -q ... several other db vacuum ok. on db iscb ... NOTICE: Rel pg_class: TID 0/46: OID IS INVALID. TUPGONE 0. ERROR: cannot find attribute 1 of relation pg_language_oid_index vacuumdb: vacuum iscb failed -- alternatly, entering the db with "psql iscb" works, iscb=# vacuum verbose; ... ... ... NOTICE: --Relation pg_amproc-- NOTICE: Pages 1: Changed 0, reaped 0, Empty 0, New 0; Tup 54: Vac 0, Keep/VTL 0/0, Crash 0, UnUsed 0, MinLen 46, MaxLen46; Re-using: Free/Avail. Space 0/0; EndEmpty/Avail. Pages 0/0. CPU 0.00s/0.00u sec. NOTICE: --Relation pg_language-- NOTICE: Pages 1: Changed 0, reaped 0, Empty 0, New 0; Tup 3: Vac 0, Keep/VTL 0/0, Crash 0, UnUsed 0, MinLen 79, MaxLen 84;Re-using: Free/Avail. Space 0/0; EndEmpty/Avail. Pages 0/0. CPU 0.00s/0.00u sec. ERROR: cannot find attribute 1 of relation pg_language_oid_index iscb=# iscb=# SELECT * from pg_language ; ERROR: cannot find attribute 1 of relation pg_language_oid_index iscb=# iscb=# \d pg_language_oid_index PQgetvalue: ERROR! tuple number 0 is out of range 0..-1 PQgetvalue: ERROR! tuple number 0 is out of range 0..-1 Segmentation fault prompt> ACK! any suggestions? running Mandrake 8 / Linux uname = Linux bowser.Stanford.EDU 2.4.3-20mdksmp #1 SMP Sun Apr 15 22:32:27 CEST 2001 i686 unknown rpm -qa | grep -i postgr postgresql-libs-7.1.2-19mdk postgresql-7.1.2-19mdk postgresql-devel-7.1.2-19mdk postgresql-server-7.1.2-19mdk postgresql-contrib-7.1.2-19mdk Thanks, Jon dugan@smi.stanford.edu
Jon Dugan <dugan@smi.stanford.edu> writes: > NOTICE: Rel pg_class: TID 0/46: OID IS INVALID. TUPGONE 0. > ERROR: cannot find attribute 1 of relation pg_language_oid_index Hmm. Try rebuilding the system indexes, via REINDEX DATABASE in that database. (See the REINDEX documentation for the proper procedure to rebuild system indexes --- you need to give the command in a standalone backend with the postmaster shut down, else you'll probably make things worse not better.) regards, tom lane