Re: Getting Table Names in a Particular Database

Поиск
Список
Период
Сортировка
Искать
От
John R Pierce
Тема
Re: Getting Table Names in a Particular Database
Дата
Msg-id
4E5DCB33.3050501@hogranch.com
Ответ на
Список
Дерево обсуждения
Getting Table Names in a Particular Database Adarsh Sharma <adarsh.sharma@orkash.com>
Re: Getting Table Names in a Particular Database John R Pierce <pierce@hogranch.com>
Re: Getting Table Names in a Particular Database Scott Marlowe <scott.marlowe@gmail.com>
Re: Getting Table Names in a Particular Database Adarsh Sharma <adarsh.sharma@orkash.com>
Re: Getting Table Names in a Particular Database Scott Marlowe <scott.marlowe@gmail.com>
Re: Getting Table Names in a Particular Database Scott Marlowe <scott.marlowe@gmail.com>
Re: Getting Table Names in a Particular Database Adarsh Sharma <adarsh.sharma@orkash.com>
Re: Getting Table Names in a Particular Database Scott Marlowe <scott.marlowe@gmail.com>
Re: Getting Table Names in a Particular Database Adarsh Sharma <adarsh.sharma@orkash.com>
Re: Getting Table Names in a Particular Database Scott Marlowe <scott.marlowe@gmail.com>
Re: Getting Table Names in a Particular Database Scott Marlowe <scott.marlowe@gmail.com>
On 08/30/11 10:26 PM, Adarsh Sharma wrote:
> 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';|

That should only return tables in the database you're currently 
connected to...

assuming you have multiple schemas in your database, I'd use something 
like...

select table_schema || '.' || table_name
     from information_schema.tables
     where table_schema not in ('pg_catalog', 'information_schema')
         and table_type = 'BASE TABLE';




-- 
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast

В списке pgsql-general по дате отправления
От: Scott Marlowe
Дата:
От: Adarsh Sharma
Дата:
FAQ