`\d` and `d+` got `relation "pg_catalog.pg_roles" does not exist` error on psql

51 Views Asked by At

I created person table as shown below:

CREATE TABLE person (
  id INTEGER,
  name VARCHAR(20)
);

Then, trying to show the definition of person table with \d and \d+ got the error as shown below:

postgres=# \d person
ERROR:  relation "pg_catalog.pg_roles" does not exist
LINE 2: ...catalog.array_to_string(array(select rolname from pg_catalog...
postgres=# \d+ person
ERROR:  relation "pg_catalog.pg_roles" does not exist
LINE 2: ...catalog.array_to_string(array(select rolname from pg_catalog...

*Memos:

  • I use PostgreSQL 16.0 on Windows 11:

  • I referred to the doc and the answer which gets the highest upvotes.

  • I also referred to \? on psql as shown below:

    postgres=# \?
    ...
    Informational
      ...
      \d[S+]  NAME           describe table, view, sequence, or index
      ...
    

In addition, trying to show pg_catalog.pg_roles got the error as shown below:

postgres=# SELECT * FROM pg_catalog.pg_roles;
ERROR:  relation "pg_catalog.pg_roles" does not exist
LINE 1: SELECT * FROM pg_catalog.pg_roles;

So, how can I solve the errors?

1

There are 1 best solutions below

0
Laurenz Albe On

Your database is corrupted. Restore a backup.