PostgreSQL Source Code  git master
encode.c File Reference
#include "postgres.h"
#include <ctype.h>
#include "mb/pg_wchar.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "varatt.h"
Include dependency graph for encode.c:

Go to the source code of this file.

Data Structures

struct  pg_encoding
 

Macros

#define VAL(CH)   ((CH) - '0')
 
#define DIG(VAL)   ((VAL) + '0')
 

Functions

static const struct pg_encodingpg_find_encoding (const char *name)
 
Datum binary_encode (PG_FUNCTION_ARGS)
 
Datum binary_decode (PG_FUNCTION_ARGS)
 
uint64 hex_encode (const char *src, size_t len, char *dst)
 
static bool get_hex (const char *cp, char *out)
 
uint64 hex_decode (const char *src, size_t len, char *dst)
 
uint64 hex_decode_safe (const char *src, size_t len, char *dst, Node *escontext)
 
static uint64 hex_enc_len (const char *src, size_t srclen)
 
static uint64 hex_dec_len (const char *src, size_t srclen)
 
static uint64 pg_base64_encode (const char *src, size_t len, char *dst)
 
static uint64 pg_base64_decode (const char *src, size_t len, char *dst)
 
static uint64 pg_base64_enc_len (const char *src, size_t srclen)
 
static uint64 pg_base64_dec_len (const char *src, size_t srclen)
 
static uint64 esc_encode (const char *src, size_t srclen, char *dst)
 
static uint64 esc_decode (const char *src, size_t srclen, char *dst)
 
static uint64 esc_enc_len (const char *src, size_t srclen)
 
static uint64 esc_dec_len (const char *src, size_t srclen)
 

Variables

static const char hextbl [] = "0123456789abcdef"
 
static const int8 hexlookup [128]
 
static const char _base64 []
 
static const int8 b64lookup [128]
 
struct {
   const char *   name
 
   struct pg_encoding   enc
 
enclist []
 

Macro Definition Documentation

◆ DIG

#define DIG (   VAL)    ((VAL) + '0')

Definition at line 412 of file encode.c.

◆ VAL

#define VAL (   CH)    ((CH) - '0')

Definition at line 411 of file encode.c.

Function Documentation

◆ binary_decode()

Datum binary_decode ( PG_FUNCTION_ARGS  )

Definition at line 96 of file encode.c.

97 {
100  bytea *result;
101  char *namebuf;
102  char *dataptr;
103  size_t datalen;
104  uint64 resultlen;
105  uint64 res;
106  const struct pg_encoding *enc;
107 
108  namebuf = TextDatumGetCString(name);
109 
110  enc = pg_find_encoding(namebuf);
111  if (enc == NULL)
112  ereport(ERROR,
113  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
114  errmsg("unrecognized encoding: \"%s\"", namebuf)));
115 
116  dataptr = VARDATA_ANY(data);
117  datalen = VARSIZE_ANY_EXHDR(data);
118 
119  resultlen = enc->decode_len(dataptr, datalen);
120 
121  /*
122  * resultlen possibly overflows uint32, therefore on 32-bit machines it's
123  * unsafe to rely on palloc's internal check.
124  */
125  if (resultlen > MaxAllocSize - VARHDRSZ)
126  ereport(ERROR,
127  (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
128  errmsg("result of decoding conversion is too large")));
129 
130  result = palloc(VARHDRSZ + resultlen);
131 
132  res = enc->decode(dataptr, datalen, VARDATA(result));
133 
134  /* Make this FATAL 'cause we've trodden on memory ... */
135  if (res > resultlen)
136  elog(FATAL, "overflow - decode estimate too small");
137 
138  SET_VARSIZE(result, VARHDRSZ + res);
139 
140  PG_RETURN_BYTEA_P(result);
141 }
#define TextDatumGetCString(d)
Definition: builtins.h:95
#define VARHDRSZ
Definition: c.h:676
int errcode(int sqlerrcode)
Definition: elog.c:858
int errmsg(const char *fmt,...)
Definition: elog.c:1069
#define FATAL
Definition: elog.h:41
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
static const struct pg_encoding * pg_find_encoding(const char *name)
Definition: encode.c:603
const char * name
Definition: encode.c:571
struct pg_encoding enc
Definition: encode.c:572
#define PG_GETARG_TEXT_PP(n)
Definition: fmgr.h:309
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:371
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:268
void * palloc(Size size)
Definition: mcxt.c:1210
#define MaxAllocSize
Definition: memutils.h:40
const void * data
uintptr_t Datum
Definition: postgres.h:64
uint64(* decode_len)(const char *data, size_t dlen)
Definition: encode.c:36
uint64(* decode)(const char *data, size_t dlen, char *res)
Definition: encode.c:38
Definition: c.h:671
#define VARDATA(PTR)
Definition: varatt.h:278
#define VARDATA_ANY(PTR)
Definition: varatt.h:324
#define SET_VARSIZE(PTR, len)
Definition: varatt.h:305
#define VARSIZE_ANY_EXHDR(PTR)
Definition: varatt.h:317

