As described in the Section called Understanding Tables
," each database consists of tables, and each table consists of at
least one named column. These tables may contain rows, but do not necessarily at any given time.
One table management concern can be how to distinguish between
two rows whose column values are identical. A very useful PostgreSQL
feature is that every row has its own
object identifier
number, or
OID
, which is
unique within that table. In other words, no two rows within the same
table will ever have the same OID. This means that even if a table
were designed in such a way that two rows might be identical, there is
still a programmatic way to discern between them: via the OID. This is
demonstrated in Example 3-31.
Example 3-31. Differentiating rows via the OID
testdb=#
SELECT * FROM my_list;
todos
----------------------------------
Correct redundancies in my list.
Correct redundancies in my list.
(2 rows)
testdb=#
SELECT *,oid FROM my_list;
todos | oid
----------------------------------+---------
Correct redundancies in my list. | 3391263
Correct redundancies in my list. | 3391264
(2 rows)
testdb=#
DELETE FROM my_list
testdb-#
WHERE oid = 3391264;
DELETE 1
testdb=# SELECT *,oid FROM my_list;
todos | oid
----------------------------------+---------
Correct redundancies in my list. | 3391263
(1 row)