Thread: TABLEOID patch

TABLEOID patch

From
Chris Bitmead
Date:
Hi!

Attached is the tableoid patch. If there are no objections can I have
this applied?

Thanks!

--
Chris Bitmead
mailto:chris@bitmead.com? config.log
? config.cache
? config.status
? nohup.out
? GNUmakefile
? src/GNUmakefile
? src/Makefile.global
? src/ID
? src/nohup.out
? src/backend/postgres
? src/backend/fmgr.h
? src/backend/parse.h
? src/backend/global1.bki.source
? src/backend/local1_template1.bki.source
? src/backend/global1.description
? src/backend/local1_template1.description
? src/backend/1
? src/backend/catalog/genbki.sh
? src/backend/catalog/global1.bki.source
? src/backend/catalog/global1.description
? src/backend/catalog/local1_template1.bki.source
? src/backend/catalog/local1_template1.description
? src/backend/parser/y.output
? src/backend/parser/y.output.gz
? src/backend/parser/gram.y.works
? src/backend/parser/gram.y.works.try
? src/backend/parser/y.output.noerror
? src/backend/parser/gram.y.gz
? src/backend/port/Makefile
? src/backend/utils/Gen_fmgrtab.sh
? src/backend/utils/fmgr.h
? src/backend/utils/fmgrstamp-h
? src/bin/initdb/initdb
? src/bin/initlocation/initlocation
? src/bin/ipcclean/ipcclean
? src/bin/pg_ctl/pg_ctl
? src/bin/pg_dump/pg_dump
? src/bin/pg_id/pg_id
? src/bin/pg_passwd/pg_passwd
? src/bin/pg_version/pg_version
? src/bin/pgtclsh/mkMakefile.tkdefs.sh
? src/bin/pgtclsh/mkMakefile.tcldefs.sh
? src/bin/psql/psql
? src/bin/scripts/createlang
? src/include/version.h
? src/include/config.h
? src/include/parser/parse.h
? src/include/utils/fmgroids.h
? src/interfaces/ecpg/lib/libecpg.so.3.1.1
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/jdbc/postgresql.jar
? src/interfaces/jdbc/example/psql.class
? src/interfaces/jdbc/postgresql/DriverClass.java
? src/interfaces/jdbc/postgresql/DriverClass.class
? src/interfaces/jdbc/postgresql/Connection.class
? src/interfaces/jdbc/postgresql/Field.class
? src/interfaces/jdbc/postgresql/PG_Stream.class
? src/interfaces/jdbc/postgresql/Driver.class
? src/interfaces/jdbc/postgresql/ResultSet.class
? src/interfaces/jdbc/postgresql/fastpath/Fastpath.class
? src/interfaces/jdbc/postgresql/fastpath/FastpathArg.class
? src/interfaces/jdbc/postgresql/geometric/PGbox.class
? src/interfaces/jdbc/postgresql/geometric/PGpoint.class
? src/interfaces/jdbc/postgresql/geometric/PGcircle.class
? src/interfaces/jdbc/postgresql/geometric/PGline.class
? src/interfaces/jdbc/postgresql/geometric/PGlseg.class
? src/interfaces/jdbc/postgresql/geometric/PGpath.class
? src/interfaces/jdbc/postgresql/geometric/PGpolygon.class
? src/interfaces/jdbc/postgresql/jdbc2/ResultSet.class
? src/interfaces/jdbc/postgresql/jdbc2/Connection.class
? src/interfaces/jdbc/postgresql/jdbc2/ResultSetMetaData.class
? src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.class
? src/interfaces/jdbc/postgresql/jdbc2/Statement.class
? src/interfaces/jdbc/postgresql/jdbc2/PreparedStatement.class
? src/interfaces/jdbc/postgresql/jdbc2/CallableStatement.class
? src/interfaces/jdbc/postgresql/largeobject/LargeObjectManager.class
? src/interfaces/jdbc/postgresql/largeobject/LargeObject.class
? src/interfaces/jdbc/postgresql/util/PSQLException.class
? src/interfaces/jdbc/postgresql/util/UnixCrypt.class
? src/interfaces/jdbc/postgresql/util/Serialize.class
? src/interfaces/jdbc/postgresql/util/PGobject.class
? src/interfaces/jdbc/postgresql/util/PGtokenizer.class
? src/interfaces/jdbc/postgresql/util/PGmoney.class
? src/interfaces/libpgeasy/libpgeasy.so.2.1
? src/interfaces/libpgtcl/mkMakefile.tcldefs.sh
? src/interfaces/libpgtcl/mkMakefile.tkdefs.sh
? src/interfaces/libpq/libpq.so.2.1
? src/interfaces/libpq++/libpq++.so.3.1
? src/interfaces/odbc/Makefile.global
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/pl/tcl/mkMakefile.tcldefs.sh
? src/test/regress/GNUmakefile
? src/test/regress/regress.out
? src/test/regress/x.x
? src/test/regress/nohup.out
? src/test/regress/regression.diffs
? src/test/regress/expected/copy.out
? src/test/regress/expected/misc.out
? src/test/regress/expected/create_function_1.out
? src/test/regress/expected/create_function_2.out
? src/test/regress/expected/constraints.out
? src/test/regress/results/boolean.out
? src/test/regress/results/char.out
? src/test/regress/results/name.out
? src/test/regress/results/varchar.out
? src/test/regress/results/text.out
? src/test/regress/results/int2.out
? src/test/regress/results/int4.out
? src/test/regress/results/int8.out
? src/test/regress/results/oid.out
? src/test/regress/results/float4.out
? src/test/regress/results/float8.out
? src/test/regress/results/numeric.out
? src/test/regress/results/strings.out
? src/test/regress/results/numerology.out
? src/test/regress/results/point.out
? src/test/regress/results/lseg.out
? src/test/regress/results/box.out
? src/test/regress/results/path.out
? src/test/regress/results/polygon.out
? src/test/regress/results/circle.out
? src/test/regress/results/interval.out
? src/test/regress/results/timestamp.out
? src/test/regress/results/reltime.out
? src/test/regress/results/tinterval.out
? src/test/regress/results/inet.out
? src/test/regress/results/comments.out
? src/test/regress/results/oidjoins.out
? src/test/regress/results/type_sanity.out
? src/test/regress/results/opr_sanity.out
? src/test/regress/results/abstime.out
? src/test/regress/results/geometry.out
? src/test/regress/results/horology.out
? src/test/regress/results/create_function_1.out
? src/test/regress/results/create_type.out
? src/test/regress/results/create_table.out
? src/test/regress/results/create_function_2.out
? src/test/regress/results/copy.out
? src/test/regress/results/onek.data
? src/test/regress/results/constraints.out
? src/test/regress/results/triggers.out
? src/test/regress/results/create_misc.out
? src/test/regress/results/create_aggregate.out
? src/test/regress/results/create_operator.out
? src/test/regress/results/create_index.out
? src/test/regress/results/inherit.out
? src/test/regress/results/create_view.out
? src/test/regress/results/sanity_check.out
? src/test/regress/results/errors.out
? src/test/regress/results/select.out
? src/test/regress/results/select_into.out
? src/test/regress/results/select_distinct.out
? src/test/regress/results/select_distinct_on.out
? src/test/regress/results/select_implicit.out
? src/test/regress/results/select_having.out
? src/test/regress/results/subselect.out
? src/test/regress/results/union.out
? src/test/regress/results/case.out
? src/test/regress/results/join.out
? src/test/regress/results/aggregates.out
? src/test/regress/results/transactions.out
? src/test/regress/results/random.out
? src/test/regress/results/portals.out
? src/test/regress/results/arrays.out
? src/test/regress/results/btree_index.out
? src/test/regress/results/hash_index.out
? src/test/regress/results/misc.out
? src/test/regress/results/select_views.out
? src/test/regress/results/alter_table.out
? src/test/regress/results/portals_p2.out
? src/test/regress/results/rules.out
? src/test/regress/results/foreign_key.out
? src/test/regress/results/limit.out
? src/test/regress/results/plpgsql.out
? src/test/regress/results/temp.out
? src/test/regress/sql/copy.sql
? src/test/regress/sql/misc.sql
? src/test/regress/sql/create_function_1.sql
? src/test/regress/sql/create_function_2.sql
? src/test/regress/sql/constraints.sql
Index: doc/src/sgml/inherit.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/inherit.sgml,v
retrieving revision 1.10
diff -c -r1.10 inherit.sgml
*** doc/src/sgml/inherit.sgml    2000/06/22 22:31:15    1.10
--- doc/src/sgml/inherit.sgml    2000/07/01 05:30:22
***************
*** 96,101 ****
--- 96,152 ----
     <command>UPDATE</command> and <command>DELETE</command> --
     support this <quote>ONLY</quote> notation.
    </para>
+
+   <para>
+   In some cases you may wish to know which table a particular tuple
+   originated from. There is a system attribute called
+   <quote>TABLEOID</quote> in each table which can tell you the
+   originating table:
+
+    <programlisting>
+     SELECT c.tableoid, c.name, c.altitude
+     FROM cities c
+     WHERE c.altitude > 500;
+    </programlisting>
+
+    which returns:
+
+    <programlisting>
+ +---------+----------+----------+
+ |tableoid |name      | altitude |
+ +---------+----------+----------+
+ |37292    |Las Vegas | 2174     |
+ +---------+----------+----------+
+ |37280    |Mariposa  | 1953     |
+ +---------+----------+----------+
+ |37280    |Madison   | 845      |
+ +---------+----------+----------+
+    </programlisting>
+
+    If you do a join with pg_class you can see the actual table name:
+
+    <programlisting>
+     SELECT p.relname, c.name, c.altitude
+     FROM cities c, pg_class p
+     WHERE c.altitude > 500 and c.tableoid = p.oid;
+    </programlisting>
+
+    which returns:
+
+    <programlisting>
+ +---------+----------+----------+
+ |relname  |name      | altitude |
+ +---------+----------+----------+
+ |capitals |Las Vegas | 2174     |
+ +---------+----------+----------+
+ |cities   |Mariposa  | 1953     |
+ +---------+----------+----------+
+ |cities   |Madison   | 845      |
+ +---------+----------+----------+
+    </programlisting>
+
+   </para>
+
    <note>
     <title>Deprecated</title>
     <para>
Index: src/backend/access/common/heaptuple.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v
retrieving revision 1.62
diff -c -r1.62 heaptuple.c
*** src/backend/access/common/heaptuple.c    2000/04/12 17:14:36    1.62
--- src/backend/access/common/heaptuple.c    2000/07/01 05:30:27
***************
*** 9,15 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12 17:14:36
momjianExp $ 
   *
   * NOTES
   *      The old interface functions have been converted to macros
--- 9,15 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /usr/local/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12 17:14:36 momjian
Exp$ 
   *
   * NOTES
   *      The old interface functions have been converted to macros