References data, pg_encoding::decode, pg_encoding::decode_len, elog(), enc, ereport, errcode(), errmsg(), ERROR, FATAL, MaxAllocSize, name, palloc(), pg_find_encoding(), PG_GETARG_DATUM, PG_GETARG_TEXT_PP, PG_RETURN_BYTEA_P, res, SET_VARSIZE, TextDatumGetCString, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

◆ binary_encode()

Datum binary_encode ( PG_FUNCTION_ARGS  )

Definition at line 48 of file encode.c.

49 {
52  text *result;
53  char *namebuf;
54  char *dataptr;
55  size_t datalen;
56  uint64 resultlen;
57  uint64 res;
58  const struct pg_encoding *enc;
59 
60  namebuf = TextDatumGetCString(name);
61 
62  enc = pg_find_encoding(namebuf);
63  if (enc == NULL)
64  ereport(ERROR,
65  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
66  errmsg("unrecognized encoding: \"%s\"", namebuf)));
67 
68  dataptr = VARDATA_ANY(data);
69  datalen = VARSIZE_ANY_EXHDR(data);
70 
71  resultlen = enc->encode_len(dataptr, datalen);
72 
73  /*
74  * resultlen possibly overflows uint32, therefore on 32-bit machines it's
75  * unsafe to rely on palloc's internal check.
76  */
77  if (resultlen > MaxAllocSize - VARHDRSZ)
78  ereport(ERROR,
79  (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
80  errmsg("result of encoding conversion is too large")));
81 
82  result = palloc(VARHDRSZ + resultlen);
83 
84  res = enc->encode(dataptr, datalen, VARDATA(result));
85 
86  /* Make this FATAL 'cause we've trodden on memory ... */
87  if (res > resultlen)
88  elog(FATAL, "overflow - encode estimate too small");
89 
90  SET_VARSIZE(result, VARHDRSZ + res);
91 
92  PG_RETURN_TEXT_P(result);
93 }
#define PG_GETARG_BYTEA_PP(n)
Definition: fmgr.h:308
#define PG_RETURN_TEXT_P(x)
Definition: fmgr.h:372
uint64(* encode_len)(const char *data, size_t dlen)
Definition: encode.c:35
uint64(* encode)(const char *data, size_t dlen, char *res)
Definition: encode.c:37

References data, elog(), enc, pg_encoding::encode, pg_encoding::encode_len, ereport, errcode(), errmsg(), ERROR, FATAL, MaxAllocSize, name, palloc(), pg_find_encoding(), PG_GETARG_BYTEA_PP, PG_GETARG_DATUM, PG_RETURN_TEXT_P, res, SET_VARSIZE, TextDatumGetCString, VARDATA, VARDATA_ANY, VARHDRSZ, and VARSIZE_ANY_EXHDR.

◆ esc_dec_len()

static uint64 esc_dec_len ( const char *  src,
size_t  srclen 
)
static

Definition at line 523 of file encode.c.

