What i want to do is to make a drop down list of all the databases of my postgresql 9.3 server using php . if i can get just the sql script that can do the trick then i can handle the php part.
Thanks for your time.
This information is stored in
select datname from pg_database;
Obviously you need to connect some database in order to be able to run the query.
SELECT pg_database.datname as "Database", pg_user.usename as "postgres" FROM pg_database, pg_user WHERE pg_database.datdba = pg_user.usesysid UNION SELECT pg_database.datname as "Database", NULL as "postgres" FROM pg_database WHERE pg_database.datdba NOT IN (SELECT usesysid FROM pg_user) ORDER BY "Database" -- database that belong to user postgres SELECT pg_database.datname as "Database" FROM pg_database; -- all databases SELECT datname FROM pg_database WHERE datistemplate = false;