***************
*** 169,174 ****
--- 169,175 ----
      else
          switch (attnum)
          {
+             case TableOidAttributeNumber:
              case SelfItemPointerAttributeNumber:
              case ObjectIdAttributeNumber:
              case MinTransactionIdAttributeNumber:
***************
*** 205,210 ****
--- 206,213 ----

      switch (attno)
      {
+         case TableOidAttributeNumber:
+             return sizeof f->t_oid;
          case SelfItemPointerAttributeNumber:
              return sizeof f->t_ctid;
          case ObjectIdAttributeNumber:
***************
*** 237,242 ****
--- 240,248 ----

      switch (attno)
      {
+         case TableOidAttributeNumber:
+             byval = true;
+             break;
          case SelfItemPointerAttributeNumber:
              byval = false;
              break;
***************
*** 275,281 ****
  {
      switch (attnum)
      {
!             case SelfItemPointerAttributeNumber:
              return (Datum) &tup->t_ctid;
          case ObjectIdAttributeNumber:
              return (Datum) (long) tup->t_oid;
--- 281,289 ----
  {
      switch (attnum)
      {
!         case TableOidAttributeNumber:
!             return (Datum) &tup->t_tableoid;
!         case SelfItemPointerAttributeNumber:
              return (Datum) &tup->t_ctid;
          case ObjectIdAttributeNumber:
              return (Datum) (long) tup->t_oid;
Index: src/backend/access/heap/heapam.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/heap/heapam.c,v
retrieving revision 1.73
diff -c -r1.73 heapam.c
*** src/backend/access/heap/heapam.c    2000/06/30 16:10:40    1.73
--- src/backend/access/heap/heapam.c    2000/07/01 05:30:35
***************
*** 235,240 ****
--- 235,242 ----
      int            linesleft;
      ItemPointer tid = (tuple->t_data == NULL) ?
      (ItemPointer) NULL : &(tuple->t_self);
+
+     tuple->tableOid = relation->rd_id;

      /* ----------------
       *    increment access statistics
***************
*** 621,626 ****
--- 623,629 ----

      Assert(lockmode >= NoLock && lockmode < MAX_LOCKMODES);

+
      /* ----------------
       *    increment access statistics
       * ----------------
***************
*** 1084,1089 ****
--- 1087,1093 ----
      ItemPointer tid = &(tuple->t_self);
      OffsetNumber offnum;

+     tuple->tableOid = relation->rd_id;
      /* ----------------
       *    increment access statistics
       * ----------------
***************
*** 1178,1183 ****
--- 1182,1188 ----
      bool        invalidBlock,
                  linkend;

+     tp.tableOid = relation->rd_id;
      /* ----------------
       *    get the buffer from the relation descriptor
       *    Note that this does a buffer pin.
***************
*** 1270,1275 ****
--- 1275,1281 ----
       *    increment access statistics
       * ----------------
       */
+     tup->tableOid = relation->rd_id;
      IncrHeapAccessStat(local_insert);
      IncrHeapAccessStat(global_insert);

***************
*** 1335,1340 ****
--- 1341,1347 ----
      Buffer        buffer;
      int            result;

+     tp.tableOid = relation->rd_id;
      /* increment access statistics */
      IncrHeapAccessStat(local_delete);
      IncrHeapAccessStat(global_delete);
***************
*** 1447,1452 ****
--- 1454,1460 ----
      Buffer        buffer;
      int            result;

+     newtup->tableOid = relation->rd_id;
      /* increment access statistics */
      IncrHeapAccessStat(local_replace);
      IncrHeapAccessStat(global_replace);
***************
*** 1575,1580 ****
--- 1583,1589 ----
      PageHeader    dp;
      int            result;

+     tuple->tableOid = relation->rd_id;
      /* increment access statistics */
      IncrHeapAccessStat(local_mark4update);
      IncrHeapAccessStat(global_mark4update);
Index: src/backend/catalog/heap.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/catalog/heap.c,v
retrieving revision 1.134
diff -c -r1.134 heap.c
*** src/backend/catalog/heap.c    2000/06/28 03:31:22    1.134
--- src/backend/catalog/heap.c    2000/07/01 05:30:45
***************
*** 131,142 ****
      MaxCommandIdAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
  };

! static Form_pg_attribute HeapAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6};

  /* ----------------------------------------------------------------
   *                XXX END OF UGLY HARD CODED BADNESS XXX
!  * ----------------------------------------------------------------
!  */


  /* ----------------------------------------------------------------
--- 131,152 ----
      MaxCommandIdAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
  };

! /*
!    We decide to call this attribute "tableoid" rather than say
! "classoid" on the basis that in the future there may be more than one
! table of a particular class/type. In any case table is still the word
! used in SQL.
! */
! static FormData_pg_attribute a7 = {
!     0xffffffff, {"tableoid"}, OIDOID, 0, sizeof(Oid),
!     TableOidAttributeNumber, 0, -1, -1, '\0', 'p', '\0', 'i', '\0', '\0'
! };

+ static Form_pg_attribute HeapAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6, &a7};
+
  /* ----------------------------------------------------------------
   *                XXX END OF UGLY HARD CODED BADNESS XXX
!  * ---------------------------------------------------------------- */


  /* ----------------------------------------------------------------
Index: src/backend/optimizer/prep/preptlist.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v
retrieving revision 1.36
diff -c -r1.36 preptlist.c
*** src/backend/optimizer/prep/preptlist.c    2000/04/12 17:15:23    1.36
--- src/backend/optimizer/prep/preptlist.c    2000/07/01 05:30:48
***************
*** 15,21 ****
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.36 2000/04/12 17:15:23
momjianExp $ 
   *
   *-------------------------------------------------------------------------
   */
--- 15,21 ----
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *      $Header: /usr/local/cvsroot/pgsql/src/backend/optimizer/prep/preptlist.c,v 1.36 2000/04/12 17:15:23 momjian
Exp$ 
   *
   *-------------------------------------------------------------------------
   */
***************
*** 66,72 ****
      if (command_type == CMD_UPDATE || command_type == CMD_DELETE)
      {
          Resdom       *resdom;
!         Var           *var;

          resdom = makeResdom(length(tlist) + 1,
                              TIDOID,
--- 66,72 ----
      if (command_type == CMD_UPDATE || command_type == CMD_DELETE)
      {
          Resdom       *resdom;
!         Var           *var1, *var2;

          resdom = makeResdom(length(tlist) + 1,
                              TIDOID,
***************
*** 76,83 ****
                              0,
                              true);

!         var = makeVar(result_relation, SelfItemPointerAttributeNumber,
                        TIDOID, -1, 0);

          /*
           * For an UPDATE, expand_targetlist already created a fresh tlist.
--- 76,85 ----
                              0,
                              true);

!         var1 = makeVar(result_relation, SelfItemPointerAttributeNumber,
                        TIDOID, -1, 0);
+         var2 = makeVar(result_relation, TableOidAttributeNumber,
+                       OIDOID, -1, 0);

          /*
           * For an UPDATE, expand_targetlist already created a fresh tlist.
***************
*** 87,93 ****
          if (command_type == CMD_DELETE)
              tlist = listCopy(tlist);

!         tlist = lappend(tlist, makeTargetEntry(resdom, (Node *) var));
      }

      return tlist;
--- 89,96 ----
          if (command_type == CMD_DELETE)
              tlist = listCopy(tlist);

!         tlist = lappend(tlist, makeTargetEntry(resdom, (Node *) var1));
!         tlist = lappend(tlist, makeTargetEntry(resdom, (Node *) var2));
      }

      return tlist;
Index: src/backend/parser/parse_relation.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_relation.c,v
retrieving revision 1.44
diff -c -r1.44 parse_relation.c
*** src/backend/parser/parse_relation.c    2000/06/20 01:41:21    1.44
--- src/backend/parser/parse_relation.c    2000/07/01 05:30:49
***************
*** 40,45 ****
--- 40,48 ----

  {
      {
+         "tableoid", TableOidAttributeNumber, OIDOID
+     },
+     {
          "ctid", SelfItemPointerAttributeNumber, TIDOID
      },
      {
Index: src/backend/utils/cache/lsyscache.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v
retrieving revision 1.42
diff -c -r1.42 lsyscache.c
*** src/backend/utils/cache/lsyscache.c    2000/06/08 22:37:30    1.42
--- src/backend/utils/cache/lsyscache.c    2000/07/01 05:30:51
***************
*** 249,254 ****
--- 249,256 ----
      if (attnum == ObjectIdAttributeNumber ||
          attnum == SelfItemPointerAttributeNumber)
          return 1.0 / (double) ntuples;
+     if (attnum == TableOidAttributeNumber)
+         return 1.0;

      /*
       * VACUUM ANALYZE has not been run for this table. Produce an estimate
Index: src/include/access/heapam.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/access/heapam.h,v
retrieving revision 1.54
diff -c -r1.54 heapam.h
*** src/include/access/heapam.h    2000/06/30 16:10:49    1.54
--- src/include/access/heapam.h    2000/07/01 05:30:53
***************
*** 165,200 ****
   *
   * ----------------
   */
! #define heap_getattr(tup, attnum, tupleDesc, isnull)                        \
! (                                                                            \
!     AssertMacro((tup) != NULL &&                                            \
!         (attnum) > FirstLowInvalidHeapAttributeNumber &&                    \
!         (attnum) != 0),                                                        \
!     ((attnum) > (int) (tup)->t_data->t_natts) ?                                \
!     (                                                                        \
!         ((isnull) ? (*(isnull) = true) : (dummyret)NULL),                    \
!         (Datum)NULL                                                            \
!     )                                                                        \
!     :                                                                        \
!     (                                                                        \
!         ((attnum) > 0) ?                                                    \
!         (                                                                    \
!             fastgetattr((tup), (attnum), (tupleDesc), (isnull))                \
!         )                                                                    \
!         :                                                                    \
!         (                                                                    \
!             ((isnull) ? (*(isnull) = false) : (dummyret)NULL),                \
!             ((attnum) == SelfItemPointerAttributeNumber) ?                    \
!             (                                                                \
!                 (Datum)((char *)&((tup)->t_self))                            \
!             )                                                                \
!             :                                                                \
!             (                                                                \
!                 (Datum)*(unsigned int *)                                    \
!                     ((char *)(tup)->t_data + heap_sysoffset[-(attnum)-1])    \
!             )                                                                \
!         )                                                                    \
!     )                                                                        \
  )

  extern HeapAccessStatistics heap_access_stats;    /* in stats.c */
--- 165,205 ----
   *
   * ----------------
   */
! #define heap_getattr(tup, attnum, tupleDesc, isnull) \
! ( \
!     AssertMacro((tup) != NULL && \
!         (attnum) > FirstLowInvalidHeapAttributeNumber && \
!         (attnum) != 0), \
!     ((attnum) > (int) (tup)->t_data->t_natts) ? \
!     ( \
!         ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
!         (Datum)NULL \
!     ) \
!     : \
!     ( \
!         ((attnum) > 0) ? \
!         ( \
!             fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
!         ) \
!         : \
!         ( \
!             ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
!             ((attnum) == SelfItemPointerAttributeNumber) ? \
!             ( \
!                 (Datum)((char *)&((tup)->t_self)) \
!             ) \
!             : \
!             (((attnum) == TableOidAttributeNumber) ? \
!             ( \
!                 (Datum)((tup)->tableOid) \
!             ) \
!             : \
!             ( \
!                 (Datum)*(unsigned int *) \
!                     ((char *)(tup)->t_data + heap_sysoffset[-(attnum)-1]) \
!             )) \
!         ) \
!     ) \
  )

  extern HeapAccessStatistics heap_access_stats;    /* in stats.c */
Index: src/include/access/htup.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/access/htup.h,v
retrieving revision 1.30
diff -c -r1.30 htup.h
*** src/include/access/htup.h    2000/06/02 10:20:26    1.30
--- src/include/access/htup.h    2000/07/01 05:30:54
***************
*** 133,139 ****
  #define MinCommandIdAttributeNumber                (-4)
  #define MaxTransactionIdAttributeNumber            (-5)
  #define MaxCommandIdAttributeNumber                (-6)
! #define FirstLowInvalidHeapAttributeNumber        (-7)

  /* If you make any changes above, the order off offsets in this must change */
  extern long heap_sysoffset[];
--- 133,140 ----
  #define MinCommandIdAttributeNumber                (-4)
  #define MaxTransactionIdAttributeNumber            (-5)
  #define MaxCommandIdAttributeNumber                (-6)
! #define TableOidAttributeNumber                    (-7)
! #define FirstLowInvalidHeapAttributeNumber        (-8)

  /* If you make any changes above, the order off offsets in this must change */
  extern long heap_sysoffset[];
***************
*** 156,161 ****
--- 157,163 ----
  {
      uint32        t_len;            /* length of *t_data */
      ItemPointerData t_self;        /* SelfItemPointer */
+     Oid tableOid;                    /* */
      MemoryContext t_datamcxt;    /* */
      HeapTupleHeader t_data;        /* */
  } HeapTupleData;
Index: src/include/catalog/pg_attribute.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_attribute.h,v
retrieving revision 1.59
diff -c -r1.59 pg_attribute.h
*** src/include/catalog/pg_attribute.h    2000/06/12 03:40:52    1.59
--- src/include/catalog/pg_attribute.h    2000/07/01 05:30:57
***************
*** 267,272 ****
--- 267,273 ----
  DATA(insert OID = 0 ( 1247 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1247 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1247 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1247 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_database
***************
*** 282,287 ****
--- 283,289 ----
  DATA(insert OID = 0 ( 1262 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1262 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1262 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1262 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_proc
***************
*** 329,334 ****
--- 331,337 ----
  DATA(insert OID = 0 ( 1255 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1255 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1255 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1255 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_shadow
***************
*** 348,353 ****
--- 351,357 ----
  DATA(insert OID = 0 ( 1260 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1260 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1260 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1260 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_group
***************
*** 362,367 ****
--- 366,372 ----
  DATA(insert OID = 0 ( 1261 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1261 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1261 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1261 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_attribute
***************
*** 405,410 ****
--- 410,416 ----
  DATA(insert OID = 0 ( 1249 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1249 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1249 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1249 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_class
***************
*** 458,463 ****
--- 464,470 ----
  DATA(insert OID = 0 ( 1259 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1259 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1259 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1259 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_attrdef
***************
*** 473,478 ****
--- 480,486 ----
  DATA(insert OID = 0 ( 1215 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1215 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1215 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1215 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_relcheck
***************
*** 488,493 ****
--- 496,502 ----
  DATA(insert OID = 0 ( 1216 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1216 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1216 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1216 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_trigger
***************
*** 513,518 ****
--- 522,528 ----
  DATA(insert OID = 0 ( 1219 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1219 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1219 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1219 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_variable - this relation is modified by special purpose access
Index: src/test/regress/expected/inherit.out
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/test/regress/expected/inherit.out,v
retrieving revision 1.1
diff -c -r1.1 inherit.out
*** src/test/regress/expected/inherit.out    2000/06/09 11:12:37    1.1
--- src/test/regress/expected/inherit.out    2000/07/01 05:31:02
***************
*** 29,534 ****
  INSERT INTO d(aa) VALUES('dddddd');
  INSERT INTO d(aa) VALUES('ddddddd');
  INSERT INTO d(aa) VALUES('dddddddd');
! SELECT * FROM a;
!     aa
! ----------
!  aaa
!  aaaa
!  aaaaa
!  aaaaaa
!  aaaaaaa
!  aaaaaaaa
!  bbb
!  bbbb
!  bbbbb
!  bbbbbb
!  bbbbbbb
!  bbbbbbbb
!  ccc
!  cccc
!  ccccc
!  cccccc
!  ccccccc
!  cccccccc
!  ddd
!  dddd
!  ddddd
!  dddddd
!  ddddddd
!  dddddddd
  (24 rows)

! SELECT * FROM b;
!     aa    | bb
! ----------+----
!  bbb      |
!  bbbb     |
!  bbbbb    |
!  bbbbbb   |
!  bbbbbbb  |
!  bbbbbbbb |
!  ddd      |
!  dddd     |
!  ddddd    |
!  dddddd   |
!  ddddddd  |
!  dddddddd |
! (12 rows)
!
! SELECT * FROM c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
!  ddd      |
!  dddd     |
!  ddddd    |
!  dddddd   |
!  ddddddd  |
!  dddddddd |
! (12 rows)
!
! SELECT * FROM d;
!     aa    | bb | cc | dd
! ----------+----+----+----
!  ddd      |    |    |
!  dddd     |    |    |
!  ddddd    |    |    |
!  dddddd   |    |    |
!  ddddddd  |    |    |
!  dddddddd |    |    |
  (6 rows)

- SELECT * FROM ONLY a;
-     aa
- ----------
-  aaa
-  aaaa
-  aaaaa
-  aaaaaa
-  aaaaaaa
-  aaaaaaaa
- (6 rows)
-
- SELECT * FROM ONLY b;
-     aa    | bb
- ----------+----
-  bbb      |
-  bbbb     |
-  bbbbb    |
-  bbbbbb   |
-  bbbbbbb  |
-  bbbbbbbb |
- (6 rows)
-
- SELECT * FROM ONLY c;
-     aa    | cc
- ----------+----
-  ccc      |
-  cccc     |
-  ccccc    |
-  cccccc   |
-  ccccccc  |
-  cccccccc |
- (6 rows)
-
- SELECT * FROM ONLY d;
-     aa    | bb | cc | dd
- ----------+----+----+----
-  ddd      |    |    |
-  dddd     |    |    |
-  ddddd    |    |    |
-  dddddd   |    |    |
-  ddddddd  |    |    |
-  dddddddd |    |    |
- (6 rows)
-
  UPDATE a SET aa='zzzz' WHERE aa='aaaa';
! UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa';
! UPDATE b SET aa='zzz' WHERE aa='aaa';
! UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
! UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';
! SELECT * FROM a;
!     aa
! ----------
!  zzzz
!  zzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  bbb
!  bbbb
!  bbbbb
!  bbbbbb
!  bbbbbbb
!  bbbbbbbb
!  ccc
!  cccc
!  ccccc
!  cccccc
!  ccccccc
!  cccccccc
!  ddd
!  dddd
!  ddddd
!  dddddd
!  ddddddd
!  dddddddd
! (24 rows)
!
! SELECT * FROM b;
!     aa    | bb
! ----------+----
!  bbb      |
!  bbbb     |
!  bbbbb    |
!  bbbbbb   |
!  bbbbbbb  |
!  bbbbbbbb |
!  ddd      |
!  dddd     |
!  ddddd    |
!  dddddd   |
!  ddddddd  |
!  dddddddd |
! (12 rows)
!
! SELECT * FROM c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
!  ddd      |
!  dddd     |
!  ddddd    |
!  dddddd   |
!  ddddddd  |
!  dddddddd |
! (12 rows)
!
! SELECT * FROM d;
!     aa    | bb | cc | dd
! ----------+----+----+----
!  ddd      |    |    |
!  dddd     |    |    |
!  ddddd    |    |    |
!  dddddd   |    |    |
!  ddddddd  |    |    |
!  dddddddd |    |    |
! (6 rows)
!
! SELECT * FROM ONLY a;
!    aa
! --------
!  zzzz
!  zzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
! (6 rows)
!
! SELECT * FROM ONLY b;
!     aa    | bb
! ----------+----
!  bbb      |
!  bbbb     |
!  bbbbb    |
!  bbbbbb   |
!  bbbbbbb  |
!  bbbbbbbb |
! (6 rows)
!
! SELECT * FROM ONLY c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
! (6 rows)
!
! SELECT * FROM ONLY d;
!     aa    | bb | cc | dd
! ----------+----+----+----
!  ddd      |    |    |
!  dddd     |    |    |
!  ddddd    |    |    |
!  dddddd   |    |    |
!  ddddddd  |    |    |
!  dddddddd |    |    |
! (6 rows)
!
! UPDATE b SET aa='new';
! SELECT * FROM a;
!     aa
! ----------
!  zzzz
!  zzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  new
!  new
!  new
!  new
!  new
!  new
!  ccc
!  cccc
!  ccccc
!  cccccc
!  ccccccc
!  cccccccc
!  new
!  new
!  new
!  new
!  new
!  new
! (24 rows)
!
! SELECT * FROM b;
!  aa  | bb
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
! (12 rows)
!
! SELECT * FROM c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
!  new      |
!  new      |
!  new      |
!  new      |
!  new      |
!  new      |
! (12 rows)
!
! SELECT * FROM d;
!  aa  | bb | cc | dd
! -----+----+----+----
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
! (6 rows)
!
! SELECT * FROM ONLY a;
!    aa
! --------
!  zzzz
!  zzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
! (6 rows)
!
! SELECT * FROM ONLY b;
!  aa  | bb
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
! (6 rows)
!
! SELECT * FROM ONLY c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
! (6 rows)
!
! SELECT * FROM ONLY d;
!  aa  | bb | cc | dd
! -----+----+----+----
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
! (6 rows)
!
! UPDATE a SET aa='new';
! DELETE FROM ONLY c WHERE aa='new';
! SELECT * FROM a;
!  aa
! -----
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
! (18 rows)
!
! SELECT * FROM b;
!  aa  | bb
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
! (12 rows)
!
! SELECT * FROM c;
!  aa  | cc
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
! (6 rows)
!
! SELECT * FROM d;
!  aa  | bb | cc | dd
! -----+----+----+----
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
! (6 rows)
!
! SELECT * FROM ONLY a;
!  aa
! -----
!  new
!  new
!  new
!  new
!  new
!  new
! (6 rows)
!
! SELECT * FROM ONLY b;
!  aa  | bb
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
! (6 rows)
!
! SELECT * FROM ONLY c;
!  aa | cc
! ----+----
! (0 rows)
!
! SELECT * FROM ONLY d;
!  aa  | bb | cc | dd
! -----+----+----+----
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
! (6 rows)
!
! DELETE FROM a;
! SELECT * FROM a;
!  aa
! ----
! (0 rows)
!
! SELECT * FROM b;
!  aa | bb
! ----+----
! (0 rows)
!
! SELECT * FROM c;
!  aa | cc
! ----+----
! (0 rows)
!
! SELECT * FROM d;
!  aa | bb | cc | dd
! ----+----+----+----
! (0 rows)
!
! SELECT * FROM ONLY a;
!  aa
! ----
! (0 rows)
!
! SELECT * FROM ONLY b;
!  aa | bb
! ----+----
! (0 rows)
!
! SELECT * FROM ONLY c;
!  aa | cc
! ----+----
! (0 rows)
!
! SELECT * FROM ONLY d;
!  aa | bb | cc | dd
! ----+----+----+----
! (0 rows)
!
--- 29,154 ----
  INSERT INTO d(aa) VALUES('dddddd');
  INSERT INTO d(aa) VALUES('ddddddd');
  INSERT INTO d(aa) VALUES('dddddddd');
! SELECT tableoid, * FROM a;
!  tableoid |    aa
! ----------+----------
!     34880 | aaa
!     34880 | aaaa
!     34880 | aaaaa
!     34880 | aaaaaa
!     34880 | aaaaaaa
!     34880 | aaaaaaaa
!     34890 | bbb
!     34890 | bbbb
!     34890 | bbbbb
!     34890 | bbbbbb
!     34890 | bbbbbbb
!     34890 | bbbbbbbb
!     34903 | ccc
!     34903 | cccc
!     34903 | ccccc
!     34903 | cccccc
!     34903 | ccccccc
!     34903 | cccccccc
!     34916 | ddd
!     34916 | dddd
!     34916 | ddddd
!     34916 | dddddd
!     34916 | ddddddd
!     34916 | dddddddd
  (24 rows)

! SELECT tableoid, * FROM b;
!  tableoid |    aa    | bb
! ----------+----------+----
!     34890 | bbb      |
!     34890 | bbbb     |
!     34890 | bbbbb    |
!     34890 | bbbbbb   |
!     34890 | bbbbbbb  |
!     34890 | bbbbbbbb |
!     34916 | ddd      |
!     34916 | dddd     |
!     34916 | ddddd    |
!     34916 | dddddd   |
!     34916 | ddddddd  |
!     34916 | dddddddd |
! (12 rows)
!
! SELECT tableoid, * FROM c;
!  tableoid |    aa    | cc
! ----------+----------+----
!     34903 | ccc      |
!     34903 | cccc     |
!     34903 | ccccc    |
!     34903 | cccccc   |
!     34903 | ccccccc  |
!     34903 | cccccccc |
!     34916 | ddd      |
!     34916 | dddd     |
!     34916 | ddddd    |
!     34916 | dddddd   |
!     34916 | ddddddd  |
!     34916 | dddddddd |
! (12 rows)
!
! SELECT tableoid, * FROM d;
!  tableoid |    aa    | bb | cc | dd
! ----------+----------+----+----+----
!     34916 | ddd      |    |    |
!     34916 | dddd     |    |    |
!     34916 | ddddd    |    |    |
!     34916 | dddddd   |    |    |
!     34916 | ddddddd  |    |    |
!     34916 | dddddddd |    |    |
! (6 rows)
!
! SELECT tableoid, * FROM ONLY a;
!  tableoid |    aa
! ----------+----------
!     34880 | aaa
!     34880 | aaaa
!     34880 | aaaaa
!     34880 | aaaaaa
!     34880 | aaaaaaa
!     34880 | aaaaaaaa
! (6 rows)
!
! SELECT tableoid, * FROM ONLY b;
!  tableoid |    aa    | bb
! ----------+----------+----
!     34890 | bbb      |
!     34890 | bbbb     |
!     34890 | bbbbb    |
!     34890 | bbbbbb   |
!     34890 | bbbbbbb  |
!     34890 | bbbbbbbb |
! (6 rows)
!
! SELECT tableoid, * FROM ONLY c;
!  tableoid |    aa    | cc
! ----------+----------+----
!     34903 | ccc      |
!     34903 | cccc     |
!     34903 | ccccc    |
!     34903 | cccccc   |
!     34903 | ccccccc  |
!     34903 | cccccccc |
! (6 rows)
!
! SELECT tableoid, * FROM ONLY d;
!  tableoid |    aa    | bb | cc | dd
! ----------+----------+----+----+----
!     34916 | ddd      |    |    |
!     34916 | dddd     |    |    |
!     34916 | ddddd    |    |    |
!     34916 | dddddd   |    |    |
!     34916 | ddddddd  |    |    |
!     34916 | dddddddd |    |    |
  (6 rows)

  UPDATE a SET aa='zzzz' WHERE aa='aaaa';
! pqReadData() -- backend closed the channel unexpectedly.
!     This probably means the backend terminated abnormally
!     before or while processing the request.
! connection to server was lost
Index: src/test/regress/sql/inherit.sql
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/test/regress/sql/inherit.sql,v
retrieving revision 1.1
diff -c -r1.1 inherit.sql
*** src/test/regress/sql/inherit.sql    2000/06/09 11:12:38    1.1
--- src/test/regress/sql/inherit.sql    2000/07/01 05:31:03
***************
*** 34,47 ****
  INSERT INTO d(aa) VALUES('ddddddd');
  INSERT INTO d(aa) VALUES('dddddddd');

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;

  UPDATE a SET aa='zzzz' WHERE aa='aaaa';
  UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa';
--- 34,47 ----
  INSERT INTO d(aa) VALUES('ddddddd');
  INSERT INTO d(aa) VALUES('dddddddd');

! SELECT tableoid, * FROM a;
! SELECT tableoid, * FROM b;
! SELECT tableoid, * FROM c;
! SELECT tableoid, * FROM d;
! SELECT tableoid, * FROM ONLY a;
! SELECT tableoid, * FROM ONLY b;
! SELECT tableoid, * FROM ONLY c;
! SELECT tableoid, * FROM ONLY d;

  UPDATE a SET aa='zzzz' WHERE aa='aaaa';
  UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa';
***************
*** 49,94 ****
  UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
  UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;

  UPDATE b SET aa='new';

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;

  UPDATE a SET aa='new';

  DELETE FROM ONLY c WHERE aa='new';

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;

  DELETE FROM a;

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;
--- 49,94 ----
  UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
  UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';

! SELECT tableoid, * FROM a;
! SELECT tableoid, * FROM b;
! SELECT tableoid, * FROM c;
! SELECT tableoid, * FROM d;
! SELECT tableoid, * FROM ONLY a;
! SELECT tableoid, * FROM ONLY b;
! SELECT tableoid, * FROM ONLY c;
! SELECT tableoid, * FROM ONLY d;

  UPDATE b SET aa='new';

! SELECT tableoid, * FROM a;
! SELECT tableoid, * FROM b;
! SELECT tableoid, * FROM c;
! SELECT tableoid, * FROM d;
! SELECT tableoid, * FROM ONLY a;
! SELECT tableoid, * FROM ONLY b;
! SELECT tableoid, * FROM ONLY c;
! SELECT tableoid, * FROM ONLY d;

  UPDATE a SET aa='new';

  DELETE FROM ONLY c WHERE aa='new';

! SELECT tableoid, * FROM a;
! SELECT tableoid, * FROM b;
! SELECT tableoid, * FROM c;
! SELECT tableoid, * FROM d;
! SELECT tableoid, * FROM ONLY a;
! SELECT tableoid, * FROM ONLY b;
! SELECT tableoid, * FROM ONLY c;
! SELECT tableoid, * FROM ONLY d;

  DELETE FROM a;

! SELECT tableoid, * FROM a;
! SELECT tableoid, * FROM b;
! SELECT tableoid, * FROM c;
! SELECT tableoid, * FROM d;
! SELECT tableoid, * FROM ONLY a;
! SELECT tableoid, * FROM ONLY b;
! SELECT tableoid, * FROM ONLY c;
! SELECT tableoid, * FROM ONLY d;
Index: src/tools/make_mkid
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/tools/make_mkid,v
retrieving revision 1.4
diff -c -r1.4 make_mkid
*** src/tools/make_mkid    2000/03/31 01:41:27    1.4
--- src/tools/make_mkid    2000/07/01 05:31:03
***************
*** 1,6 ****
  #!/bin/sh
  find `pwd`/ \( -name _deadcode -a -prune \) -o \
!     -type f -name '*.[chyl]' -print|sed 's;//;/;g' | mkid

  find . -name  'CVS' -prune -o -type d -print  |while read DIR
  do
--- 1,6 ----
  #!/bin/sh
  find `pwd`/ \( -name _deadcode -a -prune \) -o \
!     -type f -name '*.[chyl]' -print|sed 's;//;/;g' | mkid -

  find . -name  'CVS' -prune -o -type d -print  |while read DIR
  do

Re: [PATCHES] TABLEOID patch

From
Tom Lane
Date:
Chris Bitmead <chris@bitmead.com> writes:
> Attached is the tableoid patch. If there are no objections can I have
> this applied?

I definitely object to the tests of tableoid that you have attached to
the inherit regress test.  Don't you realize that anything that depends
on another installation matching the exact same OIDs you have is pretty
much guaranteed to fail?

            regards, tom lane

Re: [PATCHES] TABLEOID patch

From
Chris Bitmead
Date:
Attached is a new patch which addresses this problem.

--
Chris Bitmead
mailto:chris@bitmead.com? config.log
? config.cache
? config.status
? nohup.out
? GNUmakefile
? src/GNUmakefile
? src/Makefile.global
? src/ID
? src/nohup.out
? src/backend/postgres
? src/backend/fmgr.h
? src/backend/parse.h
? src/backend/global1.bki.source
? src/backend/local1_template1.bki.source
? src/backend/global1.description
? src/backend/local1_template1.description
? src/backend/1
? src/backend/catalog/genbki.sh
? src/backend/catalog/global1.bki.source
? src/backend/catalog/global1.description
? src/backend/catalog/local1_template1.bki.source
? src/backend/catalog/local1_template1.description
? src/backend/parser/y.output
? src/backend/parser/y.output.gz
? src/backend/parser/gram.y.works
? src/backend/parser/gram.y.works.try
? src/backend/parser/y.output.noerror
? src/backend/parser/gram.y.gz
? src/backend/port/Makefile
? src/backend/utils/fmgr.h
? src/backend/utils/fmgrstamp-h
? src/bin/initdb/initdb
? src/bin/initlocation/initlocation
? src/bin/ipcclean/ipcclean
? src/bin/pg_ctl/pg_ctl
? src/bin/pg_dump/pg_dump
? src/bin/pg_id/pg_id
? src/bin/pg_passwd/pg_passwd
? src/bin/pg_version/pg_version
? src/bin/pgtclsh/mkMakefile.tkdefs.sh
? src/bin/pgtclsh/mkMakefile.tcldefs.sh
? src/bin/psql/psql
? src/bin/scripts/createlang
? src/include/version.h
? src/include/config.h
? src/include/parser/parse.h
? src/include/utils/fmgroids.h
? src/interfaces/ecpg/lib/libecpg.so.3.1.1
? src/interfaces/ecpg/preproc/ecpg
? src/interfaces/jdbc/postgresql.jar
? src/interfaces/jdbc/example/psql.class
? src/interfaces/jdbc/postgresql/DriverClass.java
? src/interfaces/jdbc/postgresql/DriverClass.class
? src/interfaces/jdbc/postgresql/Connection.class
? src/interfaces/jdbc/postgresql/Field.class
? src/interfaces/jdbc/postgresql/PG_Stream.class
? src/interfaces/jdbc/postgresql/Driver.class
? src/interfaces/jdbc/postgresql/ResultSet.class
? src/interfaces/jdbc/postgresql/fastpath/Fastpath.class
? src/interfaces/jdbc/postgresql/fastpath/FastpathArg.class
? src/interfaces/jdbc/postgresql/geometric/PGbox.class
? src/interfaces/jdbc/postgresql/geometric/PGpoint.class
? src/interfaces/jdbc/postgresql/geometric/PGcircle.class
? src/interfaces/jdbc/postgresql/geometric/PGline.class
? src/interfaces/jdbc/postgresql/geometric/PGlseg.class
? src/interfaces/jdbc/postgresql/geometric/PGpath.class
? src/interfaces/jdbc/postgresql/geometric/PGpolygon.class
? src/interfaces/jdbc/postgresql/jdbc2/ResultSet.class
? src/interfaces/jdbc/postgresql/jdbc2/Connection.class
? src/interfaces/jdbc/postgresql/jdbc2/ResultSetMetaData.class
? src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.class
? src/interfaces/jdbc/postgresql/jdbc2/Statement.class
? src/interfaces/jdbc/postgresql/jdbc2/PreparedStatement.class
? src/interfaces/jdbc/postgresql/jdbc2/CallableStatement.class
? src/interfaces/jdbc/postgresql/largeobject/LargeObjectManager.class
? src/interfaces/jdbc/postgresql/largeobject/LargeObject.class
? src/interfaces/jdbc/postgresql/util/PSQLException.class
? src/interfaces/jdbc/postgresql/util/UnixCrypt.class
? src/interfaces/jdbc/postgresql/util/Serialize.class
? src/interfaces/jdbc/postgresql/util/PGobject.class
? src/interfaces/jdbc/postgresql/util/PGtokenizer.class
? src/interfaces/jdbc/postgresql/util/PGmoney.class
? src/interfaces/libpgeasy/libpgeasy.so.2.1
? src/interfaces/libpgtcl/mkMakefile.tcldefs.sh
? src/interfaces/libpgtcl/mkMakefile.tkdefs.sh
? src/interfaces/libpq/libpq.so.2.1
? src/interfaces/libpq++/libpq++.so.3.1
? src/interfaces/odbc/Makefile.global
? src/pl/plpgsql/src/libplpgsql.so.1.0
? src/test/regress/GNUmakefile
? src/test/regress/regress.out
? src/test/regress/x.x
? src/test/regress/nohup.out
? src/test/regress/regression.diffs
? src/test/regress/expected/copy.out
? src/test/regress/expected/misc.out
? src/test/regress/expected/create_function_1.out
? src/test/regress/expected/create_function_2.out
? src/test/regress/expected/constraints.out
? src/test/regress/results/boolean.out
? src/test/regress/results/char.out
? src/test/regress/results/name.out
? src/test/regress/results/varchar.out
? src/test/regress/results/text.out
? src/test/regress/results/int2.out
? src/test/regress/results/int4.out
? src/test/regress/results/int8.out
? src/test/regress/results/oid.out
? src/test/regress/results/float4.out
? src/test/regress/results/float8.out
? src/test/regress/results/numeric.out
? src/test/regress/results/strings.out
? src/test/regress/results/numerology.out
? src/test/regress/results/point.out
? src/test/regress/results/lseg.out
? src/test/regress/results/box.out
? src/test/regress/results/path.out
? src/test/regress/results/polygon.out
? src/test/regress/results/circle.out
? src/test/regress/results/interval.out
? src/test/regress/results/timestamp.out
? src/test/regress/results/reltime.out
? src/test/regress/results/tinterval.out
? src/test/regress/results/inet.out
? src/test/regress/results/comments.out
? src/test/regress/results/oidjoins.out
? src/test/regress/results/type_sanity.out
? src/test/regress/results/opr_sanity.out
? src/test/regress/results/abstime.out
? src/test/regress/results/geometry.out
? src/test/regress/results/horology.out
? src/test/regress/results/create_function_1.out
? src/test/regress/results/create_type.out
? src/test/regress/results/create_table.out
? src/test/regress/results/create_function_2.out
? src/test/regress/results/copy.out
? src/test/regress/results/onek.data
? src/test/regress/results/constraints.out
? src/test/regress/results/triggers.out
? src/test/regress/results/create_misc.out
? src/test/regress/results/create_aggregate.out
? src/test/regress/results/create_operator.out
? src/test/regress/results/create_index.out
? src/test/regress/results/inherit.out
? src/test/regress/results/create_view.out
? src/test/regress/results/sanity_check.out
? src/test/regress/results/errors.out
? src/test/regress/results/select.out
? src/test/regress/results/select_into.out
? src/test/regress/results/select_distinct.out
? src/test/regress/results/select_distinct_on.out
? src/test/regress/results/select_implicit.out
? src/test/regress/results/select_having.out
? src/test/regress/results/subselect.out
? src/test/regress/results/union.out
? src/test/regress/results/case.out
? src/test/regress/results/join.out
? src/test/regress/results/aggregates.out
? src/test/regress/results/transactions.out
? src/test/regress/results/random.out
? src/test/regress/results/portals.out
? src/test/regress/results/arrays.out
? src/test/regress/results/btree_index.out
? src/test/regress/results/hash_index.out
? src/test/regress/results/misc.out
? src/test/regress/results/select_views.out
? src/test/regress/results/alter_table.out
? src/test/regress/results/portals_p2.out
? src/test/regress/results/rules.out
? src/test/regress/results/foreign_key.out
? src/test/regress/results/limit.out
? src/test/regress/results/plpgsql.out
? src/test/regress/results/temp.out
? src/test/regress/results/stud_emp.data
? src/test/regress/sql/copy.sql
? src/test/regress/sql/misc.sql
? src/test/regress/sql/create_function_1.sql
? src/test/regress/sql/create_function_2.sql
? src/test/regress/sql/constraints.sql
Index: doc/src/sgml/inherit.sgml
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/inherit.sgml,v
retrieving revision 1.10
diff -c -r1.10 inherit.sgml
*** doc/src/sgml/inherit.sgml    2000/06/22 22:31:15    1.10
--- doc/src/sgml/inherit.sgml    2000/07/02 09:29:43
***************
*** 96,101 ****
--- 96,152 ----
     <command>UPDATE</command> and <command>DELETE</command> --
     support this <quote>ONLY</quote> notation.
    </para>
+
+   <para>
+   In some cases you may wish to know which table a particular tuple
+   originated from. There is a system attribute called
+   <quote>TABLEOID</quote> in each table which can tell you the
+   originating table:
+
+    <programlisting>
+     SELECT c.tableoid, c.name, c.altitude
+     FROM cities c
+     WHERE c.altitude > 500;
+    </programlisting>
+
+    which returns:
+
+    <programlisting>
+ +---------+----------+----------+
+ |tableoid |name      | altitude |
+ +---------+----------+----------+
+ |37292    |Las Vegas | 2174     |
+ +---------+----------+----------+
+ |37280    |Mariposa  | 1953     |
+ +---------+----------+----------+
+ |37280    |Madison   | 845      |
+ +---------+----------+----------+
+    </programlisting>
+
+    If you do a join with pg_class you can see the actual table name:
+
+    <programlisting>
+     SELECT p.relname, c.name, c.altitude
+     FROM cities c, pg_class p
+     WHERE c.altitude > 500 and c.tableoid = p.oid;
+    </programlisting>
+
+    which returns:
+
+    <programlisting>
+ +---------+----------+----------+
+ |relname  |name      | altitude |
+ +---------+----------+----------+
+ |capitals |Las Vegas | 2174     |
+ +---------+----------+----------+
+ |cities   |Mariposa  | 1953     |
+ +---------+----------+----------+
+ |cities   |Madison   | 845      |
+ +---------+----------+----------+
+    </programlisting>
+
+   </para>
+
    <note>
     <title>Deprecated</title>
     <para>
Index: src/backend/access/common/heaptuple.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v
retrieving revision 1.62
diff -c -r1.62 heaptuple.c
*** src/backend/access/common/heaptuple.c    2000/04/12 17:14:36    1.62
--- src/backend/access/common/heaptuple.c    2000/07/02 09:29:46
***************
*** 9,15 ****
   *
   *
   * IDENTIFICATION
!  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12 17:14:36
momjianExp $ 
   *
   * NOTES
   *      The old interface functions have been converted to macros
--- 9,15 ----
   *
   *
   * IDENTIFICATION
!  *      $Header: /usr/local/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12 17:14:36 momjian
Exp$ 
   *
   * NOTES
   *      The old interface functions have been converted to macros
***************
*** 169,174 ****
--- 169,175 ----
      else
          switch (attnum)
          {
+             case TableOidAttributeNumber:
              case SelfItemPointerAttributeNumber:
              case ObjectIdAttributeNumber:
              case MinTransactionIdAttributeNumber:
***************
*** 205,210 ****
--- 206,213 ----

      switch (attno)
      {
+         case TableOidAttributeNumber:
+             return sizeof f->t_oid;
          case SelfItemPointerAttributeNumber:
              return sizeof f->t_ctid;
          case ObjectIdAttributeNumber:
***************
*** 237,242 ****
--- 240,248 ----

      switch (attno)
      {
+         case TableOidAttributeNumber:
+             byval = true;
+             break;
          case SelfItemPointerAttributeNumber:
              byval = false;
              break;
***************
*** 275,281 ****
  {
      switch (attnum)
      {
!             case SelfItemPointerAttributeNumber:
              return (Datum) &tup->t_ctid;
          case ObjectIdAttributeNumber:
              return (Datum) (long) tup->t_oid;
--- 281,289 ----
  {
      switch (attnum)
      {
!         case TableOidAttributeNumber:
!             return (Datum) &tup->t_tableoid;
!         case SelfItemPointerAttributeNumber:
              return (Datum) &tup->t_ctid;
          case ObjectIdAttributeNumber:
              return (Datum) (long) tup->t_oid;
Index: src/backend/access/heap/heapam.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/heap/heapam.c,v
retrieving revision 1.73
diff -c -r1.73 heapam.c
*** src/backend/access/heap/heapam.c    2000/06/30 16:10:40    1.73
--- src/backend/access/heap/heapam.c    2000/07/02 09:29:49
***************
*** 235,240 ****
--- 235,242 ----
      int            linesleft;
      ItemPointer tid = (tuple->t_data == NULL) ?
      (ItemPointer) NULL : &(tuple->t_self);
+
+     tuple->tableOid = relation->rd_id;

      /* ----------------
       *    increment access statistics
***************
*** 621,626 ****
--- 623,629 ----

      Assert(lockmode >= NoLock && lockmode < MAX_LOCKMODES);

+
      /* ----------------
       *    increment access statistics
       * ----------------
***************
*** 1084,1089 ****
--- 1087,1093 ----
      ItemPointer tid = &(tuple->t_self);
      OffsetNumber offnum;

+     tuple->tableOid = relation->rd_id;
      /* ----------------
       *    increment access statistics
       * ----------------
***************
*** 1178,1183 ****
--- 1182,1188 ----
      bool        invalidBlock,
                  linkend;

+     tp.tableOid = relation->rd_id;
      /* ----------------
       *    get the buffer from the relation descriptor
       *    Note that this does a buffer pin.
***************
*** 1270,1275 ****
--- 1275,1281 ----
       *    increment access statistics
       * ----------------
       */
+     tup->tableOid = relation->rd_id;
      IncrHeapAccessStat(local_insert);
      IncrHeapAccessStat(global_insert);

***************
*** 1335,1340 ****
--- 1341,1347 ----
      Buffer        buffer;
      int            result;

+     tp.tableOid = relation->rd_id;
      /* increment access statistics */
      IncrHeapAccessStat(local_delete);
      IncrHeapAccessStat(global_delete);
***************
*** 1447,1452 ****
--- 1454,1460 ----
      Buffer        buffer;
      int            result;

+     newtup->tableOid = relation->rd_id;
      /* increment access statistics */
      IncrHeapAccessStat(local_replace);
      IncrHeapAccessStat(global_replace);
***************
*** 1575,1580 ****
--- 1583,1589 ----
      PageHeader    dp;
      int            result;

+     tuple->tableOid = relation->rd_id;
      /* increment access statistics */
      IncrHeapAccessStat(local_mark4update);
      IncrHeapAccessStat(global_mark4update);
Index: src/backend/catalog/heap.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/catalog/heap.c,v
retrieving revision 1.135
diff -c -r1.135 heap.c
*** src/backend/catalog/heap.c    2000/07/02 04:46:09    1.135
--- src/backend/catalog/heap.c    2000/07/02 09:29:55
***************
*** 131,142 ****
      MaxCommandIdAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
  };

! static Form_pg_attribute HeapAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6};

  /* ----------------------------------------------------------------
   *                XXX END OF UGLY HARD CODED BADNESS XXX
!  * ----------------------------------------------------------------
!  */


  /* ----------------------------------------------------------------
--- 131,152 ----
      MaxCommandIdAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
  };

! /*
!    We decide to call this attribute "tableoid" rather than say
! "classoid" on the basis that in the future there may be more than one
! table of a particular class/type. In any case table is still the word
! used in SQL.
! */
! static FormData_pg_attribute a7 = {
!     0xffffffff, {"tableoid"}, OIDOID, 0, sizeof(Oid),
!     TableOidAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
! };

+ static Form_pg_attribute HeapAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6, &a7};
+
  /* ----------------------------------------------------------------
   *                XXX END OF UGLY HARD CODED BADNESS XXX
!  * ---------------------------------------------------------------- */


  /* ----------------------------------------------------------------
Index: src/backend/parser/parse_relation.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_relation.c,v
retrieving revision 1.44
diff -c -r1.44 parse_relation.c
*** src/backend/parser/parse_relation.c    2000/06/20 01:41:21    1.44
--- src/backend/parser/parse_relation.c    2000/07/02 09:29:56
***************
*** 57,62 ****
--- 57,65 ----
      {
          "cmax", MaxCommandIdAttributeNumber, CIDOID
      },
+     {
+         "tableoid", TableOidAttributeNumber, OIDOID
+     }
  };

  #define SPECIALS ((int) (sizeof(special_attr)/sizeof(special_attr[0])))
Index: src/backend/utils/cache/lsyscache.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v
retrieving revision 1.42
diff -c -r1.42 lsyscache.c
*** src/backend/utils/cache/lsyscache.c    2000/06/08 22:37:30    1.42
--- src/backend/utils/cache/lsyscache.c    2000/07/02 09:29:58
***************
*** 249,254 ****
--- 249,256 ----
      if (attnum == ObjectIdAttributeNumber ||
          attnum == SelfItemPointerAttributeNumber)
          return 1.0 / (double) ntuples;
+     if (attnum == TableOidAttributeNumber)
+         return 1.0;

      /*
       * VACUUM ANALYZE has not been run for this table. Produce an estimate
Index: src/include/access/heapam.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/access/heapam.h,v
retrieving revision 1.54
diff -c -r1.54 heapam.h
*** src/include/access/heapam.h    2000/06/30 16:10:49    1.54
--- src/include/access/heapam.h    2000/07/02 09:30:00
***************
*** 165,200 ****
   *
   * ----------------
   */
! #define heap_getattr(tup, attnum, tupleDesc, isnull)                        \
! (                                                                            \
!     AssertMacro((tup) != NULL &&                                            \
!         (attnum) > FirstLowInvalidHeapAttributeNumber &&                    \
!         (attnum) != 0),                                                        \
!     ((attnum) > (int) (tup)->t_data->t_natts) ?                                \
!     (                                                                        \
!         ((isnull) ? (*(isnull) = true) : (dummyret)NULL),                    \
!         (Datum)NULL                                                            \
!     )                                                                        \
!     :                                                                        \
!     (                                                                        \
!         ((attnum) > 0) ?                                                    \
!         (                                                                    \
!             fastgetattr((tup), (attnum), (tupleDesc), (isnull))                \
!         )                                                                    \
!         :                                                                    \
!         (                                                                    \
!             ((isnull) ? (*(isnull) = false) : (dummyret)NULL),                \
!             ((attnum) == SelfItemPointerAttributeNumber) ?                    \
!             (                                                                \
!                 (Datum)((char *)&((tup)->t_self))                            \
!             )                                                                \
!             :                                                                \
!             (                                                                \
!                 (Datum)*(unsigned int *)                                    \
!                     ((char *)(tup)->t_data + heap_sysoffset[-(attnum)-1])    \
!             )                                                                \
!         )                                                                    \
!     )                                                                        \
  )

  extern HeapAccessStatistics heap_access_stats;    /* in stats.c */
--- 165,205 ----
   *
   * ----------------
   */
! #define heap_getattr(tup, attnum, tupleDesc, isnull) \
! ( \
!     AssertMacro((tup) != NULL && \
!         (attnum) > FirstLowInvalidHeapAttributeNumber && \
!         (attnum) != 0), \
!     ((attnum) > (int) (tup)->t_data->t_natts) ? \
!     ( \
!         ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
!         (Datum)NULL \
!     ) \
!     : \
!     ( \
!         ((attnum) > 0) ? \
!         ( \
!             fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
!         ) \
!         : \
!         ( \
!             ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
!             ((attnum) == SelfItemPointerAttributeNumber) ? \
!             ( \
!                 (Datum)((char *)&((tup)->t_self)) \
!             ) \
!             : \
!             (((attnum) == TableOidAttributeNumber) ? \
!             ( \
!                 (Datum)((tup)->tableOid) \
!             ) \
!             : \
!             ( \
!                 (Datum)*(unsigned int *) \
!                     ((char *)(tup)->t_data + heap_sysoffset[-(attnum)-1]) \
!             )) \
!         ) \
!     ) \
  )

  extern HeapAccessStatistics heap_access_stats;    /* in stats.c */
Index: src/include/access/htup.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/access/htup.h,v
retrieving revision 1.30
diff -c -r1.30 htup.h
*** src/include/access/htup.h    2000/06/02 10:20:26    1.30
--- src/include/access/htup.h    2000/07/02 09:30:01
***************
*** 133,139 ****
  #define MinCommandIdAttributeNumber                (-4)
  #define MaxTransactionIdAttributeNumber            (-5)
  #define MaxCommandIdAttributeNumber                (-6)
! #define FirstLowInvalidHeapAttributeNumber        (-7)

  /* If you make any changes above, the order off offsets in this must change */
  extern long heap_sysoffset[];
--- 133,140 ----
  #define MinCommandIdAttributeNumber                (-4)
  #define MaxTransactionIdAttributeNumber            (-5)
  #define MaxCommandIdAttributeNumber                (-6)
! #define TableOidAttributeNumber                    (-7)
! #define FirstLowInvalidHeapAttributeNumber        (-8)

  /* If you make any changes above, the order off offsets in this must change */
  extern long heap_sysoffset[];
***************
*** 156,161 ****
--- 157,163 ----
  {
      uint32        t_len;            /* length of *t_data */
      ItemPointerData t_self;        /* SelfItemPointer */
+     Oid tableOid;                    /* */
      MemoryContext t_datamcxt;    /* */
      HeapTupleHeader t_data;        /* */
  } HeapTupleData;
Index: src/include/catalog/pg_attribute.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_attribute.h,v
retrieving revision 1.59
diff -c -r1.59 pg_attribute.h
*** src/include/catalog/pg_attribute.h    2000/06/12 03:40:52    1.59
--- src/include/catalog/pg_attribute.h    2000/07/02 09:30:03
***************
*** 267,272 ****
--- 267,273 ----
  DATA(insert OID = 0 ( 1247 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1247 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1247 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1247 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_database
***************
*** 282,287 ****
--- 283,289 ----
  DATA(insert OID = 0 ( 1262 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1262 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1262 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1262 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_proc
***************
*** 329,334 ****
--- 331,337 ----
  DATA(insert OID = 0 ( 1255 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1255 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1255 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1255 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_shadow
***************
*** 348,353 ****
--- 351,357 ----
  DATA(insert OID = 0 ( 1260 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1260 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1260 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1260 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_group
***************
*** 362,367 ****
--- 366,372 ----
  DATA(insert OID = 0 ( 1261 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1261 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1261 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1261 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_attribute
***************
*** 405,410 ****
--- 410,416 ----
  DATA(insert OID = 0 ( 1249 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1249 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1249 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1249 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_class
***************
*** 458,463 ****
--- 464,470 ----
  DATA(insert OID = 0 ( 1259 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1259 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1259 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1259 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_attrdef
***************
*** 473,478 ****
--- 480,486 ----
  DATA(insert OID = 0 ( 1215 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1215 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1215 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1215 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_relcheck
***************
*** 488,493 ****
--- 496,502 ----
  DATA(insert OID = 0 ( 1216 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1216 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1216 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1216 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_trigger
***************
*** 513,518 ****
--- 522,528 ----
  DATA(insert OID = 0 ( 1219 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1219 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
  DATA(insert OID = 0 ( 1219 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
+ DATA(insert OID = 0 ( 1219 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));

  /* ----------------
   *        pg_variable - this relation is modified by special purpose access
Index: src/test/regress/expected/inherit.out
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/test/regress/expected/inherit.out,v
retrieving revision 1.1
diff -c -r1.1 inherit.out
*** src/test/regress/expected/inherit.out    2000/06/09 11:12:37    1.1
--- src/test/regress/expected/inherit.out    2000/07/02 09:30:08
***************
*** 29,150 ****
  INSERT INTO d(aa) VALUES('dddddd');
  INSERT INTO d(aa) VALUES('ddddddd');
  INSERT INTO d(aa) VALUES('dddddddd');
! SELECT * FROM a;
!     aa
! ----------
!  aaa
!  aaaa
!  aaaaa
!  aaaaaa
!  aaaaaaa
!  aaaaaaaa
!  bbb
!  bbbb
!  bbbbb
!  bbbbbb
!  bbbbbbb
!  bbbbbbbb
!  ccc
!  cccc
!  ccccc
!  cccccc
!  ccccccc
!  cccccccc
!  ddd
!  dddd
!  ddddd
!  dddddd
!  ddddddd
!  dddddddd
  (24 rows)

! SELECT * FROM b;
!     aa    | bb
! ----------+----
!  bbb      |
!  bbbb     |
!  bbbbb    |
!  bbbbbb   |
!  bbbbbbb  |
!  bbbbbbbb |
!  ddd      |
!  dddd     |
!  ddddd    |
!  dddddd   |
!  ddddddd  |
!  dddddddd |
  (12 rows)

! SELECT * FROM c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
!  ddd      |
!  dddd     |
!  ddddd    |
!  dddddd   |
!  ddddddd  |
!  dddddddd |
  (12 rows)

! SELECT * FROM d;
!     aa    | bb | cc | dd
! ----------+----+----+----
!  ddd      |    |    |
!  dddd     |    |    |
!  ddddd    |    |    |
!  dddddd   |    |    |
!  ddddddd  |    |    |
!  dddddddd |    |    |
! (6 rows)
!
! SELECT * FROM ONLY a;
!     aa
! ----------
!  aaa
!  aaaa
!  aaaaa
!  aaaaaa
!  aaaaaaa
!  aaaaaaaa
! (6 rows)
!
! SELECT * FROM ONLY b;
!     aa    | bb
! ----------+----
!  bbb      |
!  bbbb     |
!  bbbbb    |
!  bbbbbb   |
!  bbbbbbb  |
!  bbbbbbbb |
! (6 rows)
!
! SELECT * FROM ONLY c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
! (6 rows)
!
! SELECT * FROM ONLY d;
!     aa    | bb | cc | dd
! ----------+----+----+----
!  ddd      |    |    |
!  dddd     |    |    |
!  ddddd    |    |    |
!  dddddd   |    |    |
!  ddddddd  |    |    |
!  dddddddd |    |    |
  (6 rows)

  UPDATE a SET aa='zzzz' WHERE aa='aaaa';
--- 29,150 ----
  INSERT INTO d(aa) VALUES('dddddd');
  INSERT INTO d(aa) VALUES('ddddddd');
  INSERT INTO d(aa) VALUES('dddddddd');
! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
!  relname |    aa
! ---------+----------
!  a       | aaa
!  a       | aaaa
!  a       | aaaaa
!  a       | aaaaaa
!  a       | aaaaaaa
!  a       | aaaaaaaa
!  b       | bbb
!  b       | bbbb
!  b       | bbbbb
!  b       | bbbbbb
!  b       | bbbbbbb
!  b       | bbbbbbbb
!  c       | ccc
!  c       | cccc
!  c       | ccccc
!  c       | cccccc
!  c       | ccccccc
!  c       | cccccccc
!  d       | ddd
!  d       | dddd
!  d       | ddddd
!  d       | dddddd
!  d       | ddddddd
!  d       | dddddddd
  (24 rows)

! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
!  relname |    aa    | bb
! ---------+----------+----
!  b       | bbb      |
!  b       | bbbb     |
!  b       | bbbbb    |
!  b       | bbbbbb   |
!  b       | bbbbbbb  |
!  b       | bbbbbbbb |
!  d       | ddd      |
!  d       | dddd     |
!  d       | ddddd    |
!  d       | dddddd   |
!  d       | ddddddd  |
!  d       | dddddddd |
  (12 rows)

! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
!  relname |    aa    | cc
! ---------+----------+----
!  c       | ccc      |
!  c       | cccc     |
!  c       | ccccc    |
!  c       | cccccc   |
!  c       | ccccccc  |
!  c       | cccccccc |
!  d       | ddd      |
!  d       | dddd     |
!  d       | ddddd    |
!  d       | dddddd   |
!  d       | ddddddd  |
!  d       | dddddddd |
  (12 rows)

! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
!  relname |    aa    | bb | cc | dd
! ---------+----------+----+----+----
!  d       | ddd      |    |    |
!  d       | dddd     |    |    |
!  d       | ddddd    |    |    |
!  d       | dddddd   |    |    |
!  d       | ddddddd  |    |    |
!  d       | dddddddd |    |    |
! (6 rows)
!
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
!  relname |    aa
! ---------+----------
!  a       | aaa
!  a       | aaaa
!  a       | aaaaa
!  a       | aaaaaa
!  a       | aaaaaaa
!  a       | aaaaaaaa
! (6 rows)
!
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
!  relname |    aa    | bb
! ---------+----------+----
!  b       | bbb      |
!  b       | bbbb     |
!  b       | bbbbb    |
!  b       | bbbbbb   |
!  b       | bbbbbbb  |
!  b       | bbbbbbbb |
! (6 rows)
!
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
!  relname |    aa    | cc
! ---------+----------+----
!  c       | ccc      |
!  c       | cccc     |
!  c       | ccccc    |
!  c       | cccccc   |
!  c       | ccccccc  |
!  c       | cccccccc |
! (6 rows)
!
! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
!  relname |    aa    | bb | cc | dd
! ---------+----------+----+----+----
!  d       | ddd      |    |    |
!  d       | dddd     |    |    |
!  d       | ddddd    |    |    |
!  d       | dddddd   |    |    |
!  d       | ddddddd  |    |    |
!  d       | dddddddd |    |    |
  (6 rows)

  UPDATE a SET aa='zzzz' WHERE aa='aaaa';
***************
*** 152,534 ****
  UPDATE b SET aa='zzz' WHERE aa='aaa';
  UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
  UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';
! SELECT * FROM a;
!     aa
! ----------
!  zzzz
!  zzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  bbb
!  bbbb
!  bbbbb
!  bbbbbb
!  bbbbbbb
!  bbbbbbbb
!  ccc
!  cccc
!  ccccc
!  cccccc
!  ccccccc
!  cccccccc
!  ddd
!  dddd
!  ddddd
!  dddddd
!  ddddddd
!  dddddddd
  (24 rows)

! SELECT * FROM b;
!     aa    | bb
! ----------+----
!  bbb      |
!  bbbb     |
!  bbbbb    |
!  bbbbbb   |
!  bbbbbbb  |
!  bbbbbbbb |
!  ddd      |
!  dddd     |
!  ddddd    |
!  dddddd   |
!  ddddddd  |
!  dddddddd |
  (12 rows)

! SELECT * FROM c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
!  ddd      |
!  dddd     |
!  ddddd    |
!  dddddd   |
!  ddddddd  |
!  dddddddd |
  (12 rows)

! SELECT * FROM d;
!     aa    | bb | cc | dd
! ----------+----+----+----
!  ddd      |    |    |
!  dddd     |    |    |
!  ddddd    |    |    |
!  dddddd   |    |    |
!  ddddddd  |    |    |
!  dddddddd |    |    |
! (6 rows)
!
! SELECT * FROM ONLY a;
!    aa
! --------
!  zzzz
!  zzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
! (6 rows)
!
! SELECT * FROM ONLY b;
!     aa    | bb
! ----------+----
!  bbb      |
!  bbbb     |
!  bbbbb    |
!  bbbbbb   |
!  bbbbbbb  |
!  bbbbbbbb |
! (6 rows)
!
! SELECT * FROM ONLY c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
! (6 rows)
!
! SELECT * FROM ONLY d;
!     aa    | bb | cc | dd
! ----------+----+----+----
!  ddd      |    |    |
!  dddd     |    |    |
!  ddddd    |    |    |
!  dddddd   |    |    |
!  ddddddd  |    |    |
!  dddddddd |    |    |
  (6 rows)

  UPDATE b SET aa='new';
! SELECT * FROM a;
!     aa
! ----------
!  zzzz
!  zzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  new
!  new
!  new
!  new
!  new
!  new
!  ccc
!  cccc
!  ccccc
!  cccccc
!  ccccccc
!  cccccccc
!  new
!  new
!  new
!  new
!  new
!  new
  (24 rows)

! SELECT * FROM b;
!  aa  | bb
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
  (12 rows)

! SELECT * FROM c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
!  new      |
!  new      |
!  new      |
!  new      |
!  new      |
!  new      |
  (12 rows)

! SELECT * FROM d;
!  aa  | bb | cc | dd
! -----+----+----+----
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
! (6 rows)
!
! SELECT * FROM ONLY a;
!    aa
! --------
!  zzzz
!  zzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
!  zzzzzz
! (6 rows)
!
! SELECT * FROM ONLY b;
!  aa  | bb
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
! (6 rows)
!
! SELECT * FROM ONLY c;
!     aa    | cc
! ----------+----
!  ccc      |
!  cccc     |
!  ccccc    |
!  cccccc   |
!  ccccccc  |
!  cccccccc |
! (6 rows)
!
! SELECT * FROM ONLY d;
!  aa  | bb | cc | dd
! -----+----+----+----
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
  (6 rows)

  UPDATE a SET aa='new';
  DELETE FROM ONLY c WHERE aa='new';
! SELECT * FROM a;
!  aa
! -----
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
!  new
  (18 rows)

! SELECT * FROM b;
!  aa  | bb
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
  (12 rows)

! SELECT * FROM c;
!  aa  | cc
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
! (6 rows)
!
! SELECT * FROM d;
!  aa  | bb | cc | dd
! -----+----+----+----
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
! (6 rows)
!
! SELECT * FROM ONLY a;
!  aa
! -----
!  new
!  new
!  new
!  new
!  new
!  new
! (6 rows)
!
! SELECT * FROM ONLY b;
!  aa  | bb
! -----+----
!  new |
!  new |
!  new |
!  new |
!  new |
!  new |
! (6 rows)
!
! SELECT * FROM ONLY c;
!  aa | cc
! ----+----
  (0 rows)

! SELECT * FROM ONLY d;
!  aa  | bb | cc | dd
! -----+----+----+----
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
!  new |    |    |
  (6 rows)

  DELETE FROM a;
! SELECT * FROM a;
!  aa
! ----
  (0 rows)

! SELECT * FROM b;
!  aa | bb
! ----+----
  (0 rows)

! SELECT * FROM c;
!  aa | cc
! ----+----
  (0 rows)

! SELECT * FROM d;
!  aa | bb | cc | dd
! ----+----+----+----
  (0 rows)

! SELECT * FROM ONLY a;
!  aa
! ----
  (0 rows)

! SELECT * FROM ONLY b;
!  aa | bb
! ----+----
  (0 rows)

! SELECT * FROM ONLY c;
!  aa | cc
! ----+----
  (0 rows)

! SELECT * FROM ONLY d;
!  aa | bb | cc | dd
! ----+----+----+----
  (0 rows)

--- 152,534 ----
  UPDATE b SET aa='zzz' WHERE aa='aaa';
  UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
  UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';
! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
!  relname |    aa
! ---------+----------
!  a       | zzzz
!  a       | zzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  b       | bbb
!  b       | bbbb
!  b       | bbbbb
!  b       | bbbbbb
!  b       | bbbbbbb
!  b       | bbbbbbbb
!  c       | ccc
!  c       | cccc
!  c       | ccccc
!  c       | cccccc
!  c       | ccccccc
!  c       | cccccccc
!  d       | ddd
!  d       | dddd
!  d       | ddddd
!  d       | dddddd
!  d       | ddddddd
!  d       | dddddddd
  (24 rows)

! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
!  relname |    aa    | bb
! ---------+----------+----
!  b       | bbb      |
!  b       | bbbb     |
!  b       | bbbbb    |
!  b       | bbbbbb   |
!  b       | bbbbbbb  |
!  b       | bbbbbbbb |
!  d       | ddd      |
!  d       | dddd     |
!  d       | ddddd    |
!  d       | dddddd   |
!  d       | ddddddd  |
!  d       | dddddddd |
  (12 rows)

! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
!  relname |    aa    | cc
! ---------+----------+----
!  c       | ccc      |
!  c       | cccc     |
!  c       | ccccc    |
!  c       | cccccc   |
!  c       | ccccccc  |
!  c       | cccccccc |
!  d       | ddd      |
!  d       | dddd     |
!  d       | ddddd    |
!  d       | dddddd   |
!  d       | ddddddd  |
!  d       | dddddddd |
  (12 rows)

! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
!  relname |    aa    | bb | cc | dd
! ---------+----------+----+----+----
!  d       | ddd      |    |    |
!  d       | dddd     |    |    |
!  d       | ddddd    |    |    |
!  d       | dddddd   |    |    |
!  d       | ddddddd  |    |    |
!  d       | dddddddd |    |    |
! (6 rows)
!
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
!  relname |   aa
! ---------+--------
!  a       | zzzz
!  a       | zzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  a       | zzzzzz
! (6 rows)
!
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
!  relname |    aa    | bb
! ---------+----------+----
!  b       | bbb      |
!  b       | bbbb     |
!  b       | bbbbb    |
!  b       | bbbbbb   |
!  b       | bbbbbbb  |
!  b       | bbbbbbbb |
! (6 rows)
!
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
!  relname |    aa    | cc
! ---------+----------+----
!  c       | ccc      |
!  c       | cccc     |
!  c       | ccccc    |
!  c       | cccccc   |
!  c       | ccccccc  |
!  c       | cccccccc |
! (6 rows)
!
! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
!  relname |    aa    | bb | cc | dd
! ---------+----------+----+----+----
!  d       | ddd      |    |    |
!  d       | dddd     |    |    |
!  d       | ddddd    |    |    |
!  d       | dddddd   |    |    |
!  d       | ddddddd  |    |    |
!  d       | dddddddd |    |    |
  (6 rows)

  UPDATE b SET aa='new';
! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
!  relname |    aa
! ---------+----------
!  a       | zzzz
!  a       | zzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  b       | new
!  b       | new
!  b       | new
!  b       | new
!  b       | new
!  b       | new
!  c       | ccc
!  c       | cccc
!  c       | ccccc
!  c       | cccccc
!  c       | ccccccc
!  c       | cccccccc
!  d       | new
!  d       | new
!  d       | new
!  d       | new
!  d       | new
!  d       | new
  (24 rows)

! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
!  relname | aa  | bb
! ---------+-----+----
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
  (12 rows)

! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
!  relname |    aa    | cc
! ---------+----------+----
!  c       | ccc      |
!  c       | cccc     |
!  c       | ccccc    |
!  c       | cccccc   |
!  c       | ccccccc  |
!  c       | cccccccc |
!  d       | new      |
!  d       | new      |
!  d       | new      |
!  d       | new      |
!  d       | new      |
!  d       | new      |
  (12 rows)

! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
!  relname | aa  | bb | cc | dd
! ---------+-----+----+----+----
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
! (6 rows)
!
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
!  relname |   aa
! ---------+--------
!  a       | zzzz
!  a       | zzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  a       | zzzzzz
!  a       | zzzzzz
! (6 rows)
!
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
!  relname | aa  | bb
! ---------+-----+----
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
! (6 rows)
!
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
!  relname |    aa    | cc
! ---------+----------+----
!  c       | ccc      |
!  c       | cccc     |
!  c       | ccccc    |
!  c       | cccccc   |
!  c       | ccccccc  |
!  c       | cccccccc |
! (6 rows)
!
! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
!  relname | aa  | bb | cc | dd
! ---------+-----+----+----+----
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
  (6 rows)

  UPDATE a SET aa='new';
  DELETE FROM ONLY c WHERE aa='new';
! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
!  relname | aa
! ---------+-----
!  a       | new
!  a       | new
!  a       | new
!  a       | new
!  a       | new
!  a       | new
!  b       | new
!  b       | new
!  b       | new
!  b       | new
!  b       | new
!  b       | new
!  d       | new
!  d       | new
!  d       | new
!  d       | new
!  d       | new
!  d       | new
  (18 rows)

! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
!  relname | aa  | bb
! ---------+-----+----
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
  (12 rows)

! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
!  relname | aa  | cc
! ---------+-----+----
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
!  d       | new |
! (6 rows)
!
! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
!  relname | aa  | bb | cc | dd
! ---------+-----+----+----+----
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
! (6 rows)
!
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
!  relname | aa
! ---------+-----
!  a       | new
!  a       | new
!  a       | new
!  a       | new
!  a       | new
!  a       | new
! (6 rows)
!
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
!  relname | aa  | bb
! ---------+-----+----
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
!  b       | new |
! (6 rows)
!
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
!  relname | aa | cc
! ---------+----+----
  (0 rows)

! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
!  relname | aa  | bb | cc | dd
! ---------+-----+----+----+----
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
!  d       | new |    |    |
  (6 rows)

  DELETE FROM a;
! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
!  relname | aa
! ---------+----
  (0 rows)

! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
!  relname | aa | bb
! ---------+----+----
  (0 rows)

! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
!  relname | aa | cc
! ---------+----+----
  (0 rows)

! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
!  relname | aa | bb | cc | dd
! ---------+----+----+----+----
  (0 rows)

! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
!  relname | aa
! ---------+----
  (0 rows)

! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
!  relname | aa | bb
! ---------+----+----
  (0 rows)

! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
!  relname | aa | cc
! ---------+----+----
  (0 rows)

! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
!  relname | aa | bb | cc | dd
! ---------+----+----+----+----
  (0 rows)

Index: src/test/regress/sql/inherit.sql
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/test/regress/sql/inherit.sql,v
retrieving revision 1.1
diff -c -r1.1 inherit.sql
*** src/test/regress/sql/inherit.sql    2000/06/09 11:12:38    1.1
--- src/test/regress/sql/inherit.sql    2000/07/02 09:30:08
***************
*** 34,47 ****
  INSERT INTO d(aa) VALUES('ddddddd');
  INSERT INTO d(aa) VALUES('dddddddd');

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;

  UPDATE a SET aa='zzzz' WHERE aa='aaaa';
  UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa';
--- 34,47 ----
  INSERT INTO d(aa) VALUES('ddddddd');
  INSERT INTO d(aa) VALUES('dddddddd');

! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;

  UPDATE a SET aa='zzzz' WHERE aa='aaaa';
  UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa';
***************
*** 49,94 ****
  UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
  UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;

  UPDATE b SET aa='new';

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;

  UPDATE a SET aa='new';

  DELETE FROM ONLY c WHERE aa='new';

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;

  DELETE FROM a;

! SELECT * FROM a;
! SELECT * FROM b;
! SELECT * FROM c;
! SELECT * FROM d;
! SELECT * FROM ONLY a;
! SELECT * FROM ONLY b;
! SELECT * FROM ONLY c;
! SELECT * FROM ONLY d;
--- 49,94 ----
  UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
  UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';

! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;

  UPDATE b SET aa='new';

! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;

  UPDATE a SET aa='new';

  DELETE FROM ONLY c WHERE aa='new';

! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;

  DELETE FROM a;

! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
Index: src/tools/make_mkid
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/tools/make_mkid,v
retrieving revision 1.4
diff -c -r1.4 make_mkid
*** src/tools/make_mkid    2000/03/31 01:41:27    1.4
--- src/tools/make_mkid    2000/07/02 09:30:08
***************
*** 1,6 ****
  #!/bin/sh
  find `pwd`/ \( -name _deadcode -a -prune \) -o \
!     -type f -name '*.[chyl]' -print|sed 's;//;/;g' | mkid

  find . -name  'CVS' -prune -o -type d -print  |while read DIR
  do
--- 1,6 ----
  #!/bin/sh
  find `pwd`/ \( -name _deadcode -a -prune \) -o \
!     -type f -name '*.[chyl]' -print|sed 's;//;/;g' | mkid -

  find . -name  'CVS' -prune -o -type d -print  |while read DIR
  do

Re: [PATCHES] TABLEOID patch

From
Bruce Momjian
Date:
Applied.  Thanks.

>
> Attached is a new patch which addresses this problem.
>
> --
> Chris Bitmead
> mailto:chris@bitmead.com

> ? config.log
> ? config.cache
> ? config.status
> ? nohup.out
> ? GNUmakefile
> ? src/GNUmakefile
> ? src/Makefile.global
> ? src/ID
> ? src/nohup.out
> ? src/backend/postgres
> ? src/backend/fmgr.h
> ? src/backend/parse.h
> ? src/backend/global1.bki.source
> ? src/backend/local1_template1.bki.source
> ? src/backend/global1.description
> ? src/backend/local1_template1.description
> ? src/backend/1
> ? src/backend/catalog/genbki.sh
> ? src/backend/catalog/global1.bki.source
> ? src/backend/catalog/global1.description
> ? src/backend/catalog/local1_template1.bki.source
> ? src/backend/catalog/local1_template1.description
> ? src/backend/parser/y.output
> ? src/backend/parser/y.output.gz
> ? src/backend/parser/gram.y.works
> ? src/backend/parser/gram.y.works.try
> ? src/backend/parser/y.output.noerror
> ? src/backend/parser/gram.y.gz
> ? src/backend/port/Makefile
> ? src/backend/utils/fmgr.h
> ? src/backend/utils/fmgrstamp-h
> ? src/bin/initdb/initdb
> ? src/bin/initlocation/initlocation
> ? src/bin/ipcclean/ipcclean
> ? src/bin/pg_ctl/pg_ctl
> ? src/bin/pg_dump/pg_dump
> ? src/bin/pg_id/pg_id
> ? src/bin/pg_passwd/pg_passwd
> ? src/bin/pg_version/pg_version
> ? src/bin/pgtclsh/mkMakefile.tkdefs.sh
> ? src/bin/pgtclsh/mkMakefile.tcldefs.sh
> ? src/bin/psql/psql
> ? src/bin/scripts/createlang
> ? src/include/version.h
> ? src/include/config.h
> ? src/include/parser/parse.h
> ? src/include/utils/fmgroids.h
> ? src/interfaces/ecpg/lib/libecpg.so.3.1.1
> ? src/interfaces/ecpg/preproc/ecpg
> ? src/interfaces/jdbc/postgresql.jar
> ? src/interfaces/jdbc/example/psql.class
> ? src/interfaces/jdbc/postgresql/DriverClass.java
> ? src/interfaces/jdbc/postgresql/DriverClass.class
> ? src/interfaces/jdbc/postgresql/Connection.class
> ? src/interfaces/jdbc/postgresql/Field.class
> ? src/interfaces/jdbc/postgresql/PG_Stream.class
> ? src/interfaces/jdbc/postgresql/Driver.class
> ? src/interfaces/jdbc/postgresql/ResultSet.class
> ? src/interfaces/jdbc/postgresql/fastpath/Fastpath.class
> ? src/interfaces/jdbc/postgresql/fastpath/FastpathArg.class
> ? src/interfaces/jdbc/postgresql/geometric/PGbox.class
> ? src/interfaces/jdbc/postgresql/geometric/PGpoint.class
> ? src/interfaces/jdbc/postgresql/geometric/PGcircle.class
> ? src/interfaces/jdbc/postgresql/geometric/PGline.class
> ? src/interfaces/jdbc/postgresql/geometric/PGlseg.class
> ? src/interfaces/jdbc/postgresql/geometric/PGpath.class
> ? src/interfaces/jdbc/postgresql/geometric/PGpolygon.class
> ? src/interfaces/jdbc/postgresql/jdbc2/ResultSet.class
> ? src/interfaces/jdbc/postgresql/jdbc2/Connection.class
> ? src/interfaces/jdbc/postgresql/jdbc2/ResultSetMetaData.class
> ? src/interfaces/jdbc/postgresql/jdbc2/DatabaseMetaData.class
> ? src/interfaces/jdbc/postgresql/jdbc2/Statement.class
> ? src/interfaces/jdbc/postgresql/jdbc2/PreparedStatement.class
> ? src/interfaces/jdbc/postgresql/jdbc2/CallableStatement.class
> ? src/interfaces/jdbc/postgresql/largeobject/LargeObjectManager.class
> ? src/interfaces/jdbc/postgresql/largeobject/LargeObject.class
> ? src/interfaces/jdbc/postgresql/util/PSQLException.class
> ? src/interfaces/jdbc/postgresql/util/UnixCrypt.class
> ? src/interfaces/jdbc/postgresql/util/Serialize.class
> ? src/interfaces/jdbc/postgresql/util/PGobject.class
> ? src/interfaces/jdbc/postgresql/util/PGtokenizer.class
> ? src/interfaces/jdbc/postgresql/util/PGmoney.class
> ? src/interfaces/libpgeasy/libpgeasy.so.2.1
> ? src/interfaces/libpgtcl/mkMakefile.tcldefs.sh
> ? src/interfaces/libpgtcl/mkMakefile.tkdefs.sh
> ? src/interfaces/libpq/libpq.so.2.1
> ? src/interfaces/libpq++/libpq++.so.3.1
> ? src/interfaces/odbc/Makefile.global
> ? src/pl/plpgsql/src/libplpgsql.so.1.0
> ? src/test/regress/GNUmakefile
> ? src/test/regress/regress.out
> ? src/test/regress/x.x
> ? src/test/regress/nohup.out
> ? src/test/regress/regression.diffs
> ? src/test/regress/expected/copy.out
> ? src/test/regress/expected/misc.out
> ? src/test/regress/expected/create_function_1.out
> ? src/test/regress/expected/create_function_2.out
> ? src/test/regress/expected/constraints.out
> ? src/test/regress/results/boolean.out
> ? src/test/regress/results/char.out
> ? src/test/regress/results/name.out
> ? src/test/regress/results/varchar.out
> ? src/test/regress/results/text.out
> ? src/test/regress/results/int2.out
> ? src/test/regress/results/int4.out
> ? src/test/regress/results/int8.out
> ? src/test/regress/results/oid.out
> ? src/test/regress/results/float4.out
> ? src/test/regress/results/float8.out
> ? src/test/regress/results/numeric.out
> ? src/test/regress/results/strings.out
> ? src/test/regress/results/numerology.out
> ? src/test/regress/results/point.out
> ? src/test/regress/results/lseg.out
> ? src/test/regress/results/box.out
> ? src/test/regress/results/path.out
> ? src/test/regress/results/polygon.out
> ? src/test/regress/results/circle.out
> ? src/test/regress/results/interval.out
> ? src/test/regress/results/timestamp.out
> ? src/test/regress/results/reltime.out
> ? src/test/regress/results/tinterval.out
> ? src/test/regress/results/inet.out
> ? src/test/regress/results/comments.out
> ? src/test/regress/results/oidjoins.out
> ? src/test/regress/results/type_sanity.out
> ? src/test/regress/results/opr_sanity.out
> ? src/test/regress/results/abstime.out
> ? src/test/regress/results/geometry.out
> ? src/test/regress/results/horology.out
> ? src/test/regress/results/create_function_1.out
> ? src/test/regress/results/create_type.out
> ? src/test/regress/results/create_table.out
> ? src/test/regress/results/create_function_2.out
> ? src/test/regress/results/copy.out
> ? src/test/regress/results/onek.data
> ? src/test/regress/results/constraints.out
> ? src/test/regress/results/triggers.out
> ? src/test/regress/results/create_misc.out
> ? src/test/regress/results/create_aggregate.out
> ? src/test/regress/results/create_operator.out
> ? src/test/regress/results/create_index.out
> ? src/test/regress/results/inherit.out
> ? src/test/regress/results/create_view.out
> ? src/test/regress/results/sanity_check.out
> ? src/test/regress/results/errors.out
> ? src/test/regress/results/select.out
> ? src/test/regress/results/select_into.out
> ? src/test/regress/results/select_distinct.out
> ? src/test/regress/results/select_distinct_on.out
> ? src/test/regress/results/select_implicit.out
> ? src/test/regress/results/select_having.out
> ? src/test/regress/results/subselect.out
> ? src/test/regress/results/union.out
> ? src/test/regress/results/case.out
> ? src/test/regress/results/join.out
> ? src/test/regress/results/aggregates.out
> ? src/test/regress/results/transactions.out
> ? src/test/regress/results/random.out
> ? src/test/regress/results/portals.out
> ? src/test/regress/results/arrays.out
> ? src/test/regress/results/btree_index.out
> ? src/test/regress/results/hash_index.out
> ? src/test/regress/results/misc.out
> ? src/test/regress/results/select_views.out
> ? src/test/regress/results/alter_table.out
> ? src/test/regress/results/portals_p2.out
> ? src/test/regress/results/rules.out
> ? src/test/regress/results/foreign_key.out
> ? src/test/regress/results/limit.out
> ? src/test/regress/results/plpgsql.out
> ? src/test/regress/results/temp.out
> ? src/test/regress/results/stud_emp.data
> ? src/test/regress/sql/copy.sql
> ? src/test/regress/sql/misc.sql
> ? src/test/regress/sql/create_function_1.sql
> ? src/test/regress/sql/create_function_2.sql
> ? src/test/regress/sql/constraints.sql
> Index: doc/src/sgml/inherit.sgml
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/doc/src/sgml/inherit.sgml,v
> retrieving revision 1.10
> diff -c -r1.10 inherit.sgml
> *** doc/src/sgml/inherit.sgml    2000/06/22 22:31:15    1.10
> --- doc/src/sgml/inherit.sgml    2000/07/02 09:29:43
> ***************
> *** 96,101 ****
> --- 96,152 ----
>      <command>UPDATE</command> and <command>DELETE</command> --
>      support this <quote>ONLY</quote> notation.
>     </para>
> +
> +   <para>
> +   In some cases you may wish to know which table a particular tuple
> +   originated from. There is a system attribute called
> +   <quote>TABLEOID</quote> in each table which can tell you the
> +   originating table:
> +
> +    <programlisting>
> +     SELECT c.tableoid, c.name, c.altitude
> +     FROM cities c
> +     WHERE c.altitude > 500;
> +    </programlisting>
> +
> +    which returns:
> +
> +    <programlisting>
> + +---------+----------+----------+
> + |tableoid |name      | altitude |
> + +---------+----------+----------+
> + |37292    |Las Vegas | 2174     |
> + +---------+----------+----------+
> + |37280    |Mariposa  | 1953     |
> + +---------+----------+----------+
> + |37280    |Madison   | 845      |
> + +---------+----------+----------+
> +    </programlisting>
> +
> +    If you do a join with pg_class you can see the actual table name:
> +
> +    <programlisting>
> +     SELECT p.relname, c.name, c.altitude
> +     FROM cities c, pg_class p
> +     WHERE c.altitude > 500 and c.tableoid = p.oid;
> +    </programlisting>
> +
> +    which returns:
> +
> +    <programlisting>
> + +---------+----------+----------+
> + |relname  |name      | altitude |
> + +---------+----------+----------+
> + |capitals |Las Vegas | 2174     |
> + +---------+----------+----------+
> + |cities   |Mariposa  | 1953     |
> + +---------+----------+----------+
> + |cities   |Madison   | 845      |
> + +---------+----------+----------+
> +    </programlisting>
> +
> +   </para>
> +
>     <note>
>      <title>Deprecated</title>
>      <para>
> Index: src/backend/access/common/heaptuple.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v
> retrieving revision 1.62
> diff -c -r1.62 heaptuple.c
> *** src/backend/access/common/heaptuple.c    2000/04/12 17:14:36    1.62
> --- src/backend/access/common/heaptuple.c    2000/07/02 09:29:46
> ***************
> *** 9,15 ****
>    *
>    *
>    * IDENTIFICATION
> !  *      $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12
17:14:36momjian Exp $ 
>    *
>    * NOTES
>    *      The old interface functions have been converted to macros
> --- 9,15 ----
>    *
>    *
>    * IDENTIFICATION
> !  *      $Header: /usr/local/cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12 17:14:36 momjian
Exp$ 
>    *
>    * NOTES
>    *      The old interface functions have been converted to macros
> ***************
> *** 169,174 ****
> --- 169,175 ----
>       else
>           switch (attnum)
>           {
> +             case TableOidAttributeNumber:
>               case SelfItemPointerAttributeNumber:
>               case ObjectIdAttributeNumber:
>               case MinTransactionIdAttributeNumber:
> ***************
> *** 205,210 ****
> --- 206,213 ----
>
>       switch (attno)
>       {
> +         case TableOidAttributeNumber:
> +             return sizeof f->t_oid;
>           case SelfItemPointerAttributeNumber:
>               return sizeof f->t_ctid;
>           case ObjectIdAttributeNumber:
> ***************
> *** 237,242 ****
> --- 240,248 ----
>
>       switch (attno)
>       {
> +         case TableOidAttributeNumber:
> +             byval = true;
> +             break;
>           case SelfItemPointerAttributeNumber:
>               byval = false;
>               break;
> ***************
> *** 275,281 ****
>   {
>       switch (attnum)
>       {
> !             case SelfItemPointerAttributeNumber:
>               return (Datum) &tup->t_ctid;
>           case ObjectIdAttributeNumber:
>               return (Datum) (long) tup->t_oid;
> --- 281,289 ----
>   {
>       switch (attnum)
>       {
> !         case TableOidAttributeNumber:
> !             return (Datum) &tup->t_tableoid;
> !         case SelfItemPointerAttributeNumber:
>               return (Datum) &tup->t_ctid;
>           case ObjectIdAttributeNumber:
>               return (Datum) (long) tup->t_oid;
> Index: src/backend/access/heap/heapam.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/heap/heapam.c,v
> retrieving revision 1.73
> diff -c -r1.73 heapam.c
> *** src/backend/access/heap/heapam.c    2000/06/30 16:10:40    1.73
> --- src/backend/access/heap/heapam.c    2000/07/02 09:29:49
> ***************
> *** 235,240 ****
> --- 235,242 ----
>       int            linesleft;
>       ItemPointer tid = (tuple->t_data == NULL) ?
>       (ItemPointer) NULL : &(tuple->t_self);
> +
> +     tuple->tableOid = relation->rd_id;
>
>       /* ----------------
>        *    increment access statistics
> ***************
> *** 621,626 ****
> --- 623,629 ----
>
>       Assert(lockmode >= NoLock && lockmode < MAX_LOCKMODES);
>
> +
>       /* ----------------
>        *    increment access statistics
>        * ----------------
> ***************
> *** 1084,1089 ****
> --- 1087,1093 ----
>       ItemPointer tid = &(tuple->t_self);
>       OffsetNumber offnum;
>
> +     tuple->tableOid = relation->rd_id;
>       /* ----------------
>        *    increment access statistics
>        * ----------------
> ***************
> *** 1178,1183 ****
> --- 1182,1188 ----
>       bool        invalidBlock,
>                   linkend;
>
> +     tp.tableOid = relation->rd_id;
>       /* ----------------
>        *    get the buffer from the relation descriptor
>        *    Note that this does a buffer pin.
> ***************
> *** 1270,1275 ****
> --- 1275,1281 ----
>        *    increment access statistics
>        * ----------------
>        */
> +     tup->tableOid = relation->rd_id;
>       IncrHeapAccessStat(local_insert);
>       IncrHeapAccessStat(global_insert);
>
> ***************
> *** 1335,1340 ****
> --- 1341,1347 ----
>       Buffer        buffer;
>       int            result;
>
> +     tp.tableOid = relation->rd_id;
>       /* increment access statistics */
>       IncrHeapAccessStat(local_delete);
>       IncrHeapAccessStat(global_delete);
> ***************
> *** 1447,1452 ****
> --- 1454,1460 ----
>       Buffer        buffer;
>       int            result;
>
> +     newtup->tableOid = relation->rd_id;
>       /* increment access statistics */
>       IncrHeapAccessStat(local_replace);
>       IncrHeapAccessStat(global_replace);
> ***************
> *** 1575,1580 ****
> --- 1583,1589 ----
>       PageHeader    dp;
>       int            result;
>
> +     tuple->tableOid = relation->rd_id;
>       /* increment access statistics */
>       IncrHeapAccessStat(local_mark4update);
>       IncrHeapAccessStat(global_mark4update);
> Index: src/backend/catalog/heap.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/catalog/heap.c,v
> retrieving revision 1.135
> diff -c -r1.135 heap.c
> *** src/backend/catalog/heap.c    2000/07/02 04:46:09    1.135
> --- src/backend/catalog/heap.c    2000/07/02 09:29:55
> ***************
> *** 131,142 ****
>       MaxCommandIdAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
>   };
>
> ! static Form_pg_attribute HeapAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6};
>
>   /* ----------------------------------------------------------------
>    *                XXX END OF UGLY HARD CODED BADNESS XXX
> !  * ----------------------------------------------------------------
> !  */
>
>
>   /* ----------------------------------------------------------------
> --- 131,152 ----
>       MaxCommandIdAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
>   };
>
> ! /*
> !    We decide to call this attribute "tableoid" rather than say
> ! "classoid" on the basis that in the future there may be more than one
> ! table of a particular class/type. In any case table is still the word
> ! used in SQL.
> ! */
> ! static FormData_pg_attribute a7 = {
> !     0xffffffff, {"tableoid"}, OIDOID, 0, sizeof(Oid),
> !     TableOidAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
> ! };
>
> + static Form_pg_attribute HeapAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6, &a7};
> +
>   /* ----------------------------------------------------------------
>    *                XXX END OF UGLY HARD CODED BADNESS XXX
> !  * ---------------------------------------------------------------- */
>
>
>   /* ----------------------------------------------------------------
> Index: src/backend/parser/parse_relation.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/parse_relation.c,v
> retrieving revision 1.44
> diff -c -r1.44 parse_relation.c
> *** src/backend/parser/parse_relation.c    2000/06/20 01:41:21    1.44
> --- src/backend/parser/parse_relation.c    2000/07/02 09:29:56
> ***************
> *** 57,62 ****
> --- 57,65 ----
>       {
>           "cmax", MaxCommandIdAttributeNumber, CIDOID
>       },
> +     {
> +         "tableoid", TableOidAttributeNumber, OIDOID
> +     }
>   };
>
>   #define SPECIALS ((int) (sizeof(special_attr)/sizeof(special_attr[0])))
> Index: src/backend/utils/cache/lsyscache.c
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v
> retrieving revision 1.42
> diff -c -r1.42 lsyscache.c
> *** src/backend/utils/cache/lsyscache.c    2000/06/08 22:37:30    1.42
> --- src/backend/utils/cache/lsyscache.c    2000/07/02 09:29:58
> ***************
> *** 249,254 ****
> --- 249,256 ----
>       if (attnum == ObjectIdAttributeNumber ||
>           attnum == SelfItemPointerAttributeNumber)
>           return 1.0 / (double) ntuples;
> +     if (attnum == TableOidAttributeNumber)
> +         return 1.0;
>
>       /*
>        * VACUUM ANALYZE has not been run for this table. Produce an estimate
> Index: src/include/access/heapam.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/access/heapam.h,v
> retrieving revision 1.54
> diff -c -r1.54 heapam.h
> *** src/include/access/heapam.h    2000/06/30 16:10:49    1.54
> --- src/include/access/heapam.h    2000/07/02 09:30:00
> ***************
> *** 165,200 ****
>    *
>    * ----------------
>    */
> ! #define heap_getattr(tup, attnum, tupleDesc, isnull)                        \
> ! (                                                                            \
> !     AssertMacro((tup) != NULL &&                                            \
> !         (attnum) > FirstLowInvalidHeapAttributeNumber &&                    \
> !         (attnum) != 0),                                                        \
> !     ((attnum) > (int) (tup)->t_data->t_natts) ?                                \
> !     (                                                                        \
> !         ((isnull) ? (*(isnull) = true) : (dummyret)NULL),                    \
> !         (Datum)NULL                                                            \
> !     )                                                                        \
> !     :                                                                        \
> !     (                                                                        \
> !         ((attnum) > 0) ?                                                    \
> !         (                                                                    \
> !             fastgetattr((tup), (attnum), (tupleDesc), (isnull))                \
> !         )                                                                    \
> !         :                                                                    \
> !         (                                                                    \
> !             ((isnull) ? (*(isnull) = false) : (dummyret)NULL),                \
> !             ((attnum) == SelfItemPointerAttributeNumber) ?                    \
> !             (                                                                \
> !                 (Datum)((char *)&((tup)->t_self))                            \
> !             )                                                                \
> !             :                                                                \
> !             (                                                                \
> !                 (Datum)*(unsigned int *)                                    \
> !                     ((char *)(tup)->t_data + heap_sysoffset[-(attnum)-1])    \
> !             )                                                                \
> !         )                                                                    \
> !     )                                                                        \
>   )
>
>   extern HeapAccessStatistics heap_access_stats;    /* in stats.c */
> --- 165,205 ----
>    *
>    * ----------------
>    */
> ! #define heap_getattr(tup, attnum, tupleDesc, isnull) \
> ! ( \
> !     AssertMacro((tup) != NULL && \
> !         (attnum) > FirstLowInvalidHeapAttributeNumber && \
> !         (attnum) != 0), \
> !     ((attnum) > (int) (tup)->t_data->t_natts) ? \
> !     ( \
> !         ((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
> !         (Datum)NULL \
> !     ) \
> !     : \
> !     ( \
> !         ((attnum) > 0) ? \
> !         ( \
> !             fastgetattr((tup), (attnum), (tupleDesc), (isnull)) \
> !         ) \
> !         : \
> !         ( \
> !             ((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
> !             ((attnum) == SelfItemPointerAttributeNumber) ? \
> !             ( \
> !                 (Datum)((char *)&((tup)->t_self)) \
> !             ) \
> !             : \
> !             (((attnum) == TableOidAttributeNumber) ? \
> !             ( \
> !                 (Datum)((tup)->tableOid) \
> !             ) \
> !             : \
> !             ( \
> !                 (Datum)*(unsigned int *) \
> !                     ((char *)(tup)->t_data + heap_sysoffset[-(attnum)-1]) \
> !             )) \
> !         ) \
> !     ) \
>   )
>
>   extern HeapAccessStatistics heap_access_stats;    /* in stats.c */
> Index: src/include/access/htup.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/access/htup.h,v
> retrieving revision 1.30
> diff -c -r1.30 htup.h
> *** src/include/access/htup.h    2000/06/02 10:20:26    1.30
> --- src/include/access/htup.h    2000/07/02 09:30:01
> ***************
> *** 133,139 ****
>   #define MinCommandIdAttributeNumber                (-4)
>   #define MaxTransactionIdAttributeNumber            (-5)
>   #define MaxCommandIdAttributeNumber                (-6)
> ! #define FirstLowInvalidHeapAttributeNumber        (-7)
>
>   /* If you make any changes above, the order off offsets in this must change */
>   extern long heap_sysoffset[];
> --- 133,140 ----
>   #define MinCommandIdAttributeNumber                (-4)
>   #define MaxTransactionIdAttributeNumber            (-5)
>   #define MaxCommandIdAttributeNumber                (-6)
> ! #define TableOidAttributeNumber                    (-7)
> ! #define FirstLowInvalidHeapAttributeNumber        (-8)
>
>   /* If you make any changes above, the order off offsets in this must change */
>   extern long heap_sysoffset[];
> ***************
> *** 156,161 ****
> --- 157,163 ----
>   {
>       uint32        t_len;            /* length of *t_data */
>       ItemPointerData t_self;        /* SelfItemPointer */
> +     Oid tableOid;                    /* */
>       MemoryContext t_datamcxt;    /* */
>       HeapTupleHeader t_data;        /* */
>   } HeapTupleData;
> Index: src/include/catalog/pg_attribute.h
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/pg_attribute.h,v
> retrieving revision 1.59
> diff -c -r1.59 pg_attribute.h
> *** src/include/catalog/pg_attribute.h    2000/06/12 03:40:52    1.59
> --- src/include/catalog/pg_attribute.h    2000/07/02 09:30:03
> ***************
> *** 267,272 ****
> --- 267,273 ----
>   DATA(insert OID = 0 ( 1247 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1247 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1247 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1247 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_database
> ***************
> *** 282,287 ****
> --- 283,289 ----
>   DATA(insert OID = 0 ( 1262 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1262 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1262 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1262 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_proc
> ***************
> *** 329,334 ****
> --- 331,337 ----
>   DATA(insert OID = 0 ( 1255 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1255 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1255 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1255 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_shadow
> ***************
> *** 348,353 ****
> --- 351,357 ----
>   DATA(insert OID = 0 ( 1260 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1260 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1260 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1260 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_group
> ***************
> *** 362,367 ****
> --- 366,372 ----
>   DATA(insert OID = 0 ( 1261 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1261 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1261 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1261 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_attribute
> ***************
> *** 405,410 ****
> --- 410,416 ----
>   DATA(insert OID = 0 ( 1249 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1249 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1249 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1249 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_class
> ***************
> *** 458,463 ****
> --- 464,470 ----
>   DATA(insert OID = 0 ( 1259 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1259 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1259 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1259 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_attrdef
> ***************
> *** 473,478 ****
> --- 480,486 ----
>   DATA(insert OID = 0 ( 1215 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1215 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1215 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1215 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_relcheck
> ***************
> *** 488,493 ****
> --- 496,502 ----
>   DATA(insert OID = 0 ( 1216 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1216 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1216 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1216 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_trigger
> ***************
> *** 513,518 ****
> --- 522,528 ----
>   DATA(insert OID = 0 ( 1219 cmin                29 0  4  -4 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1219 xmax                28 0  4  -5 0 -1 -1 t p f i f f));
>   DATA(insert OID = 0 ( 1219 cmax                29 0  4  -6 0 -1 -1 t p f i f f));
> + DATA(insert OID = 0 ( 1219 tableoid            26 0  4  -7 0 -1 -1 t p f i f f));
>
>   /* ----------------
>    *        pg_variable - this relation is modified by special purpose access
> Index: src/test/regress/expected/inherit.out
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/test/regress/expected/inherit.out,v
> retrieving revision 1.1
> diff -c -r1.1 inherit.out
> *** src/test/regress/expected/inherit.out    2000/06/09 11:12:37    1.1
> --- src/test/regress/expected/inherit.out    2000/07/02 09:30:08
> ***************
> *** 29,150 ****
>   INSERT INTO d(aa) VALUES('dddddd');
>   INSERT INTO d(aa) VALUES('ddddddd');
>   INSERT INTO d(aa) VALUES('dddddddd');
> ! SELECT * FROM a;
> !     aa
> ! ----------
> !  aaa
> !  aaaa
> !  aaaaa
> !  aaaaaa
> !  aaaaaaa
> !  aaaaaaaa
> !  bbb
> !  bbbb
> !  bbbbb
> !  bbbbbb
> !  bbbbbbb
> !  bbbbbbbb
> !  ccc
> !  cccc
> !  ccccc
> !  cccccc
> !  ccccccc
> !  cccccccc
> !  ddd
> !  dddd
> !  ddddd
> !  dddddd
> !  ddddddd
> !  dddddddd
>   (24 rows)
>
> ! SELECT * FROM b;
> !     aa    | bb
> ! ----------+----
> !  bbb      |
> !  bbbb     |
> !  bbbbb    |
> !  bbbbbb   |
> !  bbbbbbb  |
> !  bbbbbbbb |
> !  ddd      |
> !  dddd     |
> !  ddddd    |
> !  dddddd   |
> !  ddddddd  |
> !  dddddddd |
>   (12 rows)
>
> ! SELECT * FROM c;
> !     aa    | cc
> ! ----------+----
> !  ccc      |
> !  cccc     |
> !  ccccc    |
> !  cccccc   |
> !  ccccccc  |
> !  cccccccc |
> !  ddd      |
> !  dddd     |
> !  ddddd    |
> !  dddddd   |
> !  ddddddd  |
> !  dddddddd |
>   (12 rows)
>
> ! SELECT * FROM d;
> !     aa    | bb | cc | dd
> ! ----------+----+----+----
> !  ddd      |    |    |
> !  dddd     |    |    |
> !  ddddd    |    |    |
> !  dddddd   |    |    |
> !  ddddddd  |    |    |
> !  dddddddd |    |    |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY a;
> !     aa
> ! ----------
> !  aaa
> !  aaaa
> !  aaaaa
> !  aaaaaa
> !  aaaaaaa
> !  aaaaaaaa
> ! (6 rows)
> !
> ! SELECT * FROM ONLY b;
> !     aa    | bb
> ! ----------+----
> !  bbb      |
> !  bbbb     |
> !  bbbbb    |
> !  bbbbbb   |
> !  bbbbbbb  |
> !  bbbbbbbb |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY c;
> !     aa    | cc
> ! ----------+----
> !  ccc      |
> !  cccc     |
> !  ccccc    |
> !  cccccc   |
> !  ccccccc  |
> !  cccccccc |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY d;
> !     aa    | bb | cc | dd
> ! ----------+----+----+----
> !  ddd      |    |    |
> !  dddd     |    |    |
> !  ddddd    |    |    |
> !  dddddd   |    |    |
> !  ddddddd  |    |    |
> !  dddddddd |    |    |
>   (6 rows)
>
>   UPDATE a SET aa='zzzz' WHERE aa='aaaa';
> --- 29,150 ----
>   INSERT INTO d(aa) VALUES('dddddd');
>   INSERT INTO d(aa) VALUES('ddddddd');
>   INSERT INTO d(aa) VALUES('dddddddd');
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> !  relname |    aa
> ! ---------+----------
> !  a       | aaa
> !  a       | aaaa
> !  a       | aaaaa
> !  a       | aaaaaa
> !  a       | aaaaaaa
> !  a       | aaaaaaaa
> !  b       | bbb
> !  b       | bbbb
> !  b       | bbbbb
> !  b       | bbbbbb
> !  b       | bbbbbbb
> !  b       | bbbbbbbb
> !  c       | ccc
> !  c       | cccc
> !  c       | ccccc
> !  c       | cccccc
> !  c       | ccccccc
> !  c       | cccccccc
> !  d       | ddd
> !  d       | dddd
> !  d       | ddddd
> !  d       | dddddd
> !  d       | ddddddd
> !  d       | dddddddd
>   (24 rows)
>
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> !  relname |    aa    | bb
> ! ---------+----------+----
> !  b       | bbb      |
> !  b       | bbbb     |
> !  b       | bbbbb    |
> !  b       | bbbbbb   |
> !  b       | bbbbbbb  |
> !  b       | bbbbbbbb |
> !  d       | ddd      |
> !  d       | dddd     |
> !  d       | ddddd    |
> !  d       | dddddd   |
> !  d       | ddddddd  |
> !  d       | dddddddd |
>   (12 rows)
>
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> !  relname |    aa    | cc
> ! ---------+----------+----
> !  c       | ccc      |
> !  c       | cccc     |
> !  c       | ccccc    |
> !  c       | cccccc   |
> !  c       | ccccccc  |
> !  c       | cccccccc |
> !  d       | ddd      |
> !  d       | dddd     |
> !  d       | ddddd    |
> !  d       | dddddd   |
> !  d       | ddddddd  |
> !  d       | dddddddd |
>   (12 rows)
>
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> !  relname |    aa    | bb | cc | dd
> ! ---------+----------+----+----+----
> !  d       | ddd      |    |    |
> !  d       | dddd     |    |    |
> !  d       | ddddd    |    |    |
> !  d       | dddddd   |    |    |
> !  d       | ddddddd  |    |    |
> !  d       | dddddddd |    |    |
> ! (6 rows)
> !
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> !  relname |    aa
> ! ---------+----------
> !  a       | aaa
> !  a       | aaaa
> !  a       | aaaaa
> !  a       | aaaaaa
> !  a       | aaaaaaa
> !  a       | aaaaaaaa
> ! (6 rows)
> !
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> !  relname |    aa    | bb
> ! ---------+----------+----
> !  b       | bbb      |
> !  b       | bbbb     |
> !  b       | bbbbb    |
> !  b       | bbbbbb   |
> !  b       | bbbbbbb  |
> !  b       | bbbbbbbb |
> ! (6 rows)
> !
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> !  relname |    aa    | cc
> ! ---------+----------+----
> !  c       | ccc      |
> !  c       | cccc     |
> !  c       | ccccc    |
> !  c       | cccccc   |
> !  c       | ccccccc  |
> !  c       | cccccccc |
> ! (6 rows)
> !
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
> !  relname |    aa    | bb | cc | dd
> ! ---------+----------+----+----+----
> !  d       | ddd      |    |    |
> !  d       | dddd     |    |    |
> !  d       | ddddd    |    |    |
> !  d       | dddddd   |    |    |
> !  d       | ddddddd  |    |    |
> !  d       | dddddddd |    |    |
>   (6 rows)
>
>   UPDATE a SET aa='zzzz' WHERE aa='aaaa';
> ***************
> *** 152,534 ****
>   UPDATE b SET aa='zzz' WHERE aa='aaa';
>   UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
>   UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';
> ! SELECT * FROM a;
> !     aa
> ! ----------
> !  zzzz
> !  zzzzz
> !  zzzzzz
> !  zzzzzz
> !  zzzzzz
> !  zzzzzz
> !  bbb
> !  bbbb
> !  bbbbb
> !  bbbbbb
> !  bbbbbbb
> !  bbbbbbbb
> !  ccc
> !  cccc
> !  ccccc
> !  cccccc
> !  ccccccc
> !  cccccccc
> !  ddd
> !  dddd
> !  ddddd
> !  dddddd
> !  ddddddd
> !  dddddddd
>   (24 rows)
>
> ! SELECT * FROM b;
> !     aa    | bb
> ! ----------+----
> !  bbb      |
> !  bbbb     |
> !  bbbbb    |
> !  bbbbbb   |
> !  bbbbbbb  |
> !  bbbbbbbb |
> !  ddd      |
> !  dddd     |
> !  ddddd    |
> !  dddddd   |
> !  ddddddd  |
> !  dddddddd |
>   (12 rows)
>
> ! SELECT * FROM c;
> !     aa    | cc
> ! ----------+----
> !  ccc      |
> !  cccc     |
> !  ccccc    |
> !  cccccc   |
> !  ccccccc  |
> !  cccccccc |
> !  ddd      |
> !  dddd     |
> !  ddddd    |
> !  dddddd   |
> !  ddddddd  |
> !  dddddddd |
>   (12 rows)
>
> ! SELECT * FROM d;
> !     aa    | bb | cc | dd
> ! ----------+----+----+----
> !  ddd      |    |    |
> !  dddd     |    |    |
> !  ddddd    |    |    |
> !  dddddd   |    |    |
> !  ddddddd  |    |    |
> !  dddddddd |    |    |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY a;
> !    aa
> ! --------
> !  zzzz
> !  zzzzz
> !  zzzzzz
> !  zzzzzz
> !  zzzzzz
> !  zzzzzz
> ! (6 rows)
> !
> ! SELECT * FROM ONLY b;
> !     aa    | bb
> ! ----------+----
> !  bbb      |
> !  bbbb     |
> !  bbbbb    |
> !  bbbbbb   |
> !  bbbbbbb  |
> !  bbbbbbbb |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY c;
> !     aa    | cc
> ! ----------+----
> !  ccc      |
> !  cccc     |
> !  ccccc    |
> !  cccccc   |
> !  ccccccc  |
> !  cccccccc |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY d;
> !     aa    | bb | cc | dd
> ! ----------+----+----+----
> !  ddd      |    |    |
> !  dddd     |    |    |
> !  ddddd    |    |    |
> !  dddddd   |    |    |
> !  ddddddd  |    |    |
> !  dddddddd |    |    |
>   (6 rows)
>
>   UPDATE b SET aa='new';
> ! SELECT * FROM a;
> !     aa
> ! ----------
> !  zzzz
> !  zzzzz
> !  zzzzzz
> !  zzzzzz
> !  zzzzzz
> !  zzzzzz
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  ccc
> !  cccc
> !  ccccc
> !  cccccc
> !  ccccccc
> !  cccccccc
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
>   (24 rows)
>
> ! SELECT * FROM b;
> !  aa  | bb
> ! -----+----
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
>   (12 rows)
>
> ! SELECT * FROM c;
> !     aa    | cc
> ! ----------+----
> !  ccc      |
> !  cccc     |
> !  ccccc    |
> !  cccccc   |
> !  ccccccc  |
> !  cccccccc |
> !  new      |
> !  new      |
> !  new      |
> !  new      |
> !  new      |
> !  new      |
>   (12 rows)
>
> ! SELECT * FROM d;
> !  aa  | bb | cc | dd
> ! -----+----+----+----
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY a;
> !    aa
> ! --------
> !  zzzz
> !  zzzzz
> !  zzzzzz
> !  zzzzzz
> !  zzzzzz
> !  zzzzzz
> ! (6 rows)
> !
> ! SELECT * FROM ONLY b;
> !  aa  | bb
> ! -----+----
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY c;
> !     aa    | cc
> ! ----------+----
> !  ccc      |
> !  cccc     |
> !  ccccc    |
> !  cccccc   |
> !  ccccccc  |
> !  cccccccc |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY d;
> !  aa  | bb | cc | dd
> ! -----+----+----+----
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
>   (6 rows)
>
>   UPDATE a SET aa='new';
>   DELETE FROM ONLY c WHERE aa='new';
> ! SELECT * FROM a;
> !  aa
> ! -----
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
>   (18 rows)
>
> ! SELECT * FROM b;
> !  aa  | bb
> ! -----+----
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
>   (12 rows)
>
> ! SELECT * FROM c;
> !  aa  | cc
> ! -----+----
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> ! (6 rows)
> !
> ! SELECT * FROM d;
> !  aa  | bb | cc | dd
> ! -----+----+----+----
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY a;
> !  aa
> ! -----
> !  new
> !  new
> !  new
> !  new
> !  new
> !  new
> ! (6 rows)
> !
> ! SELECT * FROM ONLY b;
> !  aa  | bb
> ! -----+----
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> !  new |
> ! (6 rows)
> !
> ! SELECT * FROM ONLY c;
> !  aa | cc
> ! ----+----
>   (0 rows)
>
> ! SELECT * FROM ONLY d;
> !  aa  | bb | cc | dd
> ! -----+----+----+----
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
> !  new |    |    |
>   (6 rows)
>
>   DELETE FROM a;
> ! SELECT * FROM a;
> !  aa
> ! ----
>   (0 rows)
>
> ! SELECT * FROM b;
> !  aa | bb
> ! ----+----
>   (0 rows)
>
> ! SELECT * FROM c;
> !  aa | cc
> ! ----+----
>   (0 rows)
>
> ! SELECT * FROM d;
> !  aa | bb | cc | dd
> ! ----+----+----+----
>   (0 rows)
>
> ! SELECT * FROM ONLY a;
> !  aa
> ! ----
>   (0 rows)
>
> ! SELECT * FROM ONLY b;
> !  aa | bb
> ! ----+----
>   (0 rows)
>
> ! SELECT * FROM ONLY c;
> !  aa | cc
> ! ----+----
>   (0 rows)
>
> ! SELECT * FROM ONLY d;
> !  aa | bb | cc | dd
> ! ----+----+----+----
>   (0 rows)
>
> --- 152,534 ----
>   UPDATE b SET aa='zzz' WHERE aa='aaa';
>   UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
>   UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> !  relname |    aa
> ! ---------+----------
> !  a       | zzzz
> !  a       | zzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  b       | bbb
> !  b       | bbbb
> !  b       | bbbbb
> !  b       | bbbbbb
> !  b       | bbbbbbb
> !  b       | bbbbbbbb
> !  c       | ccc
> !  c       | cccc
> !  c       | ccccc
> !  c       | cccccc
> !  c       | ccccccc
> !  c       | cccccccc
> !  d       | ddd
> !  d       | dddd
> !  d       | ddddd
> !  d       | dddddd
> !  d       | ddddddd
> !  d       | dddddddd
>   (24 rows)
>
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> !  relname |    aa    | bb
> ! ---------+----------+----
> !  b       | bbb      |
> !  b       | bbbb     |
> !  b       | bbbbb    |
> !  b       | bbbbbb   |
> !  b       | bbbbbbb  |
> !  b       | bbbbbbbb |
> !  d       | ddd      |
> !  d       | dddd     |
> !  d       | ddddd    |
> !  d       | dddddd   |
> !  d       | ddddddd  |
> !  d       | dddddddd |
>   (12 rows)
>
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> !  relname |    aa    | cc
> ! ---------+----------+----
> !  c       | ccc      |
> !  c       | cccc     |
> !  c       | ccccc    |
> !  c       | cccccc   |
> !  c       | ccccccc  |
> !  c       | cccccccc |
> !  d       | ddd      |
> !  d       | dddd     |
> !  d       | ddddd    |
> !  d       | dddddd   |
> !  d       | ddddddd  |
> !  d       | dddddddd |
>   (12 rows)
>
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> !  relname |    aa    | bb | cc | dd
> ! ---------+----------+----+----+----
> !  d       | ddd      |    |    |
> !  d       | dddd     |    |    |
> !  d       | ddddd    |    |    |
> !  d       | dddddd   |    |    |
> !  d       | ddddddd  |    |    |
> !  d       | dddddddd |    |    |
> ! (6 rows)
> !
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> !  relname |   aa
> ! ---------+--------
> !  a       | zzzz
> !  a       | zzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> ! (6 rows)
> !
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> !  relname |    aa    | bb
> ! ---------+----------+----
> !  b       | bbb      |
> !  b       | bbbb     |
> !  b       | bbbbb    |
> !  b       | bbbbbb   |
> !  b       | bbbbbbb  |
> !  b       | bbbbbbbb |
> ! (6 rows)
> !
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> !  relname |    aa    | cc
> ! ---------+----------+----
> !  c       | ccc      |
> !  c       | cccc     |
> !  c       | ccccc    |
> !  c       | cccccc   |
> !  c       | ccccccc  |
> !  c       | cccccccc |
> ! (6 rows)
> !
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
> !  relname |    aa    | bb | cc | dd
> ! ---------+----------+----+----+----
> !  d       | ddd      |    |    |
> !  d       | dddd     |    |    |
> !  d       | ddddd    |    |    |
> !  d       | dddddd   |    |    |
> !  d       | ddddddd  |    |    |
> !  d       | dddddddd |    |    |
>   (6 rows)
>
>   UPDATE b SET aa='new';
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> !  relname |    aa
> ! ---------+----------
> !  a       | zzzz
> !  a       | zzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  b       | new
> !  b       | new
> !  b       | new
> !  b       | new
> !  b       | new
> !  b       | new
> !  c       | ccc
> !  c       | cccc
> !  c       | ccccc
> !  c       | cccccc
> !  c       | ccccccc
> !  c       | cccccccc
> !  d       | new
> !  d       | new
> !  d       | new
> !  d       | new
> !  d       | new
> !  d       | new
>   (24 rows)
>
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> !  relname | aa  | bb
> ! ---------+-----+----
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
>   (12 rows)
>
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> !  relname |    aa    | cc
> ! ---------+----------+----
> !  c       | ccc      |
> !  c       | cccc     |
> !  c       | ccccc    |
> !  c       | cccccc   |
> !  c       | ccccccc  |
> !  c       | cccccccc |
> !  d       | new      |
> !  d       | new      |
> !  d       | new      |
> !  d       | new      |
> !  d       | new      |
> !  d       | new      |
>   (12 rows)
>
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> !  relname | aa  | bb | cc | dd
> ! ---------+-----+----+----+----
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> ! (6 rows)
> !
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> !  relname |   aa
> ! ---------+--------
> !  a       | zzzz
> !  a       | zzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> !  a       | zzzzzz
> ! (6 rows)
> !
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> !  relname | aa  | bb
> ! ---------+-----+----
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> ! (6 rows)
> !
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> !  relname |    aa    | cc
> ! ---------+----------+----
> !  c       | ccc      |
> !  c       | cccc     |
> !  c       | ccccc    |
> !  c       | cccccc   |
> !  c       | ccccccc  |
> !  c       | cccccccc |
> ! (6 rows)
> !
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
> !  relname | aa  | bb | cc | dd
> ! ---------+-----+----+----+----
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
>   (6 rows)
>
>   UPDATE a SET aa='new';
>   DELETE FROM ONLY c WHERE aa='new';
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> !  relname | aa
> ! ---------+-----
> !  a       | new
> !  a       | new
> !  a       | new
> !  a       | new
> !  a       | new
> !  a       | new
> !  b       | new
> !  b       | new
> !  b       | new
> !  b       | new
> !  b       | new
> !  b       | new
> !  d       | new
> !  d       | new
> !  d       | new
> !  d       | new
> !  d       | new
> !  d       | new
>   (18 rows)
>
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> !  relname | aa  | bb
> ! ---------+-----+----
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
>   (12 rows)
>
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> !  relname | aa  | cc
> ! ---------+-----+----
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> !  d       | new |
> ! (6 rows)
> !
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> !  relname | aa  | bb | cc | dd
> ! ---------+-----+----+----+----
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> ! (6 rows)
> !
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> !  relname | aa
> ! ---------+-----
> !  a       | new
> !  a       | new
> !  a       | new
> !  a       | new
> !  a       | new
> !  a       | new
> ! (6 rows)
> !
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> !  relname | aa  | bb
> ! ---------+-----+----
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> !  b       | new |
> ! (6 rows)
> !
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> !  relname | aa | cc
> ! ---------+----+----
>   (0 rows)
>
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
> !  relname | aa  | bb | cc | dd
> ! ---------+-----+----+----+----
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
> !  d       | new |    |    |
>   (6 rows)
>
>   DELETE FROM a;
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> !  relname | aa
> ! ---------+----
>   (0 rows)
>
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> !  relname | aa | bb
> ! ---------+----+----
>   (0 rows)
>
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> !  relname | aa | cc
> ! ---------+----+----
>   (0 rows)
>
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> !  relname | aa | bb | cc | dd
> ! ---------+----+----+----+----
>   (0 rows)
>
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> !  relname | aa
> ! ---------+----
>   (0 rows)
>
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> !  relname | aa | bb
> ! ---------+----+----
>   (0 rows)
>
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> !  relname | aa | cc
> ! ---------+----+----
>   (0 rows)
>
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
> !  relname | aa | bb | cc | dd
> ! ---------+----+----+----+----
>   (0 rows)
>
> Index: src/test/regress/sql/inherit.sql
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/test/regress/sql/inherit.sql,v
> retrieving revision 1.1
> diff -c -r1.1 inherit.sql
> *** src/test/regress/sql/inherit.sql    2000/06/09 11:12:38    1.1
> --- src/test/regress/sql/inherit.sql    2000/07/02 09:30:08
> ***************
> *** 34,47 ****
>   INSERT INTO d(aa) VALUES('ddddddd');
>   INSERT INTO d(aa) VALUES('dddddddd');
>
> ! SELECT * FROM a;
> ! SELECT * FROM b;
> ! SELECT * FROM c;
> ! SELECT * FROM d;
> ! SELECT * FROM ONLY a;
> ! SELECT * FROM ONLY b;
> ! SELECT * FROM ONLY c;
> ! SELECT * FROM ONLY d;
>
>   UPDATE a SET aa='zzzz' WHERE aa='aaaa';
>   UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa';
> --- 34,47 ----
>   INSERT INTO d(aa) VALUES('ddddddd');
>   INSERT INTO d(aa) VALUES('dddddddd');
>
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
>
>   UPDATE a SET aa='zzzz' WHERE aa='aaaa';
>   UPDATE ONLY a SET aa='zzzzz' WHERE aa='aaaaa';
> ***************
> *** 49,94 ****
>   UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
>   UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';
>
> ! SELECT * FROM a;
> ! SELECT * FROM b;
> ! SELECT * FROM c;
> ! SELECT * FROM d;
> ! SELECT * FROM ONLY a;
> ! SELECT * FROM ONLY b;
> ! SELECT * FROM ONLY c;
> ! SELECT * FROM ONLY d;
>
>   UPDATE b SET aa='new';
>
> ! SELECT * FROM a;
> ! SELECT * FROM b;
> ! SELECT * FROM c;
> ! SELECT * FROM d;
> ! SELECT * FROM ONLY a;
> ! SELECT * FROM ONLY b;
> ! SELECT * FROM ONLY c;
> ! SELECT * FROM ONLY d;
>
>   UPDATE a SET aa='new';
>
>   DELETE FROM ONLY c WHERE aa='new';
>
> ! SELECT * FROM a;
> ! SELECT * FROM b;
> ! SELECT * FROM c;
> ! SELECT * FROM d;
> ! SELECT * FROM ONLY a;
> ! SELECT * FROM ONLY b;
> ! SELECT * FROM ONLY c;
> ! SELECT * FROM ONLY d;
>
>   DELETE FROM a;
>
> ! SELECT * FROM a;
> ! SELECT * FROM b;
> ! SELECT * FROM c;
> ! SELECT * FROM d;
> ! SELECT * FROM ONLY a;
> ! SELECT * FROM ONLY b;
> ! SELECT * FROM ONLY c;
> ! SELECT * FROM ONLY d;
> --- 49,94 ----
>   UPDATE ONLY b SET aa='zzz' WHERE aa='aaa';
>   UPDATE a SET aa='zzzzzz' WHERE aa LIKE 'aaa%';
>
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
>
>   UPDATE b SET aa='new';
>
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
>
>   UPDATE a SET aa='new';
>
>   DELETE FROM ONLY c WHERE aa='new';
>
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
>
>   DELETE FROM a;
>
> ! SELECT relname, a.* FROM a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM d, pg_class where d.tableoid = pg_class.oid;
> ! SELECT relname, a.* FROM ONLY a, pg_class where a.tableoid = pg_class.oid;
> ! SELECT relname, b.* FROM ONLY b, pg_class where b.tableoid = pg_class.oid;
> ! SELECT relname, c.* FROM ONLY c, pg_class where c.tableoid = pg_class.oid;
> ! SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
> Index: src/tools/make_mkid
> ===================================================================
> RCS file: /home/projects/pgsql/cvsroot/pgsql/src/tools/make_mkid,v
> retrieving revision 1.4
> diff -c -r1.4 make_mkid
> *** src/tools/make_mkid    2000/03/31 01:41:27    1.4
> --- src/tools/make_mkid    2000/07/02 09:30:08
> ***************
> *** 1,6 ****
>   #!/bin/sh
>   find `pwd`/ \( -name _deadcode -a -prune \) -o \
> !     -type f -name '*.[chyl]' -print|sed 's;//;/;g' | mkid
>
>   find . -name  'CVS' -prune -o -type d -print  |while read DIR
>   do
> --- 1,6 ----
>   #!/bin/sh
>   find `pwd`/ \( -name _deadcode -a -prune \) -o \
> !     -type f -name '*.[chyl]' -print|sed 's;//;/;g' | mkid -
>
>   find . -name  'CVS' -prune -o -type d -print  |while read DIR
>   do


--
  Bruce Momjian                        |  http://www.op.net/~candle
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026