Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c6f4015

Browse files
committed
Reducing the assumed alignment of struct varlena means that the compiler
is also licensed to put a local variable declared that way at an unaligned address. Which will not work if the variable is then manipulated with SET_VARSIZE or other macros that assume alignment. So the previous patch is not an unalloyed good, but on balance I think it's still a win, since we have very few places that do that sort of thing. Fix the one place in tuptoaster.c that does it. Per buildfarm results from gypsy_moth (I'm a bit surprised that only one machine showed a failure).
1 parent b739491 commit c6f4015

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/backend/access/heap/tuptoaster.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.81.2.1 2008/02/23 19:11:55 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/tuptoaster.c,v 1.81.2.2 2008/02/29 17:47:47 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1093,7 +1093,8 @@ toast_save_datum(Relation rel, Datum value,
10931093
struct
10941094
{
10951095
struct varlena hdr;
1096-
char data[TOAST_MAX_CHUNK_SIZE];
1096+
char data[TOAST_MAX_CHUNK_SIZE]; /* make struct big enough */
1097+
int32 align_it; /* ensure struct is aligned well enough */
10971098
} chunk_data;
10981099
int32 chunk_size;
10991100
int32 chunk_seq = 0;

0 commit comments

Comments
 (0)