7.1. Data Types

Every relational database is built of tables, which consist of various columns. Each column is designed to contain a special, predefined piece of data. Depending on the kind of data you want to store, an appropriate data type must be chosen. A column based on a certain data type can only store information fitting the demands of the data type of the column. For example, a column that has been defined as integer value must not be used to store text.

PostgreSQL provides a powerful set of data types, which can be retrieved by using the \dT command in psql:

phpbook=# \dT List of data types Name | Description -----------------------------+------------------------------------------------- ------------------ abstime | absolute, limited-range ...

Get PHP and PostgreSQL: Advanced Web Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.