mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
pgindent run for 9.6
This commit is contained in:
@ -82,7 +82,7 @@ text_to_bits(char *str, int len)
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||
errmsg("illegal character '%c' in t_bits string", str[off])));
|
||||
errmsg("illegal character '%c' in t_bits string", str[off])));
|
||||
|
||||
if (off % 8 == 7)
|
||||
bits[off / 8] = byte;
|
||||
@ -192,9 +192,9 @@ heap_page_items(PG_FUNCTION_ARGS)
|
||||
lp_offset == MAXALIGN(lp_offset) &&
|
||||
lp_offset + lp_len <= raw_page_size)
|
||||
{
|
||||
HeapTupleHeader tuphdr;
|
||||
bytea *tuple_data_bytea;
|
||||
int tuple_data_len;
|
||||
HeapTupleHeader tuphdr;
|
||||
bytea *tuple_data_bytea;
|
||||
int tuple_data_len;
|
||||
|
||||
/* Extract information from the tuple header */
|
||||
|
||||
@ -214,7 +214,7 @@ heap_page_items(PG_FUNCTION_ARGS)
|
||||
tuple_data_bytea = (bytea *) palloc(tuple_data_len + VARHDRSZ);
|
||||
SET_VARSIZE(tuple_data_bytea, tuple_data_len + VARHDRSZ);
|
||||
memcpy(VARDATA(tuple_data_bytea), (char *) tuphdr + tuphdr->t_hoff,
|
||||
tuple_data_len);
|
||||
tuple_data_len);
|
||||
values[13] = PointerGetDatum(tuple_data_bytea);
|
||||
|
||||
/*
|
||||
@ -284,16 +284,16 @@ heap_page_items(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
static Datum
|
||||
tuple_data_split_internal(Oid relid, char *tupdata,
|
||||
uint16 tupdata_len, uint16 t_infomask,
|
||||
uint16 t_infomask2, bits8 *t_bits,
|
||||
bool do_detoast)
|
||||
uint16 tupdata_len, uint16 t_infomask,
|
||||
uint16 t_infomask2, bits8 *t_bits,
|
||||
bool do_detoast)
|
||||
{
|
||||
ArrayBuildState *raw_attrs;
|
||||
int nattrs;
|
||||
int i;
|
||||
int off = 0;
|
||||
Relation rel;
|
||||
TupleDesc tupdesc;
|
||||
ArrayBuildState *raw_attrs;
|
||||
int nattrs;
|
||||
int i;
|
||||
int off = 0;
|
||||
Relation rel;
|
||||
TupleDesc tupdesc;
|
||||
|
||||
/* Get tuple descriptor from relation OID */
|
||||
rel = relation_open(relid, NoLock);
|
||||
@ -310,30 +310,31 @@ tuple_data_split_internal(Oid relid, char *tupdata,
|
||||
|
||||
for (i = 0; i < nattrs; i++)
|
||||
{
|
||||
Form_pg_attribute attr;
|
||||
bool is_null;
|
||||
bytea *attr_data = NULL;
|
||||
Form_pg_attribute attr;
|
||||
bool is_null;
|
||||
bytea *attr_data = NULL;
|
||||
|
||||
attr = tupdesc->attrs[i];
|
||||
is_null = (t_infomask & HEAP_HASNULL) && att_isnull(i, t_bits);
|
||||
|
||||
/*
|
||||
* Tuple header can specify less attributes than tuple descriptor
|
||||
* as ALTER TABLE ADD COLUMN without DEFAULT keyword does not
|
||||
* actually change tuples in pages, so attributes with numbers greater
|
||||
* than (t_infomask2 & HEAP_NATTS_MASK) should be treated as NULL.
|
||||
* Tuple header can specify less attributes than tuple descriptor as
|
||||
* ALTER TABLE ADD COLUMN without DEFAULT keyword does not actually
|
||||
* change tuples in pages, so attributes with numbers greater than
|
||||
* (t_infomask2 & HEAP_NATTS_MASK) should be treated as NULL.
|
||||
*/
|
||||
if (i >= (t_infomask2 & HEAP_NATTS_MASK))
|
||||
is_null = true;
|
||||
|
||||
if (!is_null)
|
||||
{
|
||||
int len;
|
||||
int len;
|
||||
|
||||
if (attr->attlen == -1)
|
||||
{
|
||||
off = att_align_pointer(off, tupdesc->attrs[i]->attalign, -1,
|
||||
tupdata + off);
|
||||
|
||||
/*
|
||||
* As VARSIZE_ANY throws an exception if it can't properly
|
||||
* detect the type of external storage in macros VARTAG_SIZE,
|
||||
@ -343,8 +344,8 @@ tuple_data_split_internal(Oid relid, char *tupdata,
|
||||
!VARATT_IS_EXTERNAL_ONDISK(tupdata + off) &&
|
||||
!VARATT_IS_EXTERNAL_INDIRECT(tupdata + off))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||
errmsg("first byte of varlena attribute is incorrect for attribute %d", i)));
|
||||
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||
errmsg("first byte of varlena attribute is incorrect for attribute %d", i)));
|
||||
|
||||
len = VARSIZE_ANY(tupdata + off);
|
||||
}
|
||||
@ -381,7 +382,7 @@ tuple_data_split_internal(Oid relid, char *tupdata,
|
||||
if (tupdata_len != off)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATA_CORRUPTED),
|
||||
errmsg("end of tuple reached without looking at all its data")));
|
||||
errmsg("end of tuple reached without looking at all its data")));
|
||||
|
||||
return makeArrayResult(raw_attrs, CurrentMemoryContext);
|
||||
}
|
||||
@ -397,14 +398,14 @@ PG_FUNCTION_INFO_V1(tuple_data_split);
|
||||
Datum
|
||||
tuple_data_split(PG_FUNCTION_ARGS)
|
||||
{
|
||||
Oid relid;
|
||||
bytea *raw_data;
|
||||
uint16 t_infomask;
|
||||
uint16 t_infomask2;
|
||||
char *t_bits_str;
|
||||
bool do_detoast = false;
|
||||
bits8 *t_bits = NULL;
|
||||
Datum res;
|
||||
Oid relid;
|
||||
bytea *raw_data;
|
||||
uint16 t_infomask;
|
||||
uint16 t_infomask2;
|
||||
char *t_bits_str;
|
||||
bool do_detoast = false;
|
||||
bits8 *t_bits = NULL;
|
||||
Datum res;
|
||||
|
||||
relid = PG_GETARG_OID(0);
|
||||
raw_data = PG_ARGISNULL(1) ? NULL : PG_GETARG_BYTEA_P(1);
|
||||
@ -430,8 +431,8 @@ tuple_data_split(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
if (t_infomask & HEAP_HASNULL)
|
||||
{
|
||||
int bits_str_len;
|
||||
int bits_len;
|
||||
int bits_str_len;
|
||||
int bits_len;
|
||||
|
||||
bits_len = (t_infomask2 & HEAP_NATTS_MASK) / 8 + 1;
|
||||
if (!t_bits_str)
|
||||
|
Reference in New Issue
Block a user