A primary key is the column, or group of columns, chosen to uniquely identify each row in a table. The idea of a distinguished identifying attribute goes back to Edgar F. Codd’s 1970 paper “A Relational Model of Data for Large Shared Data Banks,” which describes the primary key of a relation as the attribute (or combination of attributes) whose values uniquely identify each element, or tuple, of the relation.
The PostgreSQL documentation states the modern rule precisely: a primary key constraint indicates that a column, or group of columns, can be used as a unique identifier for rows in the table, and this requires that the values be both unique and not null. The non-null requirement matters because a key whose value could be missing could not reliably pick out a row.
Because the primary key uniquely names a row, it is the natural target for references from other tables. A foreign key in one table points at the primary key of another, which is how relationships between tables are encoded. The key is also the usual basis for an index, so that lookups by identifier do not require scanning the whole table.
A primary key may be a single column, such as an order number, or a composite of several columns when no single column is unique on its own. Designers often introduce a surrogate key, an artificial identifier with no meaning outside the database, when no natural attribute is stable and unique enough to serve.