(initial content)
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
  
 
== Client ==
 
== Client ==
The command-line client for PosgreSQL is {{code|psql}}. Connect by running {{code|psql}} as root or as a particular user.
+
The command-line client for PosgreSQL is {{code|psql}}. Connect by running {{code|psql}} as root or as a particular user. Alternatively, specify the username, password, and host:
  
Databases can be listed with {{code|\l}}:
+
{{highlight|lang=terminal|code=
 +
# psql -U ctxvda -W -h localhost citrix-confdb
 +
## -U for username
 +
## -W to prompt for a password
 +
## -h for hostname
 +
## and the database name
 +
}}
 +
 
 +
Once in the psql console databases can be listed with {{code|\l}}:
 
{{highlight|lang=terminal|code=
 
{{highlight|lang=terminal|code=
 
<nowiki>
 
<nowiki>
Line 31: Line 39:
 
{{highlight|lang=terminal|code=
 
{{highlight|lang=terminal|code=
 
citrix-confdb=# \dt
 
citrix-confdb=# \dt
No relations found.
+
          List of relations
 +
Schema |    Name    | Type  |  Owner
 +
--------+------------+-------+----------
 +
reg    | Key        | table | postgres
 +
reg    | Properties | table | postgres
 +
reg    | Value      | table | postgres
 +
(3 rows)
 +
}}
 +
 
 +
Records can be selected. However, if the table name is in mixed case, the table name needs to be in quotes.
 +
{{highlight|lang=terminal|code=
 +
<nowiki>
 +
citrix-confdb=> SELECT * FROM "Value" ;
 +
ID  |                  Name                  | ValueDWORD |                          ValueSZ                          | ValueMultiSZ | ValueBinary | KeyID
 +
-----+-----------------------------------------+------------+-----------------------------------------------------------+--------------+-------------+-------
 +
  1 | Copyright                              |            | Copyright 2016 Citrix Systems, Inc.  All Rights Reserved. |              |            |    13
 +
  2 | DotVersion                              |        15 |                                                          |              |            |    13
 +
...
 +
</nowiki>
 
}}
 
}}

Latest revision as of 16:17, 8 October 2019

Client[edit]

The command-line client for PosgreSQL is psql. Connect by running psql as root or as a particular user. Alternatively, specify the username, password, and host:

# psql -U ctxvda -W -h localhost citrix-confdb
## -U for username
## -W to prompt for a password
## -h for hostname
## and the database name

Once in the psql console databases can be listed with \l:

postgres=# \l
                                    List of databases
     Name      |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges
---------------+----------+----------+-------------+-------------+-----------------------
 citrix-confdb | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 postgres      | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
               |          |          |             |             | postgres=CTc/postgres
 template1     | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
               |          |          |             |             | postgres=CTc/postgres
(4 rows)

A database can be selected or changed with \c.

postgres=# \c citrix-confdb
You are now connected to database "citrix-confdb" as user "postgres".

Tables can be listed with \dt:

citrix-confdb=# \dt
           List of relations
 Schema

Records can be selected. However, if the table name is in mixed case, the table name needs to be in quotes.

citrix-confdb=&gt; SELECT * FROM "Value" ;
 ID  |                  Name                   | ValueDWORD |                          ValueSZ                          | ValueMultiSZ | ValueBinary | KeyID
-----+-----------------------------------------+------------+-----------------------------------------------------------+--------------+-------------+-------
   1 | Copyright                               |            | Copyright 2016 Citrix Systems, Inc.  All Rights Reserved. |              |             |    13
   2 | DotVersion                              |         15 |                                                           |              |             |    13
...