524 {
525  const char *end = src + srclen;
526  uint64 len = 0;
527 
528  while (src < end)
529  {
530  if (src[0] != '\\')
531  src++;
532  else if (src + 3 < end &&
533  (src[1] >= '0' && src[1] <= '3') &&
534  (src[2] >= '0' && src[2] <= '7') &&
535  (src[3] >= '0' && src[3] <= '7'))
536  {
537  /*
538  * backslash + valid octal
539  */
540  src += 4;
541  }
542  else if (src + 1 < end &&
543  (src[1] == '\\'))
544  {
545  /*
546  * two backslashes = backslash
547  */
548  src += 2;
549  }
550  else
551  {
552  /*
553  * one backslash, not followed by ### valid octal
554  */
555  ereport(ERROR,
556  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
557  errmsg("invalid input syntax for type %s", "bytea")));
558  }
559 
560  len++;
561  }
562  return len;
563 }
const void size_t len

References ereport, errcode(), errmsg(), ERROR, and len.

◆ esc_decode()

static uint64 esc_decode ( const char *  src,
size_t  srclen,
char *  dst 
)
static

Definition at line 454 of file encode.c.

455 {
456  const char *end = src + srclen;
457  char *rp = dst;
458  uint64 len = 0;
459 
460  while (src < end)
461  {
462  if (src[0] != '\\')
463  *rp++ = *src++;
464  else if (src + 3 < end &&
465  (src[1] >= '0' && src[1] <= '3') &&
466  (src[2] >= '0' && src[2] <= '7') &&
467  (src[3] >= '0' && src[3] <= '7'))
468  {
469  int val;
470 
471  val = VAL(src[1]);
472  val <<= 3;
473  val += VAL(src[2]);
474  val <<= 3;
475  *rp++ = val + VAL(src[3]);
476  src += 4;
477  }
478  else if (src + 1 < end &&
479  (src[1] == '\\'))
480  {
481  *rp++ = '\\';
482  src += 2;
483  }
484  else
485  {
486  /*
487  * One backslash, not followed by ### valid octal. Should never
488  * get here, since esc_dec_len does same check.
489  */
490  ereport(ERROR,
491  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
492  errmsg("invalid input syntax for type %s", "bytea")));
493  }
494 
495  len++;
496  }
497 
498  return len;
499 }
#define VAL(CH)
Definition: encode.c:411
long val
Definition: informix.c:664

References ereport, errcode(), errmsg(), ERROR, len, VAL, and val.

◆ esc_enc_len()

static uint64 esc_enc_len ( const char *  src,
size_t  srclen 
)
static

Definition at line 502 of file encode.c.

503 {
504  const char *end = src + srclen;
505  uint64 len = 0;
506 
507  while (src < end)
508  {
509  if (*src == '\0' || IS_HIGHBIT_SET(*src))
510  len += 4;
511  else if (*src == '\\')
512  len += 2;
513  else
514  len++;
515 
516  src++;
517  }
518 
519  return len;
520 }
#define IS_HIGHBIT_SET(ch)
Definition: c.h:1145

References IS_HIGHBIT_SET, and len.

◆ esc_encode()

static uint64 esc_encode ( const char *  src,
size_t  srclen,
char *  dst 
)
static

Definition at line 415 of file encode.c.

416 {
417  const char *end = src + srclen;
418  char *rp = dst;
419  uint64 len = 0;
420 
421  while (src < end)
422  {
423  unsigned char c = (unsigned char) *src;
424 
425  if (c == '\0' || IS_HIGHBIT_SET(c))
426  {
427  rp[0] = '\\';
428  rp[1] = DIG(c >> 6);
429  rp[2] = DIG((c >> 3) & 7);
430  rp[3] = DIG(c & 7);
431  rp += 4;
432  len += 4;
433  }
434  else if (c == '\\')
435  {
436  rp[0] = '\\';
437  rp[1] = '\\';
438  rp += 2;
439  len += 2;
440  }
441  else
442  {
443  *rp++ = c;
444  len++;
445  }
446 
447  src++;
448  }
449 
450  return len;
451 }
#define DIG(VAL)
Definition: encode.c:412
char * c

References DIG, IS_HIGHBIT_SET, and len.

◆ get_hex()

static bool get_hex ( const char *  cp,
char *  out 
)
inlinestatic

Definition at line 176 of file encode.c.

177 {
178  unsigned char c = (unsigned char) *cp;
179  int res = -1;
180 
181  if (c < 127)
182  res = hexlookup[c];
183 
184  *out = (char) res;
185 
186  return (res >= 0);
187 }
static const int8 hexlookup[128]
Definition: encode.c:150

References hexlookup, and res.

Referenced by hex_decode_safe().

