oid
is a primary key. The question is whether to leave it as PK or use another one that stops it being used as PK.
It’s not simple to nail this, but you can obviously do it. It has some conditions that indicate its use, but not all. There are situations that do not have any problem in using it, it may be that you only need a primary key for a technical issue, ie your application does not care about it.
My opinion is the same one I found on the product mailing list, avoid using it, and if using make sure you understand all the implications of its use. I prefer to have full control over the primary key. I have never used oid
. They have some disadvantages and few advantages, nothing serious, but I think it is enough for me. I prefer to use a serial even.
- Has no referential integrity,
- Transferring values externally can be a huge complication, it is not GUID,
- is out of the standard, even specific Postgresql tools ignore it,
- you have no control over it,
- the question already shows that the use of
*
does not include her.
If you need a composite key then you have to use it, oid
is no alternative to this.