aboutsummaryrefslogtreecommitdiff
path: root/src/backend/storage/large_object/inv_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/storage/large_object/inv_api.c')
-rw-r--r--src/backend/storage/large_object/inv_api.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c
index a19c40186f5..ecd5e618f3c 100644
--- a/src/backend/storage/large_object/inv_api.c
+++ b/src/backend/storage/large_object/inv_api.c
@@ -562,11 +562,13 @@ inv_write(LargeObjectDesc *obj_desc, const char *buf, int nbytes)
bool neednextpage;
bytea *datafield;
bool pfreeit;
- struct
+ union
{
bytea hdr;
- char data[LOBLKSIZE]; /* make struct big enough */
- int32 align_it; /* ensure struct is aligned well enough */
+ /* this is to make the union big enough for a LO data chunk: */
+ char data[LOBLKSIZE + VARHDRSZ];
+ /* ensure union is aligned well enough: */
+ int32 align_it;
} workbuf;
char *workb = VARDATA(&workbuf.hdr);
HeapTuple newtup;
@@ -748,11 +750,13 @@ inv_truncate(LargeObjectDesc *obj_desc, int64 len)
SysScanDesc sd;
HeapTuple oldtuple;
Form_pg_largeobject olddata;
- struct
+ union
{
bytea hdr;
- char data[LOBLKSIZE]; /* make struct big enough */
- int32 align_it; /* ensure struct is aligned well enough */
+ /* this is to make the union big enough for a LO data chunk: */
+ char data[LOBLKSIZE + VARHDRSZ];
+ /* ensure union is aligned well enough: */
+ int32 align_it;
} workbuf;
char *workb = VARDATA(&workbuf.hdr);
HeapTuple newtup;