Re: [SQL] How do I get the list of table names in db

From: Maarten Boekhold <maartenb(at)dutepp2(dot)et(dot)tudelft(dot)nl>
To: James Andrews <jamesa(at)darkplaces(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] How do I get the list of table names in db
Date: 1998-08-05 13:31:27
Message-ID: Pine.SUN.3.91.980805152914.11433L-100000@dutepp2.et.tudelft.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 5 Aug 1998, James Andrews wrote:

> I need to know how to get a list of table names that exist in a particular
> database using Pg. I know how to do it command line, but I need my scripts
> to be able to do it for error checking, and I haven't found a single doc on
> it.

select relname from pg_class where relkind='r' and relname !~ '^pg_'

relkind='r' gets all relations (tables) and relname!~'^pg_' excludes all
system tables.

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems |
| Department of Electrical Engineering |
| Computer Architecture and Digital Technique section |
| M(dot)Boekhold(at)et(dot)tudelft(dot)nl |
-----------------------------------------------------------------------------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sergei Barbarash 1998-08-05 13:35:59 cursor results count
Previous Message Polášek Robert 1998-08-05 13:26:16 Create view and group bz problems