◆ hex_dec_len()

static uint64 hex_dec_len ( const char *  src,
size_t  srclen 
)
static

Definition at line 243 of file encode.c.

244 {
245  return (uint64) srclen >> 1;
246 }

◆ hex_decode()

uint64 hex_decode ( const char *  src,
size_t  len,
char *  dst 
)

Definition at line 190 of file encode.c.

191 {
192  return hex_decode_safe(src, len, dst, NULL);
193 }
uint64 hex_decode_safe(const char *src, size_t len, char *dst, Node *escontext)
Definition: encode.c:196

References hex_decode_safe(), and len.

◆ hex_decode_safe()

uint64 hex_decode_safe ( const char *  src,
size_t  len,
char *  dst,
Node escontext 
)

Definition at line 196 of file encode.c.

197 {
198  const char *s,
199  *srcend;
200  char v1,
201  v2,
202  *p;
203 
204  srcend = src + len;
205  s = src;
206  p = dst;
207  while (s < srcend)
208  {
209  if (*s == ' ' || *s == '\n' || *s == '\t' || *s == '\r')
210  {
211  s++;
212  continue;
213  }
214  if (!get_hex(s, &v1))
215  ereturn(escontext, 0,
216  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
217  errmsg("invalid hexadecimal digit: \"%.*s\"",
218  pg_mblen(s), s)));
219  s++;
220  if (s >= srcend)
221  ereturn(escontext, 0,
222  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
223  errmsg("invalid hexadecimal data: odd number of digits")));
224  if (!get_hex(s, &v2))
225  ereturn(escontext, 0,
226  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
227  errmsg("invalid hexadecimal digit: \"%.*s\"",
228  pg_mblen(s), s)));
229  s++;
230  *p++ = (v1 << 4) | v2;
231  }
232 
233  return p - dst;
234 }
#define ereturn(context, dummy_value,...)
Definition: elog.h:276
static bool get_hex(const char *cp, char *out)
Definition: encode.c:176
int pg_mblen(const char *mbstr)
Definition: mbutils.c:1024

References ereturn, errcode(), errmsg(), get_hex(), len, and pg_mblen().

Referenced by byteain(), and hex_decode().

◆ hex_enc_len()

static uint64 hex_enc_len ( const char *  src,
size_t  srclen 
)
static

Definition at line 237 of file encode.c.

238 {
239  return (uint64) srclen << 1;
240 }

◆ hex_encode()

uint64 hex_encode ( const char *  src,
size_t  len,
char *  dst 
)

Definition at line 162 of file encode.c.

163 {
164  const char *end = src + len;
165 
166  while (src < end)
167  {
168  *dst++ = hextbl[(*src >> 4) & 0xF];
169  *dst++ = hextbl[*src & 0xF];
170  src++;
171  }
172  return (uint64) len * 2;
173 }
static const char hextbl[]
Definition: encode.c:148

References hextbl, and len.

Referenced by AddFileToBackupManifest(), byteaout(), and SendBackupManifest().

◆ pg_base64_dec_len()

static uint64 pg_base64_dec_len ( const char *  src,
size_t  srclen 
)
static

Definition at line 392 of file encode.c.

393 {
394  return ((uint64) srclen * 3) >> 2;
395 }

◆ pg_base64_decode()

static uint64 pg_base64_decode ( const char *  src,
size_t  len,
char *  dst 
)
static

Definition at line 314 of file encode.c.

