PostgreSQL Source Code: src/backend/access/hash/hashvalidate.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

15

29

30

31

32

33

34

35

36

37

38

39bool

41{

42 bool result = true;

45 Oid opfamilyoid;

46 Oid opcintype;

47 char *opclassname;

48 char *opfamilyname;

50 *oprlist;

51 List *grouplist;

53 List *hashabletypes = NIL;

54 int i;

56

57

60 elog(ERROR, "cache lookup failed for operator class %u", opclassoid);

62

63 opfamilyoid = classform->opcfamily;

64 opcintype = classform->opcintype;

65 opclassname = NameStr(classform->opcname);

66

67

69

70

73

74

76 {

79 bool ok;

80

81

82

83

84

85 if (procform->amproclefttype != procform->amprocrighttype)

86 {

88 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

89 errmsg("operator family \"%s\" of access method %s contains support function %s with different left and right input types",

90 opfamilyname, "hash",

92 result = false;

93 }

94

95

96 switch (procform->amprocnum)

97 {

100 1, 1, procform->amproclefttype);

101 break;

104 2, 2, procform->amproclefttype, INT8OID);

105 break;

108 break;

109 default:

111 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

112 errmsg("operator family \"%s\" of access method %s contains function %s with invalid support number %d",

113 opfamilyname, "hash",

115 procform->amprocnum)));

116 result = false;

117 continue;

118 }

119

120 if (!ok)

121 {

123 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

124 errmsg("operator family \"%s\" of access method %s contains function %s with wrong signature for support number %d",

125 opfamilyname, "hash",

127 procform->amprocnum)));

128 result = false;

129 }

130

131

133 {

135 }

136 }

137

138

140 {

143

144

145 if (oprform->amopstrategy < 1 ||

147 {

149 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

150 errmsg("operator family \"%s\" of access method %s contains operator %s with invalid strategy number %d",

151 opfamilyname, "hash",

153 oprform->amopstrategy)));

154 result = false;

155 }

156

157

158 if (oprform->amoppurpose != AMOP_SEARCH ||

160 {

162 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

163 errmsg("operator family \"%s\" of access method %s contains invalid ORDER BY specification for operator %s",

164 opfamilyname, "hash",

166 result = false;

167 }

168

169

171 oprform->amoplefttype,

172 oprform->amoprighttype))

173 {

175 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

176 errmsg("operator family \"%s\" of access method %s contains operator %s with wrong signature",

177 opfamilyname, "hash",

179 result = false;

180 }

181

182

183 if (list\_member\_oid(hashabletypes, oprform->amoplefttype) ||

185 {

187 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

188 errmsg("operator family \"%s\" of access method %s lacks support function for operator %s",

189 opfamilyname, "hash",

191 result = false;

192 }

193 }

194

195

197 opclassgroup = NULL;

198 foreach(lc, grouplist)

199 {

201

202

203 if (thisgroup->lefttype == opcintype &&

204 thisgroup->righttype == opcintype)

205 opclassgroup = thisgroup;

206

207

208

209

210

211

213 {

215 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

216 errmsg("operator family \"%s\" of access method %s is missing operator(s) for types %s and %s",

217 opfamilyname, "hash",

220 result = false;

221 }

222 }

223

224

225

226 if (!opclassgroup)

227 {

229 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

230 errmsg("operator class \"%s\" of access method %s is missing operator(s)",

231 opclassname, "hash")));

232 result = false;

233 }

234

235

236

237

238

239

240

243 {

245 (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),

246 errmsg("operator family \"%s\" of access method %s is missing cross-type operator(s)",

247 opfamilyname, "hash")));

248 result = false;

249 }

250

254

255 return result;

256}

257

258

259

260

261

262void

264 Oid opclassoid,

265 List *operators,

267{

268 Oid opcintype;

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

293 {

294

297 }

298 else

300

301

302

303

304

306 {

308

310 {

311

315 }

317 {

318

322 }

323 else

324 {

325

326 if (op->lefttype != opcintype)

327 {

328

331 opfamilyoid,

332 opcintype);

333 }

335 {

336

340 }

341 else

342 {

343

347 }

348 }

349 }

350}

Oid opclass_for_family_datatype(Oid amoid, Oid opfamilyoid, Oid datatypeoid)

bool check_amproc_signature(Oid funcid, Oid restype, bool exact, int minargs, int maxargs,...)

bool check_amop_signature(Oid opno, Oid restype, Oid lefttype, Oid righttype)

List * identify_opfamily_groups(CatCList *oprlist, CatCList *proclist)

bool check_amoptsproc_signature(Oid funcid)

#define OidIsValid(objectId)

void ReleaseCatCacheList(CatCList *list)

int errcode(int sqlerrcode)

int errmsg(const char *fmt,...)

#define ereport(elevel,...)

char * format_type_be(Oid type_oid)

#define HASHSTANDARD_PROC

#define HASHEXTENDED_PROC

void hashadjustmembers(Oid opfamilyoid, Oid opclassoid, List *operators, List *functions)

bool hashvalidate(Oid opclassoid)

#define HeapTupleIsValid(tuple)

static void * GETSTRUCT(const HeapTupleData *tuple)

List * list_concat_copy(const List *list1, const List *list2)

List * list_append_unique_oid(List *list, Oid datum)

bool list_member_oid(const List *list, Oid datum)

Oid get_opclass_input_type(Oid opclass)

char * get_opfamily_name(Oid opfid, bool missing_ok)

FormData_pg_amop * Form_pg_amop

FormData_pg_amproc * Form_pg_amproc

static int list_length(const List *l)

FormData_pg_opclass * Form_pg_opclass

static Datum ObjectIdGetDatum(Oid X)

static const struct fns functions

char * format_procedure(Oid procedure_oid)

char * format_operator(Oid operator_oid)

#define HTMaxStrategyNumber

#define HTEqualStrategyNumber

CatCTup * members[FLEXIBLE_ARRAY_MEMBER]

void ReleaseSysCache(HeapTuple tuple)

HeapTuple SearchSysCache1(int cacheId, Datum key1)

#define SearchSysCacheList1(cacheId, key1)

void CommandCounterIncrement(void)