I'm wondering when a table acquires an oid. Is it only when the transaction commits? Or does it have a hidden oid prior to commit? Especially in the context of a CREATE TABLE AS SELECT.
Asked
Active
Viewed 201 times
0
Evan Carroll
- 65,432
- 50
- 254
- 507
1 Answers
3
Table OIDs are assigned quite early in table creation, and are definitely present by the time the CREATE TABLE finishes (before xact commit), since the row is visible in pg_class by then.
The new pg_class row (and its oid) are not visible to concurrent transactions until commit, though.
It's not clear why you care, though. It shouldn't matter.
Craig Ringer
- 57,821
- 6
- 162
- 193