PostgreSQL: How to List Tables Using psql and pgAdmin

PostgreSQL: How to List Tables Using psql and pgAdmin

novicetechie

When working with PostgreSQL databases, one of the most common tasks is viewing the list of tables available in a database. PostgreSQL provides multiple ways to list tables, including the psql command-line tool and the pgAdmin graphical interface.

This guide explains both methods clearly with examples.


List Tables Using psql Command Line

The psql tool provides simple meta-commands to explore database objects.

1. Connect to Database


psql -U username -d database_name

2. List All Tables


\dt

This command lists all tables in the current schema.

3. List Tables from a Specific Schema


\dt public.*

4. List Tables with Pattern Matching


\dt *order*

This displays tables containing the word order in their name.


List Tables Using SQL Query

You can also list tables using SQL queries against system catalogs.


SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'public'
AND table_type = 'BASE TABLE';

This method is useful when working inside applications or scripts.


List Tables Using pgAdmin

pgAdmin is a graphical management tool for PostgreSQL.

Steps:

  1. Open pgAdmin
  2. Connect to your PostgreSQL server
  3. Expand Databases → Your Database → Schemas → public → Tables

All tables will be displayed in the Tables section.


Difference Between psql and pgAdmin

psql pgAdmin
Command-line based Graphical interface
Faster for experienced users User-friendly for beginners
Ideal for scripts & automation Ideal for visual management

Conclusion

PostgreSQL offers flexible ways to list tables using both command-line and graphical tools. While \dt is the quickest method in psql, pgAdmin is perfect for users who prefer a visual interface.

Choose the method that best fits your workflow.

Comments

Simple Tech Tips for Everyday Users

Learn easy tech solutions, beginner-friendly tutorials, and simple fixes for your phone, laptop, apps, and internet problems — all in one place.

Explore by Category

About NoviceTechie

NoviceTechie.com is your simple tech helper. We provide beginner-friendly tutorials, how-to guides, and easy troubleshooting tips to make technology easier for everyone — no technical knowledge required.

Latest Posts

Get Simple Tech Tips Weekly

Join our free updates (optional).

Follow Us
NoviceTechie.com — Simple tech tutorials, everyday problem fixes, and easy guides for beginners.