Difference between revisions of "PostgreSQL: \list"

From wikieduonline
Jump to navigation Jump to search
 
(19 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 
List all [[databases]]
 
List all [[databases]]
 
 
* https://www.postgresql.org/docs/13/app-psql.html
 
* https://www.postgresql.org/docs/13/app-psql.html
  
 
Examples:
 
Examples:
 
* <code>\l</code>
 
* <code>\l</code>
 +
* <code>[[\l+]]</code>
 
* <code>\list</code>
 
* <code>\list</code>
 +
* <code>[[\list+]]</code>
 +
* <code>\list your-db-beggining-with*</code>
 
* <code>-l</code>
 
* <code>-l</code>
 
* <code>--list</code>
 
* <code>--list</code>
 +
 +
== Examples ==
 +
 +
[[PostgreSQL 16]] (Sep 2023)
 +
                                                List of databases
 +
    Name    | Owner | Encoding | Locale Provider | Collate | Ctype | [[ICU Locale]] | [[ICU Rules]] | Access privileges
 +
-----------+-------+----------+-----------------+---------+-------+------------+-----------+-------------------
 +
  postgres  | user  | UTF8    | [[libc]]            | C      | C    |            |          |
 +
  [[template0]] | user  | UTF8    | libc            | C      | C    |            |          | =c/user          +
 +
            |      |          |                |        |      |            |          | user=CTc/user
 +
  template1 | user  | UTF8    | libc            | C      | C    |            |          | =c/user          +
 +
            |      |          |                |        |      |            |          | user=CTc/user
 +
  your-db  | user  | UTF8    | libc            | C      | C    |            |          |
 +
(4 rows)
 +
 +
 +
  
  
 
  postgres-> \list
 
  postgres-> \list
 
                                         List of databases
 
                                         List of databases
     Name    |  Owner    | [[Encoding]] |  [[Collate]]  |    [[Ctype]]    |      Access privileges
+
     Name    |  Owner    | [[Encoding]] |  [[Collate]]  |    [[Ctype]]    |      [[Access privileges]]
 
  -----------+------------+----------+-------------+-------------+-------------------------------
 
  -----------+------------+----------+-------------+-------------+-------------------------------
 
   YOUR_DB | [[rds_master]] | [[UTF8]]    | en_US.UTF-8 | en_US.UTF-8 | =Tc/rds_master              +
 
   YOUR_DB | [[rds_master]] | [[UTF8]]    | en_US.UTF-8 | en_US.UTF-8 | =Tc/rds_master              +
Line 31: Line 50:
 
   rdsadmin          | rdsadmin            | UTF8    | en_US.UTF-8 | en_US.UTF-8 | rdsadmin=CTc/rdsadmin                      +
 
   rdsadmin          | rdsadmin            | UTF8    | en_US.UTF-8 | en_US.UTF-8 | rdsadmin=CTc/rdsadmin                      +
 
                     |                    |          |            |            | rdstopmgr=Tc/rdsadmin
 
                     |                    |          |            |            | rdstopmgr=Tc/rdsadmin
   template0          | rdsadmin            | UTF8    | en_US.UTF-8 | en_US.UTF-8 | =c/rdsadmin                                +
+
   [[template0]]         | rdsadmin            | UTF8    | en_US.UTF-8 | en_US.UTF-8 | =c/rdsadmin                                +
 
                     |                    |          |            |            | rdsadmin=CTc/rdsadmin
 
                     |                    |          |            |            | rdsadmin=CTc/rdsadmin
   template1          | complete_postgresql | UTF8    | en_US.UTF-8 | en_US.UTF-8 | =c/complete_postgresql                    +
+
   [[template1]]         | complete_postgresql | UTF8    | en_US.UTF-8 | en_US.UTF-8 | =c/complete_postgresql                    +
 
                     |                    |          |            |            | complete_postgresql=CTc/complete_postgresql
 
                     |                    |          |            |            | complete_postgresql=CTc/complete_postgresql
 
  (5 rows)
 
  (5 rows)
  
 
+
== Related terms ==
 
 
==Related terms==
 
 
* [[List users]]: <code>[[\du]]</code>
 
* [[List users]]: <code>[[\du]]</code>
 +
* [[List tables]]: <code>[[\dt]]</code> or <code>\dt *.*</code>
 
* <code>[[\c]] YourDBName</code>
 
* <code>[[\c]] YourDBName</code>
 
* <code>[[\z]] YourTable</code>
 
* <code>[[\z]] YourTable</code>
 +
* <code>[[DROP DATABASE]]</code>
 +
* <code>[[CREATE DATABASE]]</code>
 +
* [[PostgreSQL Privileges]]
 +
* <code>[[\connect]]</code>
  
 
==See also==
 
==See also==
 +
* {{PostgreSQL Privileges}}
 
* {{SQL}}
 
* {{SQL}}
* {{PostgreSQL}}
 
  
 
[[Category:PostgreSQL]]
 
[[Category:PostgreSQL]]

Latest revision as of 17:38, 8 January 2024

List all databases

Examples:

  • \l
  • \l+
  • \list
  • \list+
  • \list your-db-beggining-with*
  • -l
  • --list

Examples[edit]

PostgreSQL 16 (Sep 2023)
                                               List of databases
   Name    | Owner | Encoding | Locale Provider | Collate | Ctype | ICU Locale | ICU Rules | Access privileges
-----------+-------+----------+-----------------+---------+-------+------------+-----------+-------------------
 postgres  | user  | UTF8     | libc            | C       | C     |            |           |
 template0 | user  | UTF8     | libc            | C       | C     |            |           | =c/user          +
           |       |          |                 |         |       |            |           | user=CTc/user
 template1 | user  | UTF8     | libc            | C       | C     |            |           | =c/user          +
           |       |          |                 |         |       |            |           | user=CTc/user
 your-db   | user  | UTF8     | libc            | C       | C     |            |           |
(4 rows)



postgres-> \list
                                       List of databases
   Name    |   Owner    | Encoding |   Collate   |    Ctype    |       Access privileges
-----------+------------+----------+-------------+-------------+-------------------------------
 YOUR_DB | rds_master | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =Tc/rds_master               +
           |            |          |             |             | rds_master=CTc/rds_master   
 rdsadmin  | rdsadmin   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | rdsadmin=CTc/rdsadmin
 template0 | rdsadmin   | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/rdsadmin                  +
           |            |          |             |             | rdsadmin=CTc/rdsadmin
 template1 | rds_master | UTF8     | en_US.UTF-8 | en_US.UTF-8 | rds_master=CTc/rds_master    +
           |            |          |             |             | =c/rds_master
(4 rows)
completePostgresql=>  \list
                                                       List of databases
        Name        |        Owner        | Encoding |   Collate   |    Ctype    |              Access privileges
--------------------+---------------------+----------+-------------+-------------+---------------------------------------------
 completePostgresql | complete_postgresql | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 postgres           | complete_postgresql | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 rdsadmin           | rdsadmin            | UTF8     | en_US.UTF-8 | en_US.UTF-8 | rdsadmin=CTc/rdsadmin                      +
                    |                     |          |             |             | rdstopmgr=Tc/rdsadmin
 template0          | rdsadmin            | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/rdsadmin                                +
                    |                     |          |             |             | rdsadmin=CTc/rdsadmin
 template1          | complete_postgresql | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/complete_postgresql                     +
                    |                     |          |             |             | complete_postgresql=CTc/complete_postgresql
(5 rows)

Related terms[edit]

See also[edit]

Advertising: