Thread: Postgres not finding tables

Postgres not finding tables

From
James Hall
Date:
Hello All,

I have 2 identical machines running redhat 5.2 and postgres 6.5.
One machine is a replica of the other (backup).

Recently I noticed that postgres gives the error:
"Couldn't find any tables, sequences or indices!"

whenever I tried '\d' or '\d*' on one of the machines.
BUT the database DOES contain tables because I can execute 'select * from
testtable;' and postgres will display the table info.

The tables are there, but for some reason postgres can't see them correctly.

Has anyone seen this before, if so any help is greatly appreciated!

TIA-
Jim

Re: Postgres not finding tables

From
Martin Tomes
Date:
>>>>> "James" == James Hall <James.Hall@RadioShack.com> writes:

    James> Hello All, I have 2 identical machines running redhat 5.2 and
    James> postgres 6.5.  One machine is a replica of the other (backup).

    James> Recently I noticed that postgres gives the error: "Couldn't find
    James> any tables, sequences or indices!"

    James> whenever I tried '\d' or '\d*' on one of the machines.  BUT the
    James> database DOES contain tables because I can execute 'select * from
    James> testtable;' and postgres will display the table info.

    James> The tables are there, but for some reason postgres can't see them
    James> correctly.

    James> Has anyone seen this before, if so any help is greatly appreciated!

I have seen this where I copied the files in /var/lib/pgsql/data/base/mydb to
another machine.  If you use pg_dump/psql -e to move the data it works.  Both
my machines are running RH6.2, but I think one was PG 7.0 and the other was
7.0.2.

--
Martin Tomes

Martin.Tomes@controls.eurotherm.co.uk

RE: Postgres not finding tables

From
James Hall
Date:
Thanks for the advice, but no luck. I tried dumping and restoring each
database, when that didn't work I tried dumping and restoring the entire
database and still the same results... any other thoughts (please!)?

-Jim

    James> Hello All, I have 2 identical machines running redhat 5.2 and
    James> postgres 6.5.  One machine is a replica of the other
(backup).

    James> Recently I noticed that postgres gives the error:
"Couldn't find
    James> any tables, sequences or indices!"

    James> whenever I tried '\d' or '\d*' on one of the
machines.  BUT the
    James> database DOES contain tables because I can execute
'select * from
    James> testtable;' and postgres will display the table info.

    James> The tables are there, but for some reason postgres
can't see them
    James> correctly.

    James> Has anyone seen this before, if so any help is
greatly appreciated!

>I have seen this where I copied the files in
>/var/lib/pgsql/data/base/mydb to
>another machine.  If you use pg_dump/psql -e to move the data
>it works.  Both
>my machines are running RH6.2, but I think one was PG 7.0 and
>the other was
>7.0.2.

Re: Postgres not finding tables

From
Tom Lane
Date:
James Hall <James.Hall@RadioShack.com> writes:
> Recently I noticed that postgres gives the error:
> "Couldn't find any tables, sequences or indices!"
> whenever I tried '\d' or '\d*' on one of the machines.  BUT the
> database DOES contain tables because I can execute
> 'select * from testtable;' and postgres will display the table info.

(checks 6.5 psql sources...)  Back then, \d expanded to a query like

    SELECT usename, relname, relkind, relhasrules
    FROM pg_class, pg_user
    WHERE usesysid = relowner AND (other conditions)

This will miss any tables for which there is no matching owner listed
in pg_user.  I'm guessing that's your problem ... how you got into that
state I don't know, but look at table ownership.

            regards, tom lane