Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Databases - Practical PostgreSQL
Previous Page Home Next Page

Object Identifiers

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)
Databases - Practical PostgreSQL
Previous Page Home Next Page

 
 
  Published under the terms of the Open Publication License Design by Interspire