Re: Get the tables names?

From: "Magnus Landahl" <magnus(dot)landahl(at)datessa(dot)se>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Get the tables names?
Date: 2001-07-20 21:14:40
Message-ID: 9ja701$n7l$1@news.tht.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi Everybody!!

Well I tried this (below) and it workt perfectly. Thanks a lot for ALL
answers to my question!

>select tablename from pg_tables where tablename not like 'pg_%';

Kind regards,

Magnus Landahl

"Joel Burton" <jburton(at)scw(dot)org> skrev i meddelandet
news:Pine(dot)LNX(dot)4(dot)21(dot)0107201642270(dot)3206-100000(at)olympus(dot)scw(dot)org(dot)(dot)(dot)
> On Fri, 20 Jul 2001, Dado Feigenblatt wrote:
>
> > Magnus Landahl wrote:
> >
> > >Hi everybody!
> > >
> > >Is it possible to get the names of all tables in the database with a
sql
> > >query??
> > >
> > >Best regards,
> > >
> > >Magnus
> > >
> > >
> > >
> > >---------------------------(end of
broadcast)---------------------------
> > >TIP 3: if posting/reading through Usenet, please send an appropriate
> > >subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> > >message can get through to the mailing list cleanly
> > >
> > >
> > >
> > Not sure if this is the best way, but it works.
> > SELECT relname , relowner from pg_class where relkind = 'r';
> >
> > 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? Maybe you have to find that out first.
>
> system tables all ~ '^pg', which is probably a better check than
> user=postgresql.
>
>
> hth,
> --
> Joel Burton <jburton(at)scw(dot)org>
> Director of Information Systems, Support Center of Washington
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2001-07-20 21:25:29 RE: PLpgSQL
Previous Message Tom Lane 2001-07-20 21:02:00 Re: Get the tables names?