Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
20ca834c
Commit
20ca834c
authored
23 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Minor code cleanup/beautification in RelationPutHeapTuple.
parent
379ac0d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/access/heap/hio.c
+11
-15
11 additions, 15 deletions
src/backend/access/heap/hio.c
with
11 additions
and
15 deletions
src/backend/access/heap/hio.c
+
11
−
15
View file @
20ca834c
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Id: hio.c,v 1.4
1
2001/0
6/29 21:08:23
tgl Exp $
* $Id: hio.c,v 1.4
2
2001/0
7/13 22:52:58
tgl Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -25,8 +25,7 @@
*
* !!! ELOG(ERROR) IS DISALLOWED HERE !!!
*
* Note - we assume that caller hold BUFFER_LOCK_EXCLUSIVE on the buffer.
*
* Note - caller must hold BUFFER_LOCK_EXCLUSIVE on the buffer.
*/
void
RelationPutHeapTuple
(
Relation
relation
,
...
...
@@ -35,7 +34,6 @@ RelationPutHeapTuple(Relation relation,
{
Page
pageHeader
;
OffsetNumber
offnum
;
Size
len
;
ItemId
itemId
;
Item
item
;
...
...
@@ -45,24 +43,22 @@ RelationPutHeapTuple(Relation relation,
IncrHeapAccessStat
(
local_RelationPutHeapTuple
);
IncrHeapAccessStat
(
global_RelationPutHeapTuple
);
pageHeader
=
(
Page
)
BufferGetPage
(
buffer
);
len
=
MAXALIGN
(
tuple
->
t_len
);
/* be conservative */
Assert
(
len
<=
PageGetFreeSpace
(
pageHeader
));
/* Add the tuple to the page */
pageHeader
=
BufferGetPage
(
buffer
);
offnum
=
PageAddItem
(
(
Page
)
pageHeader
,
(
Item
)
tuple
->
t_data
,
offnum
=
PageAddItem
(
pageHeader
,
(
Item
)
tuple
->
t_data
,
tuple
->
t_len
,
InvalidOffsetNumber
,
LP_USED
);
if
(
offnum
==
InvalidOffsetNumber
)
elog
(
STOP
,
"RelationPutHeapTuple: failed to add tuple"
);
itemId
=
PageGetItemId
((
Page
)
pageHeader
,
offnum
);
item
=
PageGetItem
((
Page
)
pageHeader
,
itemId
);
ItemPointerSet
(
&
((
HeapTupleHeader
)
item
)
->
t_ctid
,
BufferGetBlockNumber
(
buffer
),
offnum
);
/* Update tuple->t_self to the actual position where it was stored */
ItemPointerSet
(
&
(
tuple
->
t_self
),
BufferGetBlockNumber
(
buffer
),
offnum
);
/* return an accurate tuple */
ItemPointerSet
(
&
tuple
->
t_self
,
BufferGetBlockNumber
(
buffer
),
offnum
);
/* Insert the correct position into CTID of the stored tuple, too */
itemId
=
PageGetItemId
(
pageHeader
,
offnum
);
item
=
PageGetItem
(
pageHeader
,
itemId
);
((
HeapTupleHeader
)
item
)
->
t_ctid
=
tuple
->
t_self
;
}
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment