What's the equivalent to show tables (from MySQL) in PostgreSQL?
To use the SHOW TABLES command, you need to log on to the MySQL server first. On opening the MySQL Command Line Client, enter your password. Select the specific database. Run the SHOW TABLES command to see all the tables in the database that has been selected.
SHOW TABLES lists the non- TEMPORARY tables in a given database. You can also get this list using the mysqlshow db_name command. The LIKE clause, if present, indicates which table names to match.
From the psql command line interface,
First, choose your database
\c database_name Then, this shows all tables in the current schema:
\dt Programmatically (or from the psql interface too, of course):
SELECT * FROM pg_catalog.pg_tables; The system tables live in the pg_catalog database.
Login as superuser:
sudo -u postgres psql You can list all databases and users by \l command, (list other commands by \?).
Now if you want to see other databases you can change user/database by \c command like \c template1, \c postgres postgres and use \d, \dt or \dS to see tables/views/etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With