tableoid用于从继承层次中进行查询,获取行数据来源于哪个表,可以与数据字典pg_class.oid关联获取表名。
postgres=# create table peoples(
postgres(# name text,
postgres(# cityname text,
postgres(# age int);
CREATE TABLE
postgres=# insert into peoples values ('Martin', 'Nanjing', '25');
INSERT 0 1
postgres=# select * from peoples;
name | cityname | age
--------+----------+-----
Martin | Nanjing | 25
(1 行记录)
postgres=# create table peoples2(area text) inherits(peoples);
CREATE TABLE
postgres=# insert into peoples2 values ('John', 'Nanjing', '25', 'Xinjiekou');
INSERT 0 1
postgres=# select tableoid, * from peoples;
tableoid | name | cityname | age
----------+--------+----------+-----
16411 | Martin | Nanjing | 25
16417 | John | Nanjing | 25
(2 行记录)
postgres=# select relname, oid from pg_class where oid in (16411, 16417);
relname | oid
----------+-------
peoples | 16411
peoples2 | 16417
(2 行记录)
--可以看到Martin行记录来源于people,John行记录来源于peoples2
而oracle中没有tableoid专有列名,可以通过dba_objects视图查询表id,对于判断行属于哪一列,rowid就是对象的id。