0

I have recently installed postgres on my Mac and loaded a dump from our public website that I am trying to replicate locally. The pg_restore appeared to be successful, and I can see all my tables and user permissions in phpPgAdmin. They all look normal, and I can browse the data. However, when I access the database via psql I get no relations found. Similarly I have python scripts that access this database, and they also fail to find any tables.

I'm at a loss as to what to do.

Here are some psql commands I've done:

> psql -U mgd_dbo pub_mgd
psql (9.3.4)
Type "help" for help.

pub_mgd=# \d
No relations found.
pub_mgd=# \l
                                List of databases
    Name    |   Owner    | Encoding |     Collate      | Ctype |    Access privileges    
------------+------------+----------+------------------+-------+-------------------------
 postgres   | postgres   | UTF8     | C                | C     | =CTc/postgres          +
            |            |          |                  |       | postgres=CTc/postgres  +
            |            |          |                  |       | mgd_dbo=CTc/postgres   +
            |            |          |                  |       | mgd_public=CTc/postgres
 pub_fe     | postgres   | LATIN9   | en_US.ISO8859-15 | C     | =CTc/postgres          +
            |            |          |                  |       | postgres=CTc/postgres  +
            |            |          |                  |       | mgd_dbo=CTc/postgres   +
            |            |          |                  |       | mgd_public=CTc/postgres
 pub_mgd    | postgres   | LATIN9   | en_US.ISO8859-15 | C     | =CTc/postgres          +
            |            |          |                  |       | postgres=CTc/postgres  +
            |            |          |                  |       | mgd_dbo=CTc/postgres   +
            |            |          |                  |       | mgd_public=CTc/postgres
 template0  | postgres   | UTF8     | C                | C     | =c/postgres            +
            |            |          |                  |       | postgres=CTc/postgres
 template1  | postgres   | UTF8     | C                | C     | =c/postgres            +
            |            |          |                  |       | postgres=CTc/postgres
(5 rows)

pub_mgd=# \dn+
                          List of schemas
  Name  |  Owner   |  Access privileges   |      Description       
--------+----------+----------------------+------------------------
 mgd    | mgd_dbo  | mgd_dbo=UC/mgd_dbo  +| 
        |          | mgd_public=U/mgd_dbo | 
 public | postgres | postgres=UC/postgres+| standard public schema
        |          | =UC/postgres         | 
(2 rows)

pub_mgd is the database I've loaded. mgd_public and mgd_dbo are the two different users our scripts use (mgd_public is a read-only user). I've tried both users, and even as the postgres user. Yet, the results are the same, no relations.

I even tried to see if phpPgAdmin was somehow hitting a different postgres sever, so I added a new database through it, and verified that the new database appears when I do \l in psql.

Any suggestions as to what to check next?

4

1 回答 1

0

Ask for the list of relations in the mgd schema

\d mgd.*

To make the mgd schema the default place it at the beginning of the search path

set search_path to mgd, "$user", public;
于 2014-07-11T13:11:37.123 回答