315 {
316  const char *srcend = src + len,
317  *s = src;
318  char *p = dst;
319  char c;
320  int b = 0;
321  uint32 buf = 0;
322  int pos = 0,
323  end = 0;
324 
325  while (s < srcend)
326  {
327  c = *s++;
328 
329  if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
330  continue;
331 
332  if (c == '=')
333  {
334  /* end sequence */
335  if (!end)
336  {
337  if (pos == 2)
338  end = 1;
339  else if (pos == 3)
340  end = 2;
341  else
342  ereport(ERROR,
343  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
344  errmsg("unexpected \"=\" while decoding base64 sequence")));
345  }
346  b = 0;
347  }
348  else
349  {
350  b = -1;
351  if (c > 0 && c < 127)
352  b = b64lookup[(unsigned char) c];
353  if (b < 0)
354  ereport(ERROR,
355  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
356  errmsg("invalid symbol \"%.*s\" found while decoding base64 sequence",
357  pg_mblen(s - 1), s - 1)));
358  }
359  /* add it to buffer */
360  buf = (buf << 6) + b;
361  pos++;
362  if (pos == 4)
363  {
364  *p++ = (buf >> 16) & 255;
365  if (end == 0 || end > 1)
366  *p++ = (buf >> 8) & 255;
367  if (end == 0 || end > 2)
368  *p++ = buf & 255;
369  buf = 0;
370  pos = 0;
371  }
372  }
373 
374  if (pos != 0)
375  ereport(ERROR,
376  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
377  errmsg("invalid base64 end sequence"),
378  errhint("Input data is missing padding, is truncated, or is otherwise corrupted.")));
379 
380  return p - dst;
381 }
unsigned int uint32
Definition: c.h:490
int errhint(const char *fmt,...)
Definition: elog.c:1316
static const int8 b64lookup[128]
Definition: encode.c:255
int b
Definition: isn.c:70
static char * buf
Definition: pg_test_fsync.c:67

References b, b64lookup, buf, ereport, errcode(), errhint(), errmsg(), ERROR, len, and pg_mblen().

◆ pg_base64_enc_len()

static uint64 pg_base64_enc_len ( const char *  src,
size_t  srclen 
)
static

Definition at line 385 of file encode.c.

386 {
387  /* 3 bytes will be converted to 4, linefeed after 76 chars */
388  return ((uint64) srclen + 2) * 4 / 3 + (uint64) srclen / (76 * 3 / 4);
389 }

◆ pg_base64_encode()

static uint64 pg_base64_encode ( const char *  src,
size_t  len,
char *  dst 
)
static

Definition at line 267 of file encode.c.

268 {
269  char *p,
270  *lend = dst + 76;
271  const char *s,
272  *end = src + len;
273  int pos = 2;
274  uint32 buf = 0;
275 
276  s = src;
277  p = dst;
278 
279  while (s < end)
280  {
281  buf |= (unsigned char) *s << (pos << 3);
282  pos--;
283  s++;
284 
285  /* write it out */
286  if (pos < 0)
287  {
288  *p++ = _base64[(buf >> 18) & 0x3f];
289  *p++ = _base64[(buf >> 12) & 0x3f];
290  *p++ = _base64[(buf >> 6) & 0x3f];
291  *p++ = _base64[buf & 0x3f];
292 
293  pos = 2;
294  buf = 0;
295  }
296  if (p >= lend)
297  {
298  *p++ = '\n';
299  lend = p + 76;
300  }
301  }
302  if (pos != 2)
303  {
304  *p++ = _base64[(buf >> 18) & 0x3f];
305  *p++ = _base64[(buf >> 12) & 0x3f];
306  *p++ = (pos == 0) ? _base64[(buf >> 6) & 0x3f] : '=';
307  *p++ = '=';
308  }
309 
310  return p - dst;
311 }
static const char _base64[]
Definition: encode.c:252

References _base64, buf, and len.

◆ pg_find_encoding()

static const struct pg_encoding * pg_find_encoding ( const char *  name)
static

Definition at line 603 of file encode.c.

604 {
605  int i;
606 
607  for (i = 0; enclist[i].name; i++)
608  if (pg_strcasecmp(enclist[i].name, name) == 0)
609  return &enclist[i].enc;
610 
611  return NULL;
612 }
static const struct @20 enclist[]
int i
Definition: isn.c:73
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36

References enclist, i, name, and pg_strcasecmp().

Referenced by binary_decode(), and binary_encode().

Variable Documentation

◆ _base64

const char _base64[]
static
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Definition at line 252 of file encode.c.

Referenced by pg_base64_encode().

◆ b64lookup

const int8 b64lookup[128]
static
Initial value:
= {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63,
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,
-1, 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, -1, -1, -1, -1, -1,
}

Definition at line 255 of file encode.c.

Referenced by pg_base64_decode().

◆ enc

struct pg_encoding enc

Definition at line 571 of file encode.c.

Referenced by binary_decode(), and binary_encode().

◆ 

