PostgreSQL Source Code: src/backend/utils/adt/enum.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
15
24#include "utils/fmgroids.h"
27
28
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
59
60
61
62static void
64{
67
68
69
70
71
73 return;
74
75
76
77
78
82 return;
83
84
85
86
87
88
89
91 return;
92
93
94
95
96
99 errmsg("unsafe use of new value \"%s\" of enum type %s",
102 errhint("New enum values must be committed before they can be used.")));
103}
104
105
106
107
110{
113 Node *escontext = fcinfo->context;
116
117
121 errmsg("invalid input value for enum %s: \"%s\"",
124
131 errmsg("invalid input value for enum %s: \"%s\"",
134
135
136
137
138
139
140
142
143
144
145
146
148
150
152}
153
156{
158 char *result;
161
166 errmsg("invalid internal value for enum: %u",
167 enumval)));
169
171
173
175}
176
177
180{
186 int nbytes;
187
189
190
194 errmsg("invalid input value for enum %s: \"%s\"",
197
204 errmsg("invalid input value for enum %s: \"%s\"",
207
208
210
212
214
216
218}
219
222{
227
232 errmsg("invalid internal value for enum: %u",
233 enumval)));
235
238
240
242}
243
244
245
246
247
248
249
250
251static int
253{
255
256
257
258
259
260
261
262
264
265
267 return 0;
268
269
270 if ((arg1 & 1) == 0 && (arg2 & 1) == 0)
271 {
273 return -1;
274 else
275 return 1;
276 }
277
278
280 if (tcache == NULL)
281 {
284 Oid typeoid;
285
286
291 errmsg("invalid internal value for enum: %u",
294 typeoid = en->enumtypid;
296
299 }
300
301
303}
304
313
322
331
340
349
358
367
376
385
386
387
388
389
390
391static Oid
393{
399 Oid minmax;
400
401
402
403
404
405
410
415
418 {
419
422 }
423 else
424 {
425
427 }
428
432
433 return minmax;
434}
435
438{
441
442
443
444
445
446
451 errmsg("could not determine actual enum type")));
452
453
455
459 errmsg("enum %s contains no values",
461
463}
464
467{
470
471
472
473
474
475
480 errmsg("could not determine actual enum type")));
481
482
484
488 errmsg("enum %s contains no values",
490
492}
493
494
497{
501
504 else
508 else
510
511
512
513
514
515
520 errmsg("could not determine actual enum type")));
521
523}
524
525
528{
530
531
532
533
534
535
540 errmsg("could not determine actual enum type")));
541
544}
545
548{
556 int max,
557 cnt;
559
560
561
562
563
564
569
573
574 max = 64;
576 cnt = 0;
578
580 {
582
585
587 {
588
590
591 if (cnt >= max)
592 {
593 max *= 2;
595 }
596
598 }
599
601 break;
602 }
603
607
608
609
612
614
615 return result;
616}
#define PG_RETURN_ARRAYTYPE_P(x)
ArrayType * construct_array(Datum *elems, int nelems, Oid elmtype, int elmlen, bool elmbyval, char elmalign)
#define Assert(condition)
#define OidIsValid(objectId)
int errcode(int sqlerrcode)
#define ereturn(context, dummy_value,...)
int errhint(const char *fmt,...) pg_attribute_printf(1
#define ereport(elevel,...)
Datum enum_range_all(PG_FUNCTION_ARGS)
Datum enum_last(PG_FUNCTION_ARGS)
static void check_safe_enum_use(HeapTuple enumval_tup)
Datum enum_gt(PG_FUNCTION_ARGS)
Datum enum_first(PG_FUNCTION_ARGS)
static Oid enum_endpoint(Oid enumtypoid, ScanDirection direction)
Datum enum_smaller(PG_FUNCTION_ARGS)
Datum enum_lt(PG_FUNCTION_ARGS)
Datum enum_cmp(PG_FUNCTION_ARGS)
Datum enum_eq(PG_FUNCTION_ARGS)
Datum enum_range_bounds(PG_FUNCTION_ARGS)
Datum enum_send(PG_FUNCTION_ARGS)
static ArrayType * enum_range_internal(Oid enumtypoid, Oid lower, Oid upper)
Datum enum_ge(PG_FUNCTION_ARGS)
Datum enum_in(PG_FUNCTION_ARGS)
Datum enum_recv(PG_FUNCTION_ARGS)
static int enum_cmp_internal(Oid arg1, Oid arg2, FunctionCallInfo fcinfo)
Datum enum_out(PG_FUNCTION_ARGS)
Datum enum_larger(PG_FUNCTION_ARGS)
Datum enum_le(PG_FUNCTION_ARGS)
Datum enum_ne(PG_FUNCTION_ARGS)
Oid get_fn_expr_argtype(FmgrInfo *flinfo, int argnum)
#define PG_RETURN_BYTEA_P(x)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_CSTRING(n)
#define PG_RETURN_INT32(x)
#define PG_RETURN_BOOL(x)
char * format_type_be(Oid type_oid)
SysScanDesc systable_beginscan_ordered(Relation heapRelation, Relation indexRelation, Snapshot snapshot, int nkeys, ScanKey key)
void systable_endscan_ordered(SysScanDesc sysscan)
HeapTuple systable_getnext_ordered(SysScanDesc sysscan, ScanDirection direction)
#define HeapTupleIsValid(tuple)
static TransactionId HeapTupleHeaderGetXmin(const HeapTupleHeaderData *tup)
static void * GETSTRUCT(const HeapTupleData *tuple)
static bool HeapTupleHeaderXminCommitted(const HeapTupleHeaderData *tup)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
char * pstrdup(const char *in)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
Datum lower(PG_FUNCTION_ARGS)
Datum upper(PG_FUNCTION_ARGS)
bool EnumUncommitted(Oid enum_id)
END_CATALOG_STRUCT typedef FormData_pg_enum * Form_pg_enum
static char buf[DEFAULT_XLOG_SEG_SIZE]
static Datum ObjectIdGetDatum(Oid X)
static Datum CStringGetDatum(const char *X)
void pq_sendtext(StringInfo buf, const char *str, int slen)
char * pq_getmsgtext(StringInfo msg, int rawbytes, int *nbytes)
void pq_begintypsend(StringInfo buf)
bytea * pq_endtypsend(StringInfo buf)
bool TransactionIdIsInProgress(TransactionId xid)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define BTEqualStrategyNumber
struct StringInfoData * StringInfo
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache2(SysCacheIdentifier cacheId, Datum key1, Datum key2)
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
bool TransactionIdDidCommit(TransactionId transactionId)
int compare_values_of_enum(TypeCacheEntry *tcache, Oid arg1, Oid arg2)
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)