CommandId mycid = GetCurrentCommandId(true);
struct varlena *result;
struct varatt_external toast_pointer;
- struct
+ union
{
struct varlena hdr;
- char data[TOAST_MAX_CHUNK_SIZE]; /* make struct big enough */
- int32 align_it; /* ensure struct is aligned well enough */
+ /* this is to make the union big enough for a chunk: */
+ char data[TOAST_MAX_CHUNK_SIZE + VARHDRSZ];
+ /* ensure union is aligned well enough: */
+ int32 align_it;
} chunk_data;
int32 chunk_size;
int32 chunk_seq = 0;
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;
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;
struct varlena
{
char vl_len_[4]; /* Do not touch this field directly! */
- char vl_dat[1];
+ char vl_dat[FLEXIBLE_ARRAY_MEMBER]; /* Data content is here */
};
#define VARHDRSZ ((int32) sizeof(int32))