const { ... } enclist[]
Initial value:
=
{
{
"hex",
{
}
},
{
"base64",
{
}
},
{
"escape",
{
}
},
{
NULL,
{
NULL, NULL, NULL, NULL
}
}
}
static uint64 pg_base64_decode(const char *src, size_t len, char *dst)
Definition: encode.c:314
static uint64 hex_dec_len(const char *src, size_t srclen)
Definition: encode.c:243
static uint64 pg_base64_encode(const char *src, size_t len, char *dst)
Definition: encode.c:267
static uint64 esc_encode(const char *src, size_t srclen, char *dst)
Definition: encode.c:415
static uint64 hex_enc_len(const char *src, size_t srclen)
Definition: encode.c:237
uint64 hex_encode(const char *src, size_t len, char *dst)
Definition: encode.c:162
static uint64 esc_enc_len(const char *src, size_t srclen)
Definition: encode.c:502
static uint64 pg_base64_enc_len(const char *src, size_t srclen)
Definition: encode.c:385
static uint64 esc_decode(const char *src, size_t srclen, char *dst)
Definition: encode.c:454
static uint64 esc_dec_len(const char *src, size_t srclen)
Definition: encode.c:523
uint64 hex_decode(const char *src, size_t len, char *dst)
Definition: encode.c:190
static uint64 pg_base64_dec_len(const char *src, size_t srclen)
Definition: encode.c:392

Referenced by pg_find_encoding().

◆ hexlookup

const int8 hexlookup[128]
static
Initial value:
= {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1,
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
}

Definition at line 150 of file encode.c.

Referenced by get_hex().

◆ hextbl

const char hextbl[] = "0123456789abcdef"
static

Definition at line 148 of file encode.c.

Referenced by hex_encode().

◆ name

const char* name

Definition at line 571 of file encode.c.

