From 80c646958a14ed343a686566cb77bd92961cf589 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sun, 2 Jul 2000 22:01:27 +0000 Subject: Attached is a new patch which addresses this problem. (oids in regression tests). Chris Bitmead --- doc/src/sgml/inherit.sgml | 53 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) (limited to 'doc/src') diff --git a/doc/src/sgml/inherit.sgml b/doc/src/sgml/inherit.sgml index 774795f94d9..bb0a4d9c7a6 100644 --- a/doc/src/sgml/inherit.sgml +++ b/doc/src/sgml/inherit.sgml @@ -1,5 +1,5 @@ @@ -96,6 +96,57 @@ CREATE TABLE capitals UNDER cities ( UPDATE and DELETE -- support this ONLY notation. + + + In some cases you may wish to know which table a particular tuple + originated from. There is a system attribute called + TABLEOID in each table which can tell you the + originating table: + + + SELECT c.tableoid, c.name, c.altitude + FROM cities c + WHERE c.altitude > 500; + + + which returns: + + ++---------+----------+----------+ +|tableoid |name | altitude | ++---------+----------+----------+ +|37292 |Las Vegas | 2174 | ++---------+----------+----------+ +|37280 |Mariposa | 1953 | ++---------+----------+----------+ +|37280 |Madison | 845 | ++---------+----------+----------+ + + + If you do a join with pg_class you can see the actual table name: + + + SELECT p.relname, c.name, c.altitude + FROM cities c, pg_class p + WHERE c.altitude > 500 and c.tableoid = p.oid; + + + which returns: + + ++---------+----------+----------+ +|relname |name | altitude | ++---------+----------+----------+ +|capitals |Las Vegas | 2174 | ++---------+----------+----------+ +|cities |Mariposa | 1953 | ++---------+----------+----------+ +|cities |Madison | 845 | ++---------+----------+----------+ + + + + Deprecated -- cgit v1.2.3