How to List All Table Names in PostgreSQL
If you need to find out what tables you have in your PostgreSQL database, especially if they're in the "public" schema, here's a quick way to do it:
Just run this SQL query:
SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = 'public';
This tells PostgreSQL to look through its list of tables and show you the names of the ones in the "public" schema. If your tables are in a different place, swap out 'public' with the name of your schema.
Remember, you need the right permissions to see this information. This trick is mostly for finding the tables you or others have created, not the built-in system stuff.
So, if you're trying to determine which tables are in your database, this is a pretty straightforward method.
Happy coding! ✌️