Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
40f797be
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
40f797be
编写于
1月 09, 2007
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable another five tuple status bits by using the high bits of the
nattr field, and rename the field. Heikki Linnakangas
上级
ca9213e8
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
44 addition
and
34 deletion
+44
-34
src/backend/access/common/heaptuple.c
src/backend/access/common/heaptuple.c
+14
-13
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam.c
+5
-5
src/backend/executor/spi.c
src/backend/executor/spi.c
+3
-3
src/include/access/heapam.h
src/include/access/heapam.h
+2
-2
src/include/access/htup.h
src/include/access/htup.h
+17
-8
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_exec.c
+3
-3
未找到文件。
src/backend/access/common/heaptuple.c
浏览文件 @
40f797be
...
...
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.11
3 2007/01/05 22:19:21
momjian Exp $
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.11
4 2007/01/09 22:00:59
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -295,7 +295,7 @@ DataFill(char *data,
bool
heap_attisnull
(
HeapTuple
tup
,
int
attnum
)
{
if
(
attnum
>
(
int
)
tup
->
t_data
->
t_natts
)
if
(
attnum
>
(
int
)
HeapTupleHeaderGetNatts
(
tup
->
t_data
)
)
return
true
;
if
(
attnum
>
0
)
...
...
@@ -474,6 +474,7 @@ nocachegetattr(HeapTuple tuple,
{
int
j
=
1
;
long
off
;
int
natts
=
HeapTupleHeaderGetNatts
(
tup
);
/*
* need to set cache for some atts
...
...
@@ -488,7 +489,7 @@ nocachegetattr(HeapTuple tuple,
for
(;
j
<=
attnum
||
/* Can we compute more? We will probably need them */
(
j
<
tup
->
t_
natts
&&
(
j
<
natts
&&
att
[
j
]
->
attcacheoff
==
-
1
&&
(
HeapTupleNoNulls
(
tuple
)
||
!
att_isnull
(
j
,
bp
))
&&
(
HeapTupleAllFixed
(
tuple
)
||
att
[
j
]
->
attlen
>
0
));
j
++
)
...
...
@@ -739,7 +740,7 @@ heap_form_tuple(TupleDesc tupleDescriptor,
HeapTupleHeaderSetTypeId
(
td
,
tupleDescriptor
->
tdtypeid
);
HeapTupleHeaderSetTypMod
(
td
,
tupleDescriptor
->
tdtypmod
);
td
->
t_natts
=
numberOfAttributes
;
HeapTupleHeaderSetNatts
(
td
,
numberOfAttributes
)
;
td
->
t_hoff
=
hoff
;
if
(
tupleDescriptor
->
tdhasoid
)
/* else leave infomask = 0 */
...
...
@@ -846,7 +847,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
HeapTupleHeaderSetTypeId
(
td
,
tupleDescriptor
->
tdtypeid
);
HeapTupleHeaderSetTypMod
(
td
,
tupleDescriptor
->
tdtypmod
);
td
->
t_natts
=
numberOfAttributes
;
HeapTupleHeaderSetNatts
(
td
,
numberOfAttributes
)
;
td
->
t_hoff
=
hoff
;
if
(
tupleDescriptor
->
tdhasoid
)
/* else leave infomask = 0 */
...
...
@@ -1035,7 +1036,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
bits8
*
bp
=
tup
->
t_bits
;
/* ptr to null bitmap in tuple */
bool
slow
=
false
;
/* can we use/set attcacheoff? */
natts
=
tup
->
t_natts
;
natts
=
HeapTupleHeaderGetNatts
(
tup
)
;
/*
* In inheritance situations, it is possible that the given tuple actually
...
...
@@ -1128,7 +1129,7 @@ heap_deformtuple(HeapTuple tuple,
bits8
*
bp
=
tup
->
t_bits
;
/* ptr to null bitmap in tuple */
bool
slow
=
false
;
/* can we use/set attcacheoff? */
natts
=
tup
->
t_natts
;
natts
=
HeapTupleHeaderGetNatts
(
tup
)
;
/*
* In inheritance situations, it is possible that the given tuple actually
...
...
@@ -1335,7 +1336,7 @@ slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)
* than the tupdesc.)
*/
tup
=
tuple
->
t_data
;
if
(
attnum
>
tup
->
t_natts
)
if
(
attnum
>
HeapTupleHeaderGetNatts
(
tup
)
)
{
*
isnull
=
true
;
return
(
Datum
)
0
;
...
...
@@ -1401,7 +1402,7 @@ slot_getallattrs(TupleTableSlot *slot)
/*
* load up any slots available from physical tuple
*/
attnum
=
tuple
->
t_data
->
t_natts
;
attnum
=
HeapTupleHeaderGetNatts
(
tuple
->
t_data
)
;
attnum
=
Min
(
attnum
,
tdesc_natts
);
slot_deform_tuple
(
slot
,
attnum
);
...
...
@@ -1448,7 +1449,7 @@ slot_getsomeattrs(TupleTableSlot *slot, int attnum)
/*
* load up any slots available from physical tuple
*/
attno
=
tuple
->
t_data
->
t_natts
;
attno
=
HeapTupleHeaderGetNatts
(
tuple
->
t_data
)
;
attno
=
Min
(
attno
,
attnum
);
slot_deform_tuple
(
slot
,
attno
);
...
...
@@ -1601,7 +1602,7 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor,
* And fill in the information.
*/
tuple
->
t_len
=
len
;
tuple
->
t_natts
=
numberOfAttributes
;
HeapTupleHeaderSetNatts
(
tuple
,
numberOfAttributes
)
;
tuple
->
t_hoff
=
hoff
+
MINIMAL_TUPLE_OFFSET
;
if
(
tupleDescriptor
->
tdhasoid
)
/* else leave infomask = 0 */
...
...
@@ -1663,7 +1664,7 @@ heap_tuple_from_minimal_tuple(MinimalTuple mtup)
result
->
t_tableOid
=
InvalidOid
;
result
->
t_data
=
(
HeapTupleHeader
)
((
char
*
)
result
+
HEAPTUPLESIZE
);
memcpy
((
char
*
)
result
->
t_data
+
MINIMAL_TUPLE_OFFSET
,
mtup
,
mtup
->
t_len
);
memset
(
result
->
t_data
,
0
,
offsetof
(
HeapTupleHeaderData
,
t_
natts
));
memset
(
result
->
t_data
,
0
,
offsetof
(
HeapTupleHeaderData
,
t_
infomask2
));
return
result
;
}
...
...
@@ -1729,7 +1730,7 @@ heap_addheader(int natts, /* max domain index */
/* we don't bother to fill the Datum fields */
td
->
t_natts
=
natts
;
HeapTupleHeaderSetNatts
(
td
,
natts
)
;
td
->
t_hoff
=
hoff
;
if
(
withoid
)
/* else leave infomask = 0 */
...
...
src/backend/access/heap/heapam.c
浏览文件 @
40f797be
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.22
3 2007/01/05 22:19:22
momjian Exp $
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.22
4 2007/01/09 22:00:59
momjian Exp $
*
*
* INTERFACE ROUTINES
...
...
@@ -1455,7 +1455,7 @@ heap_insert(Relation relation, HeapTuple tup, CommandId cid,
rdata
[
0
].
buffer
=
InvalidBuffer
;
rdata
[
0
].
next
=
&
(
rdata
[
1
]);
xlhdr
.
t_
natts
=
heaptup
->
t_data
->
t_natts
;
xlhdr
.
t_
infomask2
=
heaptup
->
t_data
->
t_infomask2
;
xlhdr
.
t_infomask
=
heaptup
->
t_data
->
t_infomask
;
xlhdr
.
t_hoff
=
heaptup
->
t_data
->
t_hoff
;
...
...
@@ -3204,7 +3204,7 @@ log_heap_update(Relation reln, Buffer oldbuf, ItemPointerData from,
rdata
[
1
].
buffer_std
=
true
;
rdata
[
1
].
next
=
&
(
rdata
[
2
]);
xlhdr
.
hdr
.
t_
natts
=
newtup
->
t_data
->
t_natts
;
xlhdr
.
hdr
.
t_
infomask2
=
newtup
->
t_data
->
t_infomask2
;
xlhdr
.
hdr
.
t_infomask
=
newtup
->
t_data
->
t_infomask
;
xlhdr
.
hdr
.
t_hoff
=
newtup
->
t_data
->
t_hoff
;
if
(
move
)
/* remember xmax & xmin */
...
...
@@ -3503,7 +3503,7 @@ heap_xlog_insert(XLogRecPtr lsn, XLogRecord *record)
(
char
*
)
xlrec
+
SizeOfHeapInsert
+
SizeOfHeapHeader
,
newlen
);
newlen
+=
offsetof
(
HeapTupleHeaderData
,
t_bits
);
htup
->
t_
natts
=
xlhdr
.
t_natts
;
htup
->
t_
infomask2
=
xlhdr
.
t_infomask2
;
htup
->
t_infomask
=
xlhdr
.
t_infomask
;
htup
->
t_hoff
=
xlhdr
.
t_hoff
;
HeapTupleHeaderSetXmin
(
htup
,
record
->
xl_xid
);
...
...
@@ -3666,7 +3666,7 @@ newsame:;
(
char
*
)
xlrec
+
hsize
,
newlen
);
newlen
+=
offsetof
(
HeapTupleHeaderData
,
t_bits
);
htup
->
t_
natts
=
xlhdr
.
t_natts
;
htup
->
t_
infomask2
=
xlhdr
.
t_infomask2
;
htup
->
t_infomask
=
xlhdr
.
t_infomask
;
htup
->
t_hoff
=
xlhdr
.
t_hoff
;
...
...
src/backend/executor/spi.c
浏览文件 @
40f797be
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.16
8 2007/01/05 22:19:2
9 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.16
9 2007/01/09 22:00:5
9 momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -651,7 +651,7 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
SPI_result
=
0
;
if
(
fnumber
>
tuple
->
t_data
->
t_natts
||
fnumber
==
0
||
if
(
fnumber
>
HeapTupleHeaderGetNatts
(
tuple
->
t_data
)
||
fnumber
==
0
||
fnumber
<=
FirstLowInvalidHeapAttributeNumber
)
{
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
...
...
@@ -692,7 +692,7 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
{
SPI_result
=
0
;
if
(
fnumber
>
tuple
->
t_data
->
t_natts
||
fnumber
==
0
||
if
(
fnumber
>
HeapTupleHeaderGetNatts
(
tuple
->
t_data
)
||
fnumber
==
0
||
fnumber
<=
FirstLowInvalidHeapAttributeNumber
)
{
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
...
...
src/include/access/heapam.h
浏览文件 @
40f797be
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.11
8 2007/01/05 22:19:51
momjian Exp $
* $PostgreSQL: pgsql/src/include/access/heapam.h,v 1.11
9 2007/01/09 22:01:00
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -98,7 +98,7 @@ extern Datum fastgetattr(HeapTuple tup, int attnum, TupleDesc tupleDesc,
( \
((attnum) > 0) ? \
( \
((attnum) > (int)
(tup)->t_data->t_natts
) ? \
((attnum) > (int)
HeapTupleHeaderGetNatts((tup)->t_data)
) ? \
( \
(((isnull) != NULL) ? (*(isnull) = true) : (dummyret)NULL), \
(Datum)NULL \
...
...
src/include/access/htup.h
浏览文件 @
40f797be
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.8
8 2007/01/05 22:19:51
momjian Exp $
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.8
9 2007/01/09 22:01:00
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -139,7 +139,7 @@ typedef struct HeapTupleHeaderData
/* Fields below here must match MinimalTupleData! */
int16
t_natts
;
/* number of attribute
s */
uint16
t_infomask2
;
/* number of attributes + various flag
s */
uint16
t_infomask
;
/* various flag bits, see below */
...
...
@@ -182,6 +182,15 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
#define HEAP_XACT_MASK 0xFFC0
/* visibility-related bits */
/* information stored in t_infomask2, and accessor macros */
#define HEAP_NATTS_MASK 0x7FF
/* 11 bits for number of attributes */
/* bits 0xF800 are unused */
#define HeapTupleHeaderGetNatts(tup) ((tup)->t_infomask2 & HEAP_NATTS_MASK)
#define HeapTupleHeaderSetNatts(tup, natts) \
( \
(tup)->t_infomask2 = ((tup)->t_infomask2 & ~HEAP_NATTS_MASK) | (natts) \
)
/*
* HeapTupleHeader accessor macros
...
...
@@ -367,8 +376,8 @@ do { \
* and thereby prevent accidental use of the nonexistent fields.
*
* MinimalTupleData contains a length word, some padding, and fields matching
* HeapTupleHeaderData beginning with t_
natts.
The padding is chosen so that
* offsetof(t_
natts
) is the same modulo MAXIMUM_ALIGNOF in both structs.
* HeapTupleHeaderData beginning with t_
infomask2.
The padding is chosen so that
* offsetof(t_
infomask2
) is the same modulo MAXIMUM_ALIGNOF in both structs.
* This makes data alignment rules equivalent in both cases.
*
* When a minimal tuple is accessed via a HeapTupleData pointer, t_data is
...
...
@@ -380,9 +389,9 @@ do { \
* the MINIMAL_TUPLE_OFFSET distance. t_len does not include that, however.
*/
#define MINIMAL_TUPLE_OFFSET \
((offsetof(HeapTupleHeaderData, t_
natts
) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF)
((offsetof(HeapTupleHeaderData, t_
infomask2
) - sizeof(uint32)) / MAXIMUM_ALIGNOF * MAXIMUM_ALIGNOF)
#define MINIMAL_TUPLE_PADDING \
((offsetof(HeapTupleHeaderData, t_
natts
) - sizeof(uint32)) % MAXIMUM_ALIGNOF)
((offsetof(HeapTupleHeaderData, t_
infomask2
) - sizeof(uint32)) % MAXIMUM_ALIGNOF)
typedef
struct
MinimalTupleData
{
...
...
@@ -392,7 +401,7 @@ typedef struct MinimalTupleData
/* Fields below here must match HeapTupleHeaderData! */
int16
t_natts
;
/* number of attribute
s */
uint16
t_infomask2
;
/* number of attributes + various flag
s */
uint16
t_infomask
;
/* various flag bits, see below */
...
...
@@ -552,7 +561,7 @@ typedef struct xl_heap_delete
*/
typedef
struct
xl_heap_header
{
int16
t_natts
;
uint16
t_infomask2
;
uint16
t_infomask
;
uint8
t_hoff
;
}
xl_heap_header
;
...
...
src/pl/plpgsql/src/pl_exec.c
浏览文件 @
40f797be
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.18
2 2007/01/05 22:20:02
momjian Exp $
* $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.18
3 2007/01/09 22:01:00
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -4092,7 +4092,7 @@ exec_move_row(PLpgSQL_execstate *estate,
* Row is a bit more complicated in that we assign the individual
* attributes of the tuple to the variables the row points to.
*
* NOTE: this code used to demand row->nfields ==
tup->t_data->t_natts
,
* NOTE: this code used to demand row->nfields ==
HeapTupleHeaderGetNatts(tup->t_data
,
* but that's wrong. The tuple might have more fields than we expected if
* it's from an inheritance-child table of the current table, or it might
* have fewer if the table has had columns added by ALTER TABLE. Ignore
...
...
@@ -4110,7 +4110,7 @@ exec_move_row(PLpgSQL_execstate *estate,
int
anum
;
if
(
HeapTupleIsValid
(
tup
))
t_natts
=
tup
->
t_data
->
t_natts
;
t_natts
=
HeapTupleHeaderGetNatts
(
tup
->
t_data
)
;
else
t_natts
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录