Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
2435c7d5
Commit
2435c7d5
authored
Nov 27, 1998
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New HeapTuple structure/interface.
parent
4d718803
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
117 additions
and
104 deletions
+117
-104
src/include/access/heapam.h
src/include/access/heapam.h
+14
-13
src/include/access/htup.h
src/include/access/htup.h
+30
-11
src/include/access/relscan.h
src/include/access/relscan.h
+25
-25
src/include/access/valid.h
src/include/access/valid.h
+21
-29
src/include/executor/executor.h
src/include/executor/executor.h
+2
-2
src/include/executor/tuptable.h
src/include/executor/tuptable.h
+8
-8
src/include/nodes/execnodes.h
src/include/nodes/execnodes.h
+11
-10
src/include/utils/tqual.h
src/include/utils/tqual.h
+6
-6
No files found.
src/include/access/heapam.h
View file @
2435c7d5
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: heapam.h,v 1.3
8 1998/10/08 18:30:22 momjian
Exp $
* $Id: heapam.h,v 1.3
9 1998/11/27 19:33:31 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -89,6 +89,10 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
*
* ----------------
*/
extern
Datum
nocachegetattr
(
HeapTuple
tup
,
int
attnum
,
TupleDesc
att
,
bool
*
isnull
);
#if !defined(DISABLE_COMPLEX_MACRO)
#define fastgetattr(tup, attnum, tupleDesc, isnull) \
...
...
@@ -101,7 +105,7 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
(attnum) == 1) ? \
( \
(Datum)fetchatt(&((tupleDesc)->attrs[(attnum)-1]), \
(char *) (tup)
+ (tup)
->t_hoff + \
(char *) (tup)
->t_data + (tup)->t_data
->t_hoff + \
( \
((attnum) != 1) ? \
(tupleDesc)->attrs[(attnum)-1]->attcacheoff \
...
...
@@ -115,7 +119,7 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
) \
: \
( \
att_isnull((attnum)-1, (tup)->t_bits) ? \
att_isnull((attnum)-1, (tup)->t_
data->t_
bits) ? \
( \
((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
(Datum)NULL \
...
...
@@ -129,9 +133,6 @@ typedef HeapAccessStatisticsData *HeapAccessStatistics;
#else
/* !defined(DISABLE_COMPLEX_MACRO) */
extern
Datum
nocachegetattr
(
HeapTuple
tup
,
int
attnum
,
TupleDesc
att
,
bool
*
isnull
);
static
Datum
fastgetattr
(
HeapTuple
tup
,
int
attnum
,
TupleDesc
tupleDesc
,
bool
*
isnull
)
...
...
@@ -146,7 +147,7 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
(
attnum
)
==
1
)
?
(
(
Datum
)
fetchatt
(
&
((
tupleDesc
)
->
attrs
[(
attnum
)
-
1
]),
(
char
*
)
(
tup
)
+
(
tup
)
->
t_hoff
+
(
char
*
)
(
tup
)
->
t_data
+
(
tup
)
->
t_data
->
t_hoff
+
(
((
attnum
)
!=
1
)
?
(
tupleDesc
)
->
attrs
[(
attnum
)
-
1
]
->
attcacheoff
...
...
@@ -160,7 +161,7 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
)
:
(
att_isnull
((
attnum
)
-
1
,
(
tup
)
->
t_bits
)
?
att_isnull
((
attnum
)
-
1
,
(
tup
)
->
t_
data
->
t_
bits
)
?
(
((
isnull
)
?
(
*
(
isnull
)
=
true
)
:
(
dummyret
)
NULL
),
(
Datum
)
NULL
...
...
@@ -205,7 +206,7 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
AssertMacro((tup) != NULL && \
(attnum) > FirstLowInvalidHeapAttributeNumber && \
(attnum) != 0), \
((attnum) > (int) (tup)->t_natts) ? \
((attnum) > (int) (tup)->t_
data->t_
natts) ? \
( \
((isnull) ? (*(isnull) = true) : (dummyret)NULL), \
(Datum)NULL \
...
...
@@ -221,13 +222,12 @@ fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
((isnull) ? (*(isnull) = false) : (dummyret)NULL), \
((attnum) == SelfItemPointerAttributeNumber) ? \
( \
(Datum)((char *)(tup) + \
heap_sysoffset[-SelfItemPointerAttributeNumber-1]) \
(Datum)((char *)&((tup)->t_self)) \
) \
: \
( \
(Datum)*(unsigned int *) \
((char *)(tup) + heap_sysoffset[-(attnum)-1]) \
((char *)(tup)
->t_data
+ heap_sysoffset[-(attnum)-1]) \
) \
) \
) \
...
...
@@ -251,7 +251,7 @@ extern HeapScanDesc heap_beginscan(Relation relation, int atend,
extern
void
heap_rescan
(
HeapScanDesc
scan
,
bool
scanFromEnd
,
ScanKey
key
);
extern
void
heap_endscan
(
HeapScanDesc
scan
);
extern
HeapTuple
heap_getnext
(
HeapScanDesc
scandesc
,
int
backw
);
extern
HeapTuple
heap_fetch
(
Relation
relation
,
Snapshot
snapshot
,
ItemPointer
tid
,
Buffer
*
userbuf
);
extern
void
heap_fetch
(
Relation
relation
,
Snapshot
snapshot
,
HeapTuple
tup
,
Buffer
*
userbuf
);
extern
Oid
heap_insert
(
Relation
relation
,
HeapTuple
tup
);
extern
int
heap_delete
(
Relation
relation
,
ItemPointer
tid
);
extern
int
heap_replace
(
Relation
relation
,
ItemPointer
otid
,
...
...
@@ -270,6 +270,7 @@ extern bool heap_sysattrbyval(AttrNumber attno);
extern
Datum
nocachegetattr
(
HeapTuple
tup
,
int
attnum
,
TupleDesc
att
,
bool
*
isnull
);
extern
HeapTuple
heap_copytuple
(
HeapTuple
tuple
);
extern
void
heap_copytuple_with_tuple
(
HeapTuple
src
,
HeapTuple
dest
);
extern
HeapTuple
heap_formtuple
(
TupleDesc
tupleDescriptor
,
Datum
*
value
,
char
*
nulls
);
extern
HeapTuple
heap_modifytuple
(
HeapTuple
tuple
,
...
...
src/include/access/htup.h
View file @
2435c7d5
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: htup.h,v 1.1
0 1998/09/01 04:34:14 momjian
Exp $
* $Id: htup.h,v 1.1
1 1998/11/27 19:33:31 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -26,10 +26,8 @@
* to avoid wasting space, the attributes should be layed out in such a
* way to reduce structure padding.
*/
typedef
struct
HeapTupleData
typedef
struct
HeapTuple
Header
Data
{
unsigned
int
t_len
;
/* length of entire tuple */
Oid
t_oid
;
/* OID of this tuple -- 4 bytes */
CommandId
t_cmin
;
/* insert CID stamp -- 4 bytes each */
...
...
@@ -38,7 +36,7 @@ typedef struct HeapTupleData
TransactionId
t_xmin
;
/* insert XID stamp -- 4 bytes each */
TransactionId
t_xmax
;
/* delete XID stamp */
ItemPointerData
t_ctid
;
/* current TID of this tuple */
ItemPointerData
t_ctid
;
/* current TID of this
or newer
tuple */
int16
t_natts
;
/* number of attributes */
...
...
@@ -50,10 +48,9 @@ typedef struct HeapTupleData
/* bit map of domains */
/* MORE DATA FOLLOWS AT END OF STRUCT */
}
HeapTupleData
;
typedef
HeapTupleData
*
HeapTuple
;
}
HeapTupleHeaderData
;
typedef
HeapTupleHeaderData
*
HeapTupleHeader
;
#define SelfItemPointerAttributeNumber (-1)
#define ObjectIdAttributeNumber (-2)
...
...
@@ -66,11 +63,33 @@ typedef HeapTupleData *HeapTuple;
/* If you make any changes above, the order off offsets in this must change */
extern
long
heap_sysoffset
[];
/*
* This new HeapTuple for version >= 6.5 and this is why it was changed:
*
* 1. t_len moved off on-disk tuple data - ItemIdData is used to get len;
* 2. t_ctid above is not self tuple TID now - it may point to
* updated version of tuple (required by MVCC);
* 3. someday someone let tuple to cross block boundaries -
* he have to add something below...
*/
typedef
struct
HeapTupleData
{
uint32
t_len
;
/* length of *t_data */
ItemPointerData
t_self
;
/* SelfItemPointer */
HeapTupleHeader
t_data
;
/* */
}
HeapTupleData
;
typedef
HeapTupleData
*
HeapTuple
;
#define HEAPTUPLESIZE DOUBLEALIGN(sizeof(HeapTupleData))
/* ----------------
* support macros
* ----------------
*/
#define GETSTRUCT(TUP) (((char *)(TUP)) + ((HeapTuple)(TUP))->t_hoff)
#define GETSTRUCT(TUP) (((char *)((HeapTuple)(TUP))->t_data) + \
((HeapTuple)(TUP))->t_data->t_hoff)
/*
...
...
@@ -101,9 +120,9 @@ extern long heap_sysoffset[];
#define HEAP_XACT_MASK 0x0F00
/* */
#define HeapTupleNoNulls(tuple) \
(!(((HeapTuple) (tuple))->t_infomask & HEAP_HASNULL))
(!(((HeapTuple) (tuple))->t_
data->t_
infomask & HEAP_HASNULL))
#define HeapTupleAllFixed(tuple) \
(!(((HeapTuple) (tuple))->t_infomask & HEAP_HASVARLENA))
(!(((HeapTuple) (tuple))->t_
data->t_
infomask & HEAP_HASVARLENA))
#endif
/* HTUP_H */
src/include/access/relscan.h
View file @
2435c7d5
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: relscan.h,v 1.1
2 1998/09/01 04:34:23 momjian
Exp $
* $Id: relscan.h,v 1.1
3 1998/11/27 19:33:31 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -23,9 +23,9 @@ typedef ItemPointerData MarkData;
typedef
struct
HeapScanDescData
{
Relation
rs_rd
;
/* pointer to relation descriptor */
HeapTuple
rs_ptup
;
/* previous tuple in scan */
HeapTuple
rs_ctup
;
/* current tuple in scan */
HeapTuple
rs_ntup
;
/* next tuple in scan */
HeapTuple
Data
rs_ptup
;
/* previous tuple in scan */
HeapTuple
Data
rs_ctup
;
/* current tuple in scan */
HeapTuple
Data
rs_ntup
;
/* next tuple in scan */
Buffer
rs_pbuf
;
/* previous buffer in scan */
Buffer
rs_cbuf
;
/* current buffer in scan */
Buffer
rs_nbuf
;
/* next buffer in scan */
...
...
@@ -50,7 +50,7 @@ typedef struct IndexScanDescData
ItemPointerData
currentItemData
;
/* current index pointer */
ItemPointerData
nextItemData
;
/* next index pointer */
MarkData
previousMarkData
;
/* marked previous pointer */
MarkData
currentMarkData
;
/* marked current pointer */
MarkData
currentMarkData
;
/* marked current pointer */
MarkData
nextMarkData
;
/* marked next pointer */
uint8
flags
;
/* scan position flags */
bool
scanFromEnd
;
/* restart scan at end? */
...
...
src/include/access/valid.h
View file @
2435c7d5
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: valid.h,v 1.1
5 1998/09/01 04:34:33 momjian
Exp $
* $Id: valid.h,v 1.1
6 1998/11/27 19:33:32 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -109,48 +109,40 @@ do \
* with joey's expensive function work.
* ----------------
*/
#define HeapTupleSatisfies(
itemId
, \
#define HeapTupleSatisfies(
tuple
, \
relation, \
buffer, \
disk_page, \
seeself, \
nKeys, \
key, \
result) \
key) \
do \
{ \
/* We use underscores to protect the variable passed in as parameters */
\
HeapTuple _tuple; \
bool _res; \
\
if (!ItemIdIsUsed(itemId)) \
(result) = (HeapTuple) NULL; \
else \
{ \
_tuple = (HeapTuple) PageGetItem((Page) (disk_page), (itemId)); \
\
if ((key) != NULL) \
HeapKeyTest(_
tuple, RelationGetDescr(relation), \
HeapKeyTest(
tuple, RelationGetDescr(relation), \
(nKeys), (key), _res); \
else \
_res = TRUE; \
\
(result) = (HeapTuple) NULL; \
if (_res) \
{ \
if ((relation)->rd_rel->relkind == RELKIND_UNCATALOGED) \
(result) = _tuple; \
else \
if ((relation)->rd_rel->relkind != RELKIND_UNCATALOGED) \
{ \
uint16 _infomask = _tuple
->t_infomask; \
uint16 _infomask = (tuple)->t_data
->t_infomask; \
\
_res = HeapTupleSatisfiesVisibility(_tuple
, (seeself)); \
if (_tuple
->t_infomask != _infomask) \
_res = HeapTupleSatisfiesVisibility((tuple)
, (seeself)); \
if ((tuple)->t_data
->t_infomask != _infomask) \
SetBufferCommitInfoNeedsSave(buffer); \
if (
_res) \
(result) = _tuple
; \
if (!
_res) \
(tuple)->t_data = NULL
; \
} \
} \
else \
{ \
(tuple)->t_data = NULL; \
} \
} while (0)
...
...
src/include/executor/executor.h
View file @
2435c7d5
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: executor.h,v 1.2
7 1998/10/14 05:10:05 momjian
Exp $
* $Id: executor.h,v 1.2
8 1998/11/27 19:33:32 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -85,7 +85,7 @@ extern HeapTuple ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot);
extern
TupleDesc
ExecutorStart
(
QueryDesc
*
queryDesc
,
EState
*
estate
);
extern
TupleTableSlot
*
ExecutorRun
(
QueryDesc
*
queryDesc
,
EState
*
estate
,
int
feature
,
int
count
);
extern
void
ExecutorEnd
(
QueryDesc
*
queryDesc
,
EState
*
estate
);
extern
HeapTuple
ExecConstraints
(
char
*
caller
,
Relation
rel
,
HeapTuple
tuple
);
extern
void
ExecConstraints
(
char
*
caller
,
Relation
rel
,
HeapTuple
tuple
);
#ifdef QUERY_LIMIT
extern
int
ExecutorLimit
(
int
limit
);
extern
int
ExecutorGetLimit
(
void
);
...
...
src/include/executor/tuptable.h
View file @
2435c7d5
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: tuptable.h,v 1.
8 1998/09/01 04:36:13 momjian
Exp $
* $Id: tuptable.h,v 1.
9 1998/11/27 19:33:33 vadim
Exp $
*
* NOTES
* The tuple table interface is getting pretty ugly.
...
...
src/include/nodes/execnodes.h
View file @
2435c7d5
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: execnodes.h,v 1.1
8 1998/09/01 04:36:35 momjian
Exp $
* $Id: execnodes.h,v 1.1
9 1998/11/27 19:33:33 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -405,6 +405,7 @@ typedef struct IndexScanState
Pointer
iss_RuntimeKeyInfo
;
RelationPtr
iss_RelationDescs
;
IndexScanDescPtr
iss_ScanDescs
;
HeapTupleData
iss_htup
;
}
IndexScanState
;
...
...
src/include/utils/tqual.h
View file @
2435c7d5
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: tqual.h,v 1.1
4 1998/09/01 04:39:35 momjian
Exp $
* $Id: tqual.h,v 1.1
5 1998/11/27 19:33:35 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -42,14 +42,14 @@ extern CommandId HeapSpecialCommandId;
*/
#define HeapTupleSatisfiesVisibility(tuple, snapshot) \
( \
TransactionIdEquals((tuple)->t_xmax, AmiTransactionId) ? \
TransactionIdEquals((tuple)->t_
data->t_
xmax, AmiTransactionId) ? \
false \
: \
( \
(IsSnapshotSelf(snapshot) || heapisoverride()) ? \
HeapTupleSatisfiesItself(
tuple
) \
HeapTupleSatisfiesItself(
(tuple)->t_data
) \
: \
HeapTupleSatisfiesNow(
tuple
) \
HeapTupleSatisfiesNow(
(tuple)->t_data
) \
) \
)
...
...
@@ -71,8 +71,8 @@ extern CommandId HeapSpecialCommandId;
) \
)
extern
bool
HeapTupleSatisfiesItself
(
HeapTuple
tuple
);
extern
bool
HeapTupleSatisfiesNow
(
HeapTuple
tuple
);
extern
bool
HeapTupleSatisfiesItself
(
HeapTuple
Header
tuple
);
extern
bool
HeapTupleSatisfiesNow
(
HeapTuple
Header
tuple
);
extern
void
setheapoverride
(
bool
on
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment