faqts : Computers : Programming : Languages : PHP : Database Backed Sites : Postgres

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

20 of 21 people (95%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

How can I get the details (tables, indicies, structure) of my Postgres database from PHP?

Jul 19th, 2000 18:34
Ben Munoz, Krzysztof Pudlowski, Nathan Wallace, www.phpwizard.net


It looks like what you're looking for is a PHP based admin tool...try 
phpPgAdmin at http://phpwizard.net ...

Maybe I'm mistakem, but try these queries:

for databases

select datname from pg_database;

for tables
 
select relname, relkind from pg_class where relname not like 'pg_%' and 
relkind='r';

for indicies

select relname from pg_class where relname not like 'pg_%' and 
relkind='i';

for sequences

select relname from pg_class where relname not like 'pg_%' and 
relkind='S';

for users

select * from pg_user;

I think that you will consider it useful.