|OS||All Supported OS|
Sometimes, when we create or truncate a table, the action can fail because the Relfilenode generated has already been used.
Relfilenode xxx already in use in "pg_class"
There is a sequence, called pg_highest_oid inside the database that is shared by Relfilenode and OID. A Relfilenode value in pg_class will be generated or updated when a table is created or truncated. If this Relfilenode has been used by another table, then the error is generated.
Generally, re-running create/truncate will solve this issue.
We can also use the following query to check the current sequence number:
testDB=# select pg_highest_oid();