oid
is a primary key. The question is whether to leave it or use another one that makes it stop being used.
It's not simple to push this. You obviously can do it. It has some conditions that indicate its use. But not all. There are situations that have no problem using it, you may just need a primary key for a technical issue, that is, your application does not care about it.
My opinion is same as the one I found on the product discussion list , avoid use it, and if using make sure you understand all implications of its use. I'd rather have full control over the primary key. I have never used oid
. They have some disadvantages and few advantages, nothing serious, but I think that is enough for me. I'd rather use a serial.
- Does not have referential integrity,
- transferring values externally can be a huge complication, it is not GUID,
- is non-standard, even PostgreSQL-specific tools ignore it,
- You have no control over it,
- The question already shows that
*
does not include it.
If you need a composite key then you have to use it, oid
is no alternative to this.