Getting Table Names in a Particular Database

From: Adarsh Sharma <adarsh(dot)sharma(at)orkash(dot)com>
To: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Getting Table Names in a Particular Database
Date: 2011-08-31 05:26:55
Message-ID: 4E5DC61F.7030107@orkash.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear all,

Today I am researching about fetching all the table names in a
particular database.
There is \dt command but I need to fetch it from metadata.
I find some commands as below :

|1. SELECT table_name FROM information_schema.tables WHERE table_schema
= 'public';

2. |SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg%' AND
tablename NOT LIKE 'sql%'.

But I need to specify a particular database & then fetch tables in that.

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2011-08-31 05:30:19 Re: Getting Table Names in a Particular Database
Previous Message Scott Marlowe 2011-08-31 03:05:30 Re: heavy swapping, not sure why