Received: from druid.net (druid.net [216.126.72.98]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6MCCLa35011 for ; Sun, 22 Jul 2001 08:12:21 -0400 (EDT) (envelope-from darcy@druid.net) Received: by druid.net (Postfix, from userid 1000) id 706F91A62; Sun, 22 Jul 2001 08:12:19 -0400 (EDT) Subject: Re: Get the tables names? In-Reply-To: <20010720122715.A5060@cc.usu.edu> "from Roberto Mello at Jul 20, 2001 12:27:15 pm" To: Roberto Mello Date: Sun, 22 Jul 2001 08:12:19 -0400 (EDT) Cc: Magnus Landahl , pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL78 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Message-Id: <20010722121219.706F91A62@druid.net> From: darcy@druid.net (D'Arcy J.M. Cain) X-Archive-Number: 200107/297 X-Sequence-Number: 4100 Thus spake Roberto Mello > On Thu, Jul 19, 2001 at 11:04:40AM +0200, Magnus Landahl wrote: > > Hi everybody! > > > > Is it possible to get the names of all tables in the database with a sql > > query?? > > SELECT tablename FROM pg_tables WHERE tablename NOT LIKE '%pg_%'; > > The "NOT LIKE" part is to avoid getting the PostgreSQL internal tables > in the output. Further, to only get tables and not views, indexes, sequences, etc you can do this. SELECT tablename FROM pg_tables WHERE relkind = 'r' AND tablename NOT LIKE '%pg_%'; -- D'Arcy J.M. Cain | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.