473,809 Members | 2,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use of oids

While updating to 7.3.4 I note with some alarm the following passage in
README.Debian.m igration.gz written by Oliver Elphick:

"Some schema designs rely on the use of oids as row identifiers. This is
definitely not recommended, not least because oids are not guaranteed to
exist in all future versions of PostgreSQL. Oids are an internal feature
only. They are not suitable as candidate keys, since they are not
guaranteed to be unique; furthermore, the starting point for oids is likely
to change whenever a change to the database structure occurs."

While I have not used oids to join tables, I have used them extensively in
programming, because if Postgres has supplied a unique number for each row,
why on earth should I bother supplying another one of my own?

Like many people starting with Postgres, three or four years ago I
carefully read Bruce Moynihan's excellent introductory book on Postgres,
which explained many initially difficult concepts with such clarity.

The book states "Every row in POSTGRESQL is assigned a unique, normally
invisible number called an object identification number (OID). When the
software is initialized with initdb, a counter is created and set to
approximately seventeen-thousand. The counter is used to uniquely number
every row. Although databases may be created and destroyed, the counter
continues to increase. It is used by all databases, so identification
numbers are always unique. No two rows in any table or in any database will
ever have the same object ID."

Further down we read:
"Object identification numbers can be used as primary and foreign key
values in joins. Since every row has a unique object ID, a separate column
is not needed to hold the row's unique number."

On the next page are listed the limitations of oids, for example they are
nonsequential, nonmodifiable, and not backed up by default, but for my uses
these were not problems at all. I have merely used the oid number as a
temporary unique identifier before assigning a permanent booking number to
it, which takes about a nanosecond, and in other similar cases.

To sum up: The Debian migration gzip file declares that oids are not
guaranteed to be unique, issues dire warnings about using them as keys and
worst of all states that they may be phased out in the future.
The book states that they are unique, tells you how to use them, actually
gives an example of using them as primary and foreign keys (which
fortunately I decided was not very wise) and certainly doesn't say anything
about phasing them out in the future.

Can anybody shed any light on this?

Malcolm Warren

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 11 '05 #1
0 3415

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1713
by: Amir Khawaja | last post by:
Hi Everyone, I have a rather trivial (I hope) question about OID types and PostgreSQL. Since PostgreSQL creates tables "WITH OIDS" by default, I'm wondering if it is bad practice to allow the default behaviour. For example, if I have a database with 60+ tables (all tables have their own PK that is not of type OID) and all of them have an OID field created by PostgreSQL by default, will this be problematic in the long run? For example,...
12
1566
by: btober | last post by:
I run three instances of a database, in a typical change-control scenario: Production, QAT, and DEV. The Production database is the "real" data, and we periodically take a back up from Prod and re-instantiate QAT and DEV by dropping them and then restoring from the Prod backup. The development (DEV) instance is used by application developers and DBA's to "play" with, when initially trying out or developing new features. It gives them...
2
1783
by: Amir Khawaja | last post by:
Hi Everyone, I have a rather trivial (I hope) question about OID types and PostgreSQL. Since PostgreSQL creates tables "WITH OIDS" by default, I'm wondering if it is bad practice to allow the default behaviour. For example, if I have a database with 60+ tables (all tables have their own PK that is not of type OID) and all of them have an OID field created by PostgreSQL by default, will this be problematic in the long run? For example,...
5
10014
by: Paul Groth | last post by:
Hi All, Having lots of dramas trying to pass an array of structures to a function. I manage to print to the elemnt of the first structure in the array and then I get a core dump. The code is very simple as I am just experimenting. Can anyone tell me what I am doing wrong. #include <stdio.h> #include <stdlib.h> #include <string.h>
1
1566
by: Együd Csaba | last post by:
Hi, I'm winder if I can change the clause 'WITH OIDS' to 'WITHOUT OIDS' on a table without recreating it (eg. usong ALTER TABLE). The problem is that my tables are very big, and I do not need the OIDs at all. It was a mistake to create them with OIDs. Is there any way to correct it. Does it make any sense? Can it run out of OIDs during time? many thanks, -- Csaba Együd
2
2465
by: Dan Sugalski | last post by:
I'm trying to properly tag the types of the parameters I'm passing into PQexecParams, as it seems to be the right thing to do, and it's not that big a deal given my existing code base. Unfortunately I'm running into a problem figuring out what I should be using for the tag numbers. I originally thought that the enum in include/ecpgtype.h was the place to go, but no joy there -- those numbers weren't right. (Or at least they threw...
1
2212
by: Eran.Yasso | last post by:
Hi all, Is there a way to send OIDs request/set to miniport drivers? I understand that the only way is using WMI. Which method in WMI should be used? thanks.
1
3260
by: ntech | last post by:
Hello, i am facing a problem. I am using postgresql database in Linux. After taking the dump of any postgresql database, when i restore the dump file into a new database, i dont get any oids. so can anyone help me in this issue? Does it happen due to version mismatch? how do i take the dump so that when i restore it, the oids are also available? Thanks, Ntech
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9602
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10639
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10120
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5688
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.