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

1

2

3

4

5

6

7

8

9

10

11

12

13

14

16

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

61{

64 int cleanLength;

66

67

68

69

71

72

73

74

75 if (slot)

77 else

79

80

81

82

83

84

85

86

87

88

89

90 cleanLength = cleanTupType->natts;

91 if (cleanLength > 0)

92 {

95

97 cleanResno = 0;

98 foreach(t, targetList)

99 {

101

102 if (!tle->resjunk)

103 {

104 cleanMap[cleanResno] = tle->resno;

105 cleanResno++;

106 }

107 }

108 Assert(cleanResno == cleanLength);

109 }

110 else

111 cleanMap = NULL;

112

113

114

115

117

122

123 return junkfilter;

124}

125

126

127

128

129

130

131

132

133

134

135

140{

142 int cleanLength;

145 int i;

146

147

148

149

150 if (slot)

152 else

154

155

156

157

158

159

160

161

162

163

164

165 cleanLength = cleanTupType->natts;

166 if (cleanLength > 0)

167 {

170 for (i = 0; i < cleanLength; i++)

171 {

173 continue;

174 for (;;)

175 {

177

178 t = lnext(targetList, t);

179 if (!tle->resjunk)

180 {

181 cleanMap[i] = tle->resno;

182 break;

183 }

184 }

185 }

186 }

187 else

188 cleanMap = NULL;

189

190

191

192

194

199

200 return junkfilter;

201}

202

203

204

205

206

207

208

211{

213}

214

215

216

217

218

219

220

223{

225

226 foreach(t, targetlist)

227 {

229

230 if (tle->resjunk && tle->resname &&

231 (strcmp(tle->resname, attrName) == 0))

232 {

233

234 return tle->resno;

235 }

236 }

237

239}

240

241

242

243

244

245

248{

252 int cleanLength;

253 int i;

255 bool *isnull;

256 Datum *old_values;

257 bool *old_isnull;

258

259

260

261

265

266

267

268

270 cleanLength = cleanTupType->natts;

273

274

275

276

280

281

282

283

284 for (i = 0; i < cleanLength; i++)

285 {

286 int j = cleanMap[i];

287

288 if (j == 0)

289 {

291 isnull[i] = true;

292 }

293 else

294 {

295 values[i] = old_values[j - 1];

296 isnull[i] = old_isnull[j - 1];

297 }

298 }

299

300

301

302

304}

#define InvalidAttrNumber

static Datum values[MAXATTR]

JunkFilter * ExecInitJunkFilterConversion(List *targetList, TupleDesc cleanTupType, TupleTableSlot *slot)

TupleTableSlot * ExecFilterJunk(JunkFilter *junkfilter, TupleTableSlot *slot)

AttrNumber ExecFindJunkAttributeInTlist(List *targetlist, const char *attrName)

JunkFilter * ExecInitJunkFilter(List *targetList, TupleTableSlot *slot)

AttrNumber ExecFindJunkAttribute(JunkFilter *junkfilter, const char *attrName)

TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)

const TupleTableSlotOps TTSOpsVirtual

TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)

TupleDesc ExecCleanTypeFromTL(List *targetList)

void ExecSetSlotDescriptor(TupleTableSlot *slot, TupleDesc tupdesc)

Assert(PointerIsAligned(start, uint64))

void * palloc0(Size size)

static ListCell * list_head(const List *l)

static ListCell * lnext(const List *l, const ListCell *c)

TupleDesc jf_cleanTupType

TupleTableSlot * jf_resultSlot

static CompactAttribute * TupleDescCompactAttr(TupleDesc tupdesc, int i)

static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)

static void slot_getallattrs(TupleTableSlot *slot)