POSTGRESQL uses a client/server model of communication. A POSTGRESQL server is continually running, waiting for client requests. The server processes the request and returns the result to the client.
Because the POSTGRESQL server runs as an independent process
on the computer, a user cannot interact with it directly. Instead,
client applications have been designed specifically for user interaction.
This chapter describes how to interact with POSTGRESQL using
the psql client application. Additional
interfaces are covered in Chapters and
.
Each POSTGRESQL server controls access to a number of databases.
Databases are storage areas used by the server to partition information.
For example, a typical installation may have a production database,
used to keep all information about a company. It may also have a training
database, used for training and testing purposes. They may have private
databases, used by individuals to store personal information. For
this exercise, we will assume that you have created an empty database
called test. If not, see Appendix .
To start a psql session and connect to the test
database, type psql test at the command prompt. Your output
should look similar to Figure . Remember,
the operating system command prompt is case-sensitive, so you must
type this in all lowercase.
6.1
$ psql test
Welcome to psql, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help on internal slash commands
\g or terminate with semicolon to execute query
\q to quit
test=>