Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6KL2ea14965 for ; Fri, 20 Jul 2001 17:02:40 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f6KL20C05024; Fri, 20 Jul 2001 17:02:00 -0400 (EDT) To: Dado Feigenblatt cc: Magnus Landahl , pgsql Subject: Re: Get the tables names? In-reply-to: <3B588D48.80803@wildbrain.com> References: <9j67ra$m1$1@news.tht.net> <3B588D48.80803@wildbrain.com> Comments: In-reply-to Dado Feigenblatt message dated "Fri, 20 Jul 2001 12:58:00 -0700" Date: Fri, 20 Jul 2001 17:02:00 -0400 Message-ID: <5021.995662920@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200107/291 X-Sequence-Number: 4094 Dado Feigenblatt writes: > The only thing is that this includes system tables. > So if you want to strip those you need to > SELECT relname , relowner FROM pg_class WHERE relkind = 'r' and > relowner != 26; > Is user postgres always 26? It certainly is not. Even if it was, the above would exclude ordinary tables that had been created by the dbadmin/superuser. The convention that's really used is that system tables have names starting with 'pg_' --- the code will actually not let you create a table with such a name, so that the convention can be relied on. So the correct way to exclude system tables is SELECT * FROM pg_class WHERE relkind = 'r' and relname not like 'pg_%'; If you try "\d" in psql after starting it with -E option, you will discover that this is indeed what psql does ... regards, tom lane