postgresql – What is the data type of ’emp::regclass’?

regclass and the other reg types are “object identifier types”. As the documentation says:

The oid type is currently implemented as an unsigned four-byte integer.


The OID alias types have no operations of their own except for specialized input and output routines. These routines are able to accept and display symbolic names for system objects, rather than the raw numeric value that type oid would use.

So it is just a convenience: it really is the numeric object ID, but is displayed as the object name.

regclass can be cast to numerical data types: then it will become the oid value.

regclass can also be cast to text: then it will become the table name.