Re: SQL query: List all the databases in the server
От | Tom Lane |
---|---|
Тема | Re: SQL query: List all the databases in the server |
Дата | |
Msg-id | 18380.994171549@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: SQL query: List all the databases in the server (Tom Ivar Helbekkmo <tih@kpnQwest.no>) |
Список | pgsql-docs |
Tom Ivar Helbekkmo <tih@kpnQwest.no> writes: > The above SELECT is extensively reformatted from the strings it's > built from in the source file, of course. An even easier way to see what queries psql emits for its backslash commands is to start psql with -E option, then do the backslash commands. This gives me, for example, regression=# \l ********* QUERY ********** SELECT pg_database.datname as "Database", pg_user.usename as "Owner"FROM pg_database, pg_user WHERE pg_database.datdba = pg_user.usesysid UNION SELECT pg_database.datname as "Database", NULL as "Owner"FROM pg_database WHERE pg_database.datdba NOT IN (SELECT usesysid FROM pg_user) ORDER BY "Database" ************************** List of databases Database | Owner ------------+---------- regression | postgres template0 | postgres template1 | postgres (3 rows) regression=# regards, tom lane
В списке pgsql-docs по дате отправления: