aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/access/common/heaptuple.c12
-rw-r--r--src/backend/access/heap/heapam.c11
-rw-r--r--src/backend/catalog/heap.c18
-rw-r--r--src/backend/parser/parse_relation.c5
-rw-r--r--src/backend/utils/cache/lsyscache.c4
5 files changed, 41 insertions, 9 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index d30e4c7fe64..f93bf34db90 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.62 2000/04/12 17:14:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.63 2000/07/02 22:00:24 momjian Exp $
*
* NOTES
* The old interface functions have been converted to macros
@@ -169,6 +169,7 @@ heap_attisnull(HeapTuple tup, int attnum)
else
switch (attnum)
{
+ case TableOidAttributeNumber:
case SelfItemPointerAttributeNumber:
case ObjectIdAttributeNumber:
case MinTransactionIdAttributeNumber:
@@ -205,6 +206,8 @@ heap_sysattrlen(AttrNumber attno)
switch (attno)
{
+ case TableOidAttributeNumber:
+ return sizeof f->t_oid;
case SelfItemPointerAttributeNumber:
return sizeof f->t_ctid;
case ObjectIdAttributeNumber:
@@ -237,6 +240,9 @@ heap_sysattrbyval(AttrNumber attno)
switch (attno)
{
+ case TableOidAttributeNumber:
+ byval = true;
+ break;
case SelfItemPointerAttributeNumber:
byval = false;
break;
@@ -275,7 +281,9 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
{
switch (attnum)
{
- case SelfItemPointerAttributeNumber:
+ case TableOidAttributeNumber:
+ return (Datum) &tup->t_tableoid;
+ case SelfItemPointerAttributeNumber:
return (Datum) &tup->t_ctid;
case ObjectIdAttributeNumber:
return (Datum) (long) tup->t_oid;
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index 150005f8fbe..d671036f049 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.73 2000/06/30 16:10:40 petere Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.74 2000/07/02 22:00:27 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -235,6 +235,8 @@ heapgettup(Relation relation,
int linesleft;
ItemPointer tid = (tuple->t_data == NULL) ?
(ItemPointer) NULL : &(tuple->t_self);
+
+ tuple->tableOid = relation->rd_id;
/* ----------------
* increment access statistics
@@ -621,6 +623,7 @@ heap_openr(const char *relationName, LOCKMODE lockmode)
Assert(lockmode >= NoLock && lockmode < MAX_LOCKMODES);
+
/* ----------------
* increment access statistics
* ----------------
@@ -1084,6 +1087,7 @@ heap_fetch(Relation relation,
ItemPointer tid = &(tuple->t_self);
OffsetNumber offnum;
+ tuple->tableOid = relation->rd_id;
/* ----------------
* increment access statistics
* ----------------
@@ -1178,6 +1182,7 @@ heap_get_latest_tid(Relation relation,
bool invalidBlock,
linkend;
+ tp.tableOid = relation->rd_id;
/* ----------------
* get the buffer from the relation descriptor
* Note that this does a buffer pin.
@@ -1270,6 +1275,7 @@ heap_insert(Relation relation, HeapTuple tup)
* increment access statistics
* ----------------
*/
+ tup->tableOid = relation->rd_id;
IncrHeapAccessStat(local_insert);
IncrHeapAccessStat(global_insert);
@@ -1335,6 +1341,7 @@ heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid)
Buffer buffer;
int result;
+ tp.tableOid = relation->rd_id;
/* increment access statistics */
IncrHeapAccessStat(local_delete);
IncrHeapAccessStat(global_delete);
@@ -1447,6 +1454,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
Buffer buffer;
int result;
+ newtup->tableOid = relation->rd_id;
/* increment access statistics */
IncrHeapAccessStat(local_replace);
IncrHeapAccessStat(global_replace);
@@ -1575,6 +1583,7 @@ heap_mark4update(Relation relation, HeapTuple tuple, Buffer *buffer)
PageHeader dp;
int result;
+ tuple->tableOid = relation->rd_id;
/* increment access statistics */
IncrHeapAccessStat(local_mark4update);
IncrHeapAccessStat(global_mark4update);
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index dceab60c8e0..721297680ed 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.135 2000/07/02 04:46:09 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.136 2000/07/02 22:00:34 momjian Exp $
*
*
* INTERFACE ROUTINES
@@ -131,12 +131,22 @@ static FormData_pg_attribute a6 = {
MaxCommandIdAttributeNumber, 0, -1, -1, '\001', 'p', '\0', 'i', '\0', '\0'
};
-static Form_pg_attribute HeapAtt[] = {&a1, &a2, &a3, &a4, &a5, &a6};
+/*
+ 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
- * ----------------------------------------------------------------
- */
+ * ---------------------------------------------------------------- */
/* ----------------------------------------------------------------
diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c
index cbb5f07fefa..7a3e3c2d6ad 100644
--- a/src/backend/parser/parse_relation.c
+++ b/src/backend/parser/parse_relation.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.44 2000/06/20 01:41:21 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.45 2000/07/02 22:00:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,6 +57,9 @@ static struct
{
"cmax", MaxCommandIdAttributeNumber, CIDOID
},
+ {
+ "tableoid", TableOidAttributeNumber, OIDOID
+ }
};
#define SPECIALS ((int) (sizeof(special_attr)/sizeof(special_attr[0])))
diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c
index 19556fce66f..58048622222 100644
--- a/src/backend/utils/cache/lsyscache.c
+++ b/src/backend/utils/cache/lsyscache.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.42 2000/06/08 22:37:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.43 2000/07/02 22:00:48 momjian Exp $
*
* NOTES
* Eventually, the index information should go through here, too.
@@ -249,6 +249,8 @@ get_attdisbursion(Oid relid, AttrNumber attnum, double min_estimate)
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