How do I make a query return all table names?

Started by Nonameabout 24 years ago3 messagesgeneral
Jump to latest
#1Noname
konradatwork@hotmail.com

I just want to send a query to the db that returns a list of all names
of all of the tables in the current database.

Is there such a query?

Thanks,

Konrad
konradatwork@hotmail.com

#2Alain Picard
apicard@optushome.com.au
In reply to: Noname (#1)
Re: How do I make a query return all table names?

konradatwork@hotmail.com (Konrad) writes:

I just want to send a query to the db that returns a list of all names
of all of the tables in the current database.

Is there such a query?

select * from pg_tables;

--
It would be difficult to construe Larry Wall, in article
this as a feature. <1995May29.062427.3640@netlabs.com>

#3Robert Treat
robertt@auctionsolutions.com
In reply to: Noname (#1)
Re: How do I make a query return all table names?

off the top of my head:
"select tablename from pg_tables" will give you all tables.

"select tablename from pg_tables where tablename not like 'pg_%'" would
eliminate the internal postgres tables (and any of your's if they're name
starts with pg_)

there are fancier ways to do it, but that should work.

Robert

Show quoted text

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org]On Behalf Of Konrad
Sent: Saturday, February 23, 2002 10:38 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] How do I make a query return all table names?

I just want to send a query to the db that returns a list of all names
of all of the tables in the current database.

Is there such a query?

Thanks,

Konrad
konradatwork@hotmail.com

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org