Referenced by _outA_Expr(), _readA_Expr(), _SPI_find_ENR_by_name(), aclparse(), add_bool_reloption(), add_descriptor(), add_enum_reloption(), add_int_reloption(), add_local_bool_reloption(), add_local_enum_reloption(), add_local_int_reloption(), add_local_real_reloption(), add_local_string_reloption(), add_parameter_name(), add_placeholder_variable(), add_real_reloption(), add_string_reloption(), AlignedAllocFree(), allocate_reloption(), AllocateFile(), AllocSetContextCreateInternal(), AlterEventTriggerOwner(), AlterForeignDataWrapperOwner(), AlterForeignServerOwner(), AlterObjectNamespace_internal(), AlterPublicationOwner(), AlterSchemaOwner(), AlterSubscriptionOwner(), AlterSystemSetConfigFile(), AlterTableGetRelOptionsLockLevel(), appendReloptionsArray(), assignVariables(), ATExecAttachPartitionIdx(), ATExecDetachPartition(), ATExecDetachPartitionFinalize(), avlMergeValue(), BaseBackupAddTarget(), BeginInternalSubTransaction(), binary_decode(), binary_encode(), BootstrapModeMain(), BufFileCreateFileSet(), BufFileDeleteFileSet(), BufFileOpenFileSet(), buildACLCommands(), buildDefItem(), BuildOnConflictExcludedTargetlist(), check_duplicates_in_publist(), check_encoding_conversion_args(), check_file_excluded(), check_GUC_name_for_parameter_acl(), check_restricted_library_name(), check_testspec(), checkInsertTargets(), CheckMyDatabase(), choose_dsm_implementation(), ChooseExtendedStatisticNameAddition(), ChooseForeignKeyConstraintNameAddition(), ChooseIndexNameAddition(), ChooseTablespace(), close_file(), CommitTransactionCommand(), compareVariableNames(), componentcheck(), convert_GUC_name_for_parameter_acl(), convertRegProcReference(), CopyGetAttnums(), create_logical_replication_slot(), create_physical_replication_slot(), createNewConnection(), CreatePortal(), CreateTriggerFiringOn(), cursor_to_xml(), cursor_to_xmlschema(), deallocate_one(), define_custom_variable(), DefineAggregate(), DefineAttr(), DefineCustomBoolVariable(), DefineCustomEnumVariable(), DefineCustomIntVariable(), DefineCustomRealVariable(), DefineCustomStringVariable(), DefineSavepoint(), deleteConnection(), DeleteVariable(), DescribeQuery(), descriptor_variable(), do_pset(), does_not_exist_skipping(), drop_descriptor(), dsm_impl_mmap(), dsm_impl_pin_segment(), dsm_impl_posix(), dsm_impl_sysv(), dsm_impl_unpin_segment(), dump_block(), dumpACL(), dumpComment(), dumpCommentExtended(), dumpSecLabel(), dupEvents(), eat(), eats(), ecpg_auto_prepare(), ecpg_find_desc(), ecpg_find_prepared_statement(), ecpg_prepared(), ecpg_register_prepared_stmt(), ecpg_result_by_descriptor(), ECPGallocate_desc(), ECPGconnect(), ECPGdeallocate(), ECPGdeallocate_desc(), ECPGdescribe(), ECPGdump_a_simple(), ECPGdump_a_struct(), ECPGdump_a_type(), ECPGmake_struct_member(), ECPGnumeric_lvalue(), ECPGprepare(), ECPGprepared_statement(), enum_in(), enum_recv(), ExecParallelHashJoinSetUpBatches(), expand_dynamic_library_name(), expandNSItemAttrs(), FigureColname(), FigureColnameInternal(), FigureIndexColname(), file_exists(), FilePath(), FileSetCreate(), FileSetDelete(), FileSetOpen(), FileSetSegmentName(), FillXLogStatsRow(), find_option(), find_provider(), find_simple(), find_struct(), find_struct_member(), find_variable(), findBuiltin(), findTargetlistEntrySQL92(), findWindowClause(), flatten_set_variable_args(), fmgr_lookupByName(), GenerationContextCreate(), GenerationRealloc(), get_db_info(), get_ENR(), get_object_address_unqualified(), get_prompt(), get_reloptions(), get_replslot_index(), get_typedef(), GetConfigOption(), GetConfigOptionByName(), GetConfigOptionFlags(), GetConfigOptionResetString(), getConnectionByName(), getopt_long(), GetPGVariable(), GetPGVariableResultDesc(), GetPortalByName(), gettype(), getVariable(), GetVariable(), guc_name_hash(), GUCArrayAdd(), GUCArrayDelete(), infile(), init_bool_reloption(), init_custom_variable(), init_enum_reloption(), init_int_reloption(), init_real_reloption(), init_string_reloption(), initialize_ntdll(), initialize_reloptions(), InitializeClientEncoding(), InitializeLWLocks(), is_checksummed_file(), is_true_boolean_expression(), IsReservedName(), IsReservedOriginName(), itsdir(), itssymlink(), listAvailableScripts(), llvm_split_symbol_name(), load_return_type(), looks_like_temp_rel_name(), lookup_descriptor(), lookup_prop_name(), lookupCreateVariable(), lookupVariable(), main(), makeA_Expr(), makeAlterConfigCommand(), makeDefElem(), makeDefElemExtended(), makeFuncCall(), makeMultirangeConstructors(), MakeNewFileSetSegment(), makeObjectName(), makeRangeConstructors(), makeSimpleA_Expr(), map_xml_name_to_sql_identifier(), MemoryContextCreate(), MemoryContextStatsPrint(), merge_publications(), MergeAttributes(), MergeCheckConstraint(), mkdirs(), my_newCONSTSUB(), namecheck(), NameListToString(), namestrcmp(), namestrcpy(), new_variable(), output_deallocate_prepare_statement(), output_prepare_statement(), owningrel_does_not_exist_skipping(), parse_and_validate_value(), parse_compress_algorithm(), parse_filename_for_nontemp_relation(), parse_hba_auth_opt(), ParseLongOption(), parseQuery(), parseVariable(), ParseVariableBool(), ParseVariableNum(), PerformPortalClose(), pg_any_to_server(), pg_char_to_encoding(), pg_checksum_parse_type(), pg_config(), pg_create_logical_replication_slot(), pg_create_physical_replication_slot(), pg_digest(), pg_drop_replication_slot(), pg_fe_getusername(), pg_find_encoding(), pg_get_functiondef(), pg_get_object_address(), pg_hmac(), pg_import_system_collations(), pg_indexam_progress_phasename(), pg_load_tz(), pg_logging_init(), pg_logical_slot_get_changes_guts(), pg_open_tzfile(), pg_parameter_aclcheck(), pg_parameter_aclmask(), pg_replication_origin_advance(), pg_replication_origin_create(), pg_replication_origin_drop(), pg_replication_origin_oid(), pg_replication_origin_progress(), pg_replication_origin_session_setup(), pg_size_pretty(), pg_size_pretty_numeric(), pg_stat_get_slru(), pg_unicode_to_server(), pg_valid_client_encoding(), pg_valid_server_encoding(), pgp_get_cipher_code(), pgp_get_digest_code(), pgp_load_digest(), pgp_set_cipher_algo(), pgp_set_s2k_cipher_algo(), pgp_set_s2k_digest_algo(), pgstat_create_transactional(), pgstat_get_kind_from_str(), pgstat_get_slru_index(), pgstat_read_statsfile(), pgstat_replslot_from_serialized_name_cb(), pgstat_replslot_to_serialized_name_cb(), pgstat_reset_replslot(), pgstat_reset_slru(), pgstat_write_statsfile(), pgtls_verify_peer_name_matches_certificate_guts(), pgwin32_setenv(), pgwin32_unsetenv(), plpgsql_ns_additem(), plpgsql_ns_lookup_label(), PLy_create_exception(), PLy_generate_spi_exceptions(), PLy_procedure_munge_source(), PLy_traceback(), PostmasterMain(), pp_require_safe(), pq_verify_peer_name_matches_certificate_name(), PQregisterEventProc(), pqSaveParameterStatus(), prepare_cert_name(), prepare_common(), printCrosstab(), process_postgres_switches(), process_startup_options(), ProcessGUCArray(), PsqlVarEnumError(), PutMemoryContextsStatsTupleStore(), putVariable(), putVariableInt(), putVariableValue(), px_find_cipher(), px_find_combo(), px_find_digest(), px_find_hmac(), px_resolve_alias(), quoteOneName(), reapply_stacked_values(), ReleaseSavepoint(), repairDependencyLoop(), replace_auto_config_value(), ReplicationSlotAcquire(), ReplicationSlotCreate(), ReplicationSlotDrop(), ReplicationSlotName(), ReplicationSlotValidateName(), replorigin_drop_by_name(), report_invalid_encoding(), report_name_conflict(), report_namespace_conflict(), report_untranslatable_char(), ResourceOwnerCreate(), RestoreSlotFromDisk(), ri_ReportViolation(), RollbackToSavepoint(), run_permutation(), run_reindex_command(), scan_available_timezones(), schema_does_not_exist_skipping(), schema_to_xml(), schema_to_xml_and_xmlschema(), schema_to_xmlschema(), SearchNamedReplicationSlot(), sendCommand(), sendDir(), seq_search_ascii(), seq_search_localized(), set_config_by_name(), set_config_option(), set_config_option_ext(), set_config_sourcefile(), set_ps_display(), SetConfigOption(), SetPGVariable(), SetVariable(), SetVariableBool(), SetVariableHooks(), ShmemInitHash(), ShmemInitStruct(), show_item(), ShowGUCConfigOption(), SimpleLruInit(), skipfile(), SlabContextCreate(), SPI_cursor_find(), SPI_cursor_open(), SPI_cursor_open_internal(), SPI_cursor_open_with_args(), SPI_cursor_open_with_paramlist(), SPI_cursor_parse_open(), SPI_unregister_relation(), sqlda_variable(), strlist_to_textarray(), sts_filename(), sts_initialize(), sts_parallel_scan_next(), sts_puttuple(), substitute_libpath_macro(), tarOpen(), TSConfigIsVisible(), TSDictionaryIsVisible(), TSParserIsVisible(), TSTemplateIsVisible(), type_in_list_does_not_exist_skipping(), TypeCreate(), TypeShellMake(), tzload(), tzloadbody(), tzparse(), unregister_ENR(), uuid_generate_v3(), uuid_generate_v5(), valid_custom_variable_name(), valid_variable_name(), validate_option_array_item(), validOperatorName(), variable_is_guc_list_quote(), VariableHasHook(), writezone(), X509_NAME_field_to_text(), X509_NAME_to_cstring(), XLogDumpStatsRow(), and XmlTableSetNamespace().