Benjamin
Benjamin

Reputation: 93

how to display tables under a particular schema in a pSQL session?

In a pSQL session (linux server), the command \dn displays the schemas in a database. Is there any command that could display tables just under a particular schema, say xyz?

Thanks,

Upvotes: 1

Views: 435

Answers (2)

fphilipe
fphilipe

Reputation: 10054

\dt is used to list tables. By default it will list those in the current schema.

You can, however, pass a pattern to it. In your case, you want to do:

\dt xyz.

This will list all tables in the xyz schema.

Here's some further things you can do with it:

  • list all tables in all schemas: \dt *.
  • list tables with user in their name: \dt *user*
  • list tables with user in their name in all schemas: \dt *.*user*

Upvotes: 1

pranjal0819
pranjal0819

Reputation: 321

The "\z" COMMAND use to list of tables when inside the interactive psql session.

# psql -d mcdb -U admin -p 5555
mcdb=# \z

Upvotes: 0

Related Questions