Thread: could not open relation:no such file or directory

could not open relation:no such file or directory

From
"karthik"
Date:
hello,

    my name is karthik .

     i facing a problem when trying to select values from a table in
postgresql.

   when i execute a query like "select title from itemsbytitle;"   i
get error as

   Error:Could not open relation "itemsbytitle". no such file or
directory.

   can anybody help me to find an answer for this problem.


Re: could not open relation:no such file or directory

From
Adrian Klaver
Date:
On Tuesday 26 December 2006 2:43 am, karthik wrote:
> hello,
>
>     my name is karthik .
>
>      i facing a problem when trying to select values from a table in
> postgresql.
>
>    when i execute a query like "select title from itemsbytitle;"   i
> get error as
>
>    Error:Could not open relation "itemsbytitle". no such file or
> directory.
>
>    can anybody help me to find an answer for this problem.
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
I guess the first question is are you sure there is a table named
itemsbytitle? If so you may need to quote the table name-
SELECT title FROM "itemsbytitle";
See below for full explanation
http://www.postgresql.org/docs/8.2/interactive/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
--
Adrian Klaver
aklaver@comcast.net

Re: could not open relation:no such file or directory

From
Ragnar
Date:
On þri, 2006-12-26 at 02:43 -0800, karthik wrote:

>      i facing a problem when trying to select values from a table in
> postgresql.

do you face this problem with any table or only from a
particular table?

>    when i execute a query like "select title from itemsbytitle;"

what do you mean by 'a query like' ?
please show us the exact query

>    i
> get error as
>
>    Error:Could not open relation "itemsbytitle". no such file or
> directory.

please show us the exact error.

what version postgres are you using ?
are you using psql for your tests ?

if would be best is you cut'n'pasted a short psql session
that demonstrates the problem. something like:

+++++++++++++++++++
$ psql -d test
Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

test=# create table blah (i int);
CREATE TABLE
test=# insert into blah values (1);
INSERT 0 1
test=# select * from blah;
 i
---
 1
(1 row)

test=# select * from blax;
ERROR:  relation "blax" does not exist
++++++++++++++++++++++

this makes it easier for us to guess at what your problem is,
and simplifies reproducing it.

gnari



Re: could not open relation:no such file or directory

From
Ragnar
Date:
[
  you should reply to the list, not only to single posters.
  this way, more people see your reply,and can help you.
  Putting the list back, and quoting whole message.
]
On lau, 2006-12-30 at 15:17 +0530, karthik nandagiri wrote:
> hello ragnar,
>
> i am using  postgresql version8.0. it is installed on debean linux 2.2
> OS.
>
> we have intalled dspace on that system.and its a live website running
> since 2003.
>
> we have nearly 2055 fulltext records loaded on this server.
>
> since 4 months the application was not running properly so we made a
> research of the problem .
>
> then we came to know that a table named item2bundle is not getting
> opened.
>
> the Query i executed  was
>
> dspace=# select * from item2bundle;
>
> after pressing enteri get the below error
>
> Error:Could not open relation "item2bundle". no such file or
>  directory
>
> i am not able to retrieve records from table.

it looks to me that you have experienced corruption, and some files may
be missing in the data directory.

you can check it yourself:
your data directory might be something like
/var/lib/postgresql/8.0/main/
this will contain a subdirectory base/
which will contain a directory for each of our databases
to get the directory name for database "dspace", do:
   select oid from pg_database where datname='dspace';
this database directory will contain several files. to
find the file(s) making upa particular table do:
   select relfilenode from pg_class
                      where relname='item2bundle';

hope this helps you investigate this.

gnari