130{
141 bool unusedItem;
142
145 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
146 errmsg(
"must be superuser to use raw page functions")));
147
149
150
151
152
153
154
155
156
157
158
161 (
errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
162 errmsg(
"function has wrong number of declared columns"),
163 errhint(
"To resolve the problem, update the \"pageinspect\" extension to the latest version.")));
164
166
169 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
170 errmsg(
"\"%s\" is not a %s index",
172
174
175
177
179 {
183 }
184
185
186
187
188
190 for (attno = 1; attno <= bdesc->bd_tupdesc->natts; attno++)
191 {
193 bool isVarlena;
197
198 opcinfo = bdesc->bd_info[attno - 1];
201
204 {
207 }
208
209 columns[attno - 1] = column;
210 }
211
213 unusedItem = false;
214 dtup = NULL;
215 for (;;)
216 {
218 bool nulls[8] = {0};
219
220
221
222
223
224
225
226 if (dtup == NULL)
227 {
229
230
233 {
236 NULL);
237 attno = 1;
238 unusedItem = false;
239 }
240 else
241 unusedItem = true;
242 }
243 else
244 attno++;
245
246 if (unusedItem)
247 {
249 nulls[1] = true;
250 nulls[2] = true;
251 nulls[3] = true;
252 nulls[4] = true;
253 nulls[5] = true;
254 nulls[6] = true;
255 nulls[7] = true;
256 }
257 else
258 {
259 int att = attno - 1;
260
263 {
264 case INT8OID:
266 break;
267 case INT4OID:
268
270 break;
271 default:
273 }
279 if (!dtup->bt_columns[att].bv_allnulls)
280 {
283 bool first;
285
288
289 first = true;
290 for (
i = 0;
i < columns[att]->nstored;
i++)
291 {
293
294 if (!first)
296 first = false;
301 }
303
306 }
307 else
308 {
309 nulls[7] = true;
310 }
311 }
312
314
315
316
317
318
319
320 if (unusedItem)
322 else if (attno >= bdesc->bd_tupdesc->natts)
323 {
325 dtup = NULL;
327 }
328
329
330
331
333 break;
334 }
335
338
340}
void brin_free_desc(BrinDesc *bdesc)
BrinDesc * brin_build_desc(Relation rel)
#define BRIN_PAGETYPE_REGULAR
BrinMemTuple * brin_deform_tuple(BrinDesc *brdesc, BrinTuple *tuple, BrinMemTuple *dMemtuple)
#define BRIN_PAGE_ITEMS_V1_12
static Item PageGetItem(const PageData *page, const ItemIdData *itemId)
static ItemId PageGetItemId(Page page, OffsetNumber offsetNumber)
static OffsetNumber PageGetMaxOffsetNumber(const PageData *page)
int errhint(const char *fmt,...)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
char * OutputFunctionCall(FmgrInfo *flinfo, Datum val)
void InitMaterializedSRF(FunctionCallInfo fcinfo, bits32 flags)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
if(TABLE==NULL||TABLE_index==NULL)
#define ItemIdIsUsed(itemId)
void getTypeOutputInfo(Oid type, Oid *typOutput, bool *typIsVarlena)
void pfree(void *pointer)
#define OffsetNumberNext(offsetNumber)
#define FirstOffsetNumber
static Datum UInt16GetDatum(uint16 X)
static Datum BoolGetDatum(bool X)
static Datum UInt32GetDatum(uint32 X)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
void appendStringInfoString(StringInfo str, const char *s)
void appendStringInfoChar(StringInfo str, char ch)
void initStringInfo(StringInfo str)
TypeCacheEntry * oi_typcache[FLEXIBLE_ARRAY_MEMBER]
Tuplestorestate * setResult
FmgrInfo outputFn[FLEXIBLE_ARRAY_MEMBER]
static FormData_pg_attribute * TupleDescAttr(TupleDesc tupdesc, int i)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, const Datum *values, const bool *isnull)