June 2002
Intermediate to advanced
800 pages
16h 3m
English
Arrays are a core feature of PostgreSQL. Many people admire PostgreSQL because of this feature because it is a comfortable way to reduce the number of relations in your data structure as well as to store multiple values in just one cell.
To define a column as an array, brackets have to be added to the data type:
phpbook=# CREATE TABLE parent (name_mother text, name_children text[]);
CREATE
If you have a look at the data structure, you will see that the second column has been defined as an array:
phpbook=# \d parent
Table "parent"
Column | Type | Modifiers
---------------+--------+-----------
name_mother | text |
name_children | text[] |
To insert a record into the table, you can use ...
Read now
Unlock full access