PostgreSQL Source Code: src/backend/executor/nodeTidscan.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

24

35

36

37

38

39

40

41

42

43#define IsCTIDVar(node) \

44 ((node) != NULL && \

45 IsA((node), Var) && \

46 ((Var *) (node))->varattno == SelfItemPointerAttributeNumber)

47

48

50{

52 bool isarray;

55

60

61

62

63

64

65

66

67

68

69static void

71{

74

77

79 {

82

84 {

87

92 &tidstate->ss.ps);

95 &tidstate->ss.ps);

96 else

97 elog(ERROR, "could not identify CTID variable");

99 }

101 {

103

106 &tidstate->ss.ps);

108 }

110 {

112

113 tidexpr->cexpr = cexpr;

115 }

116 else

117 elog(ERROR, "could not identify CTID expression");

118

120 }

121

122

125}

126

127

128

129

130

131

132

133static void

135{

139 int numAllocTids;

140 int numTids;

142

143

144

145

146

147

153

154

155

156

157

158

162 numTids = 0;

163

165 {

168 bool isNull;

169

171 {

174 econtext,

175 &isNull));

176 if (isNull)

177 continue;

178

179

180

181

182

183

184

185

187 continue;

188

189 if (numTids >= numAllocTids)

190 {

191 numAllocTids *= 2;

195 }

196 tidList[numTids++] = *itemptr;

197 }

199 {

200 Datum arraydatum;

203 bool *ipnulls;

204 int ndatums;

205 int i;

206

208 econtext,

209 &isNull);

210 if (isNull)

211 continue;

214 if (numTids + ndatums > numAllocTids)

215 {

216 numAllocTids = numTids + ndatums;

220 }

221 for (i = 0; i < ndatums; i++)

222 {

223 if (ipnulls[i])

224 continue;

225

227

229 continue;

230

231 tidList[numTids++] = *itemptr;

232 }

235 }

236 else

237 {

239

243 &cursor_tid))

244 {

245 if (numTids >= numAllocTids)

246 {

247 numAllocTids *= 2;

251 }

252 tidList[numTids++] = cursor_tid;

253 }

254 }

255 }

256

257

258

259

260

261

262

263 if (numTids > 1)

264 {

265

267

272 }

273

277}

278

279

280

281

282static int

284{

291

292 if (ba < bb)

293 return -1;

294 if (ba > bb)

295 return 1;

296 if (oa < ob)

297 return -1;

298 if (oa > ob)

299 return 1;

300 return 0;

301}

302

303

304

305

306

307

308

309

310

313{

321 int numTids;

322 bool bBackward;

323

324

325

326

332

333

334

335

338

342

343

344

345

347 if (bBackward)

348 {

350 {

351

353 }

354 else

356 }

357 else

358 {

360 {

361

363 }

364 else

366 }

367

369 {

371

372

373

374

375

376

379

381 return slot;

382

383

384 if (bBackward)

386 else

388

390 }

391

392

393

394

395

397}

398

399

400

401

402static bool

404{

405

406

407

408

409

410 return true;

411}

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

434{

436

440}

441

442

443

444

445

446void

448{

454

455

458

460}

461

462

463

464

465

466

467

468

469void

471{

474}

475

476

477

478

479

480

481

482

483

484

485

486

489{

492

493

494

495

500

501

502

503

504

505

507

508

509

510

514

515

516

517

519

522

523

524

525

529

530

531

532

535

536

537

538

541

543

544

545

546

547 return tidstate;

548}

#define DatumGetArrayTypeP(X)

void deconstruct_array_builtin(ArrayType *array, Oid elmtype, Datum **elemsp, bool **nullsp, int *nelemsp)

bool execCurrentOf(CurrentOfExpr *cexpr, ExprContext *econtext, Oid table_oid, ItemPointer current_tid)

ExprState * ExecInitExpr(Expr *node, PlanState *parent)

ExprState * ExecInitQual(List *qual, PlanState *parent)

TupleTableSlot * ExecScan(ScanState *node, ExecScanAccessMtd accessMtd, ExecScanRecheckMtd recheckMtd)

void ExecAssignScanProjectionInfo(ScanState *node)

void ExecScanReScan(ScanState *node)

void ExecInitScanTupleSlot(EState *estate, ScanState *scanstate, TupleDesc tupledesc, const TupleTableSlotOps *tts_ops)

void ExecInitResultTypeTL(PlanState *planstate)

void ExecAssignExprContext(EState *estate, PlanState *planstate)

Relation ExecOpenScanRelation(EState *estate, Index scanrelid, int eflags)

bool(* ExecScanRecheckMtd)(ScanState *node, TupleTableSlot *slot)

TupleTableSlot *(* ExecScanAccessMtd)(ScanState *node)

static Datum ExecEvalExprSwitchContext(ExprState *state, ExprContext *econtext, bool *isNull)

Assert(PointerIsAligned(start, uint64))

static OffsetNumber ItemPointerGetOffsetNumber(const ItemPointerData *pointer)

static BlockNumber ItemPointerGetBlockNumber(const ItemPointerData *pointer)

ItemPointerData * ItemPointer

List * lappend(List *list, void *datum)

void * repalloc(void *pointer, Size size)

void pfree(void *pointer)

void * palloc0(Size size)

#define CHECK_FOR_INTERRUPTS()

static Node * get_rightop(const void *clause)

static bool is_opclause(const void *clause)

static Node * get_leftop(const void *clause)

static TupleTableSlot * ExecTidScan(PlanState *pstate)

static int itemptr_comparator(const void *a, const void *b)

TidScanState * ExecInitTidScan(TidScan *node, EState *estate, int eflags)

static bool TidRecheck(TidScanState *node, TupleTableSlot *slot)

void ExecEndTidScan(TidScanState *node)

void ExecReScanTidScan(TidScanState *node)

static void TidListEval(TidScanState *tidstate)

static TupleTableSlot * TidNext(TidScanState *node)

static void TidExprListCreate(TidScanState *tidstate)

#define IsA(nodeptr, _type_)

#define castNode(_type_, nodeptr)

static int list_length(const List *l)

#define qsort(a, b, c, d)

static Pointer DatumGetPointer(Datum X)

static size_t qunique(void *array, size_t elements, size_t width, int(*compare)(const void *, const void *))

#define RelationGetRelid(relation)

#define RelationGetDescr(relation)

#define ScanDirectionIsBackward(direction)

ScanDirection es_direction

ExprContext * ps_ExprContext

ExecProcNodeMtd ExecProcNode

Relation ss_currentRelation

TupleTableSlot * ss_ScanTupleSlot

struct TableScanDescData * ss_currentScanDesc

ItemPointerData * tss_TidList

void table_tuple_get_latest_tid(TableScanDesc scan, ItemPointer tid)

const TupleTableSlotOps * table_slot_callbacks(Relation relation)

static void table_endscan(TableScanDesc scan)

static void table_rescan(TableScanDesc scan, struct ScanKeyData *key)

static bool table_tuple_tid_valid(TableScanDesc scan, ItemPointer tid)

static bool table_tuple_fetch_row_version(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot)

static TableScanDesc table_beginscan_tid(Relation rel, Snapshot snapshot)

static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)