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
7540eda8
Commit
7540eda8
authored
28 years ago
by
Vadim B. Mikheev
Browse files
Options
Downloads
Patches
Plain Diff
Someone forgot about aligning in fastgetiattr()...
parent
9392a191
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/access/common/indextuple.c
+63
-34
63 additions, 34 deletions
src/backend/access/common/indextuple.c
with
63 additions
and
34 deletions
src/backend/access/common/indextuple.c
+
63
−
34
View file @
7540eda8
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.1
3
1997/0
3/26 02:24:38
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.1
4
1997/0
6/12 15:41:52
vadim Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -135,6 +135,7 @@ fastgetiattr(IndexTuple tup,
register
char
*
bp
=
NULL
;
/* ptr to att in tuple */
int
slow
;
/* do we have to walk nulls? */
register
int
data_off
;
/* tuple data offset */
AttributeTupleForm
*
att
=
tupleDesc
->
attrs
;
/* ----------------
* sanity checks
...
...
@@ -162,14 +163,14 @@ fastgetiattr(IndexTuple tup,
/* first attribute is always at position zero */
if
(
attnum
==
1
)
{
return
(
fetchatt
(
&
(
tupleDesc
->
att
rs
[
0
]),
(
char
*
)
tup
+
data_off
));
return
(
fetchatt
(
&
(
att
[
0
]),
(
char
*
)
tup
+
data_off
));
}
attnum
--
;
if
(
tupleDesc
->
att
rs
[
attnum
]
->
attcacheoff
>
0
)
{
return
(
fetchatt
(
&
(
tupleDesc
->
att
rs
[
attnum
]),
if
(
att
[
attnum
]
->
attcacheoff
>
0
)
{
return
(
fetchatt
(
&
(
att
[
attnum
]),
(
char
*
)
tup
+
data_off
+
tupleDesc
->
att
rs
[
attnum
]
->
attcacheoff
));
att
[
attnum
]
->
attcacheoff
));
}
tp
=
(
char
*
)
tup
+
data_off
;
...
...
@@ -226,14 +227,14 @@ fastgetiattr(IndexTuple tup,
/* now check for any non-fixed length attrs before our attribute */
if
(
!
slow
)
{
if
(
tupleDesc
->
att
rs
[
attnum
]
->
attcacheoff
>
0
)
{
return
(
fetchatt
(
&
(
tupleDesc
->
att
rs
[
attnum
]),
tp
+
tupleDesc
->
att
rs
[
attnum
]
->
attcacheoff
));
if
(
att
[
attnum
]
->
attcacheoff
>
0
)
{
return
(
fetchatt
(
&
(
att
[
attnum
]),
tp
+
att
[
attnum
]
->
attcacheoff
));
}
else
if
(
!
IndexTupleAllFixed
(
tup
))
{
register
int
j
=
0
;
for
(
j
=
0
;
j
<
attnum
&&
!
slow
;
j
++
)
if
(
tupleDesc
->
att
rs
[
j
]
->
attlen
<
1
)
slow
=
1
;
if
(
att
[
j
]
->
attlen
<
1
)
slow
=
1
;
}
}
...
...
@@ -251,12 +252,12 @@ fastgetiattr(IndexTuple tup,
* need to set cache for some atts
*/
tupleDesc
->
att
rs
[
0
]
->
attcacheoff
=
0
;
att
[
0
]
->
attcacheoff
=
0
;
while
(
tupleDesc
->
att
rs
[
j
]
->
attcacheoff
>
0
)
j
++
;
while
(
att
[
j
]
->
attcacheoff
>
0
)
j
++
;
off
=
tupleDesc
->
att
rs
[
j
-
1
]
->
attcacheoff
+
tupleDesc
->
att
rs
[
j
-
1
]
->
attlen
;
off
=
att
[
j
-
1
]
->
attcacheoff
+
att
[
j
-
1
]
->
attlen
;
for
(;
j
<
attnum
+
1
;
j
++
)
{
/*
...
...
@@ -264,10 +265,10 @@ fastgetiattr(IndexTuple tup,
* word!
*/
switch
(
tupleDesc
->
att
rs
[
j
]
->
attlen
)
switch
(
att
[
j
]
->
attlen
)
{
case
-
1
:
off
=
(
tupleDesc
->
att
rs
[
j
]
->
attalign
==
'd'
)
?
off
=
(
att
[
j
]
->
attalign
==
'd'
)
?
DOUBLEALIGN
(
off
)
:
INTALIGN
(
off
);
break
;
case
sizeof
(
char
):
...
...
@@ -279,22 +280,22 @@ fastgetiattr(IndexTuple tup,
off
=
INTALIGN
(
off
);
break
;
default:
if
(
tupleDesc
->
att
rs
[
j
]
->
attlen
>
sizeof
(
int32
))
off
=
(
tupleDesc
->
att
rs
[
j
]
->
attalign
==
'd'
)
?
if
(
att
[
j
]
->
attlen
>
sizeof
(
int32
))
off
=
(
att
[
j
]
->
attalign
==
'd'
)
?
DOUBLEALIGN
(
off
)
:
LONGALIGN
(
off
);
else
elog
(
WARN
,
"fastgetiattr: attribute %d has len %d"
,
j
,
tupleDesc
->
att
rs
[
j
]
->
attlen
);
j
,
att
[
j
]
->
attlen
);
break
;
}
tupleDesc
->
att
rs
[
j
]
->
attcacheoff
=
off
;
off
+=
tupleDesc
->
att
rs
[
j
]
->
attlen
;
att
[
j
]
->
attcacheoff
=
off
;
off
+=
att
[
j
]
->
attlen
;
}
return
(
fetchatt
(
&
(
tupleDesc
->
att
rs
[
attnum
]),
tp
+
tupleDesc
->
att
rs
[
attnum
]
->
attcacheoff
));
return
(
fetchatt
(
&
(
att
[
attnum
]),
tp
+
att
[
attnum
]
->
attcacheoff
));
}
else
{
register
bool
usecache
=
true
;
register
int
off
=
0
;
...
...
@@ -312,16 +313,16 @@ fastgetiattr(IndexTuple tup,
}
}
if
(
usecache
&&
tupleDesc
->
att
rs
[
i
]
->
attcacheoff
>
0
)
{
off
=
tupleDesc
->
att
rs
[
i
]
->
attcacheoff
;
if
(
tupleDesc
->
att
rs
[
i
]
->
attlen
==
-
1
)
if
(
usecache
&&
att
[
i
]
->
attcacheoff
>
0
)
{
off
=
att
[
i
]
->
attcacheoff
;
if
(
att
[
i
]
->
attlen
==
-
1
)
usecache
=
false
;
else
continue
;
}
if
(
usecache
)
tupleDesc
->
att
rs
[
i
]
->
attcacheoff
=
off
;
switch
(
tupleDesc
->
att
rs
[
i
]
->
attlen
)
if
(
usecache
)
att
[
i
]
->
attcacheoff
=
off
;
switch
(
att
[
i
]
->
attlen
)
{
case
sizeof
(
char
):
off
++
;
...
...
@@ -334,24 +335,52 @@ fastgetiattr(IndexTuple tup,
break
;
case
-
1
:
usecache
=
false
;
off
=
(
tupleDesc
->
att
rs
[
i
]
->
attalign
==
'd'
)
?
off
=
(
att
[
i
]
->
attalign
==
'd'
)
?
DOUBLEALIGN
(
off
)
:
INTALIGN
(
off
);
off
+=
VARSIZE
(
tp
+
off
);
break
;
default:
if
(
tupleDesc
->
att
rs
[
i
]
->
attlen
>
sizeof
(
int32
))
off
=
(
tupleDesc
->
att
rs
[
i
]
->
attalign
==
'd'
)
?
DOUBLEALIGN
(
off
)
+
tupleDesc
->
att
rs
[
i
]
->
attlen
:
LONGALIGN
(
off
)
+
tupleDesc
->
att
rs
[
i
]
->
attlen
;
if
(
att
[
i
]
->
attlen
>
sizeof
(
int32
))
off
=
(
att
[
i
]
->
attalign
==
'd'
)
?
DOUBLEALIGN
(
off
)
+
att
[
i
]
->
attlen
:
LONGALIGN
(
off
)
+
att
[
i
]
->
attlen
;
else
elog
(
WARN
,
"fastgetiattr2: attribute %d has len %d"
,
i
,
tupleDesc
->
att
rs
[
i
]
->
attlen
);
i
,
att
[
i
]
->
attlen
);
break
;
}
}
/*
* I don't know why this code was missed here!
* I've got it from heaptuple.c:fastgetattr().
* - vadim 06/12/97
*/
switch
(
att
[
attnum
]
->
attlen
)
{
case
-
1
:
off
=
(
att
[
attnum
]
->
attalign
==
'd'
)
?
DOUBLEALIGN
(
off
)
:
INTALIGN
(
off
);
break
;
case
sizeof
(
char
):
break
;
case
sizeof
(
short
):
off
=
SHORTALIGN
(
off
);
break
;
case
sizeof
(
int32
):
off
=
INTALIGN
(
off
);
break
;
default:
if
(
att
[
attnum
]
->
attlen
<
sizeof
(
int32
))
elog
(
WARN
,
"fastgetattr3: attribute %d has len %d"
,
attnum
,
att
[
attnum
]
->
attlen
);
if
(
att
[
attnum
]
->
attalign
==
'd'
)
off
=
DOUBLEALIGN
(
off
);
else
off
=
LONGALIGN
(
off
);
break
;
}
return
(
fetchatt
(
&
tupleDesc
->
att
rs
[
attnum
],
tp
+
off
));
return
(
fetchatt
(
&
att
[
attnum
],
tp
+
off
));
}
}
...
...
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