Skip site navigation (1) Skip section navigation (2)

Re: List of tables

From: George Weaver <gweaver(at)shaw(dot)ca>
To: Marcel Wolf <mwolfs(at)comcast(dot)net>, pgsql-novice(at)postgresql(dot)org
Subject: Re: List of tables
Date: 2004-01-28 16:33:34
Message-ID: 00b801c3e5bc$79d39e70$6400a8c0@Dell4500 (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
Hi Marcel,

Assuming you want just the tables you've created (and not a listing of system tables), you can use the following:

SELECT relname FROM pg_class  WHERE relkind='r' AND relfilenode > (SELECT datlastsysoid FROM pg_database WHERE datname = 'template0') ORDER BY relname;

  ----- Original Message ----- 
  From: Marcel Wolf 
  To: pgsql-novice(at)postgresql(dot)org 
  Sent: Wednesday, January 28, 2004 10:04 AM
  Subject: [NOVICE] List of tables

  Guys & Gals

  What is the best way to get a list of tables in a database? Is there a syntax for getting from the database after I connect or do I have to query the System Catalog? Either way what would be the syntax? (Note : Using PHP )


  Thanks Again 


  Marcel Wolf 

In response to

pgsql-novice by date

Next:From: Bruno Wolff IIIDate: 2004-01-28 19:01:45
Subject: Re: db security; user identification
Previous:From: Stephan SzaboDate: 2004-01-28 16:23:43
Subject: Re: pl/pgsql Function Problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group