Book Image

PostgreSQL for Data Architects

By : Jayadevan M
Book Image

PostgreSQL for Data Architects

By: Jayadevan M

Overview of this book

Table of Contents (19 chapters)
PostgreSQL for Data Architects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

psql – working from the command line


psql is a very powerful command-line tool and is superior to similar utilities available with other databases. For example, if we are not sure about the name of a table (did I name it emp, employee, or employees?), the only option available in Oracle's SQL* Plus is to query a data dictionary view (such as user_tables or tab) with a LIKE filter. In psql, we can just type \dt e and hit Tab twice to get the list of tables starting with e. In short, psql supports tab completion—a nifty feature that is a great productivity booster. Now that it sounds interesting, let's look at more.

psql – connection options

The psql --help command lists all possible options that can be used with psql. We might want to use psql to execute a command, or to connect to a database and remain at the psql prompt to carry out many activities, execute queries, describe tables, create users, alter objects, and so on. Either way, psql needs to know:

  • the host on which the PostgreSQL cluster...