PostgreSQL Source Code  git master
encode.c File Reference
#include "postgres.h"
#include <ctype.h>
#include "utils/builtins.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)
 
unsigned hex_encode (const char *src, unsigned len, char *dst)
 
static char get_hex (char c)
 
unsigned hex_decode (const char *src, unsigned len, char *dst)
 
static unsigned hex_enc_len (const char *src, unsigned srclen)
 
static unsigned hex_dec_len (const char *src, unsigned srclen)
 
static unsigned b64_encode (const char *src, unsigned len, char *dst)
 
static unsigned b64_decode (const char *src, unsigned len, char *dst)
 
static unsigned b64_enc_len (const char *src, unsigned srclen)
 
static unsigned b64_dec_len (const char *src, unsigned srclen)
 
static unsigned esc_encode (const char *src, unsigned srclen, char *dst)
 
static unsigned esc_decode (const char *src, unsigned srclen, char *dst)
 
static unsigned esc_enc_len (const char *src, unsigned srclen)
 
static unsigned esc_dec_len (const char *src, unsigned 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 362 of file encode.c.

Referenced by esc_encode().

◆ VAL

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

Definition at line 361 of file encode.c.

Referenced by esc_decode().

Function Documentation

◆ b64_dec_len()

static unsigned b64_dec_len ( const char *  src,
unsigned  srclen 
)
static

Definition at line 342 of file encode.c.

343 {
344  return (srclen * 3) >> 2;
345 }

◆ b64_decode()

static unsigned b64_decode ( const char *  src,
unsigned  len,
char *  dst 
)
static

Definition at line 265 of file encode.c.

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

266 {
267  const char *srcend = src + len,
268  *s = src;
269  char *p = dst;
270  char c;
271  int b = 0;
272  uint32 buf = 0;
273  int pos = 0,
274  end = 0;
275 
276  while (s < srcend)
277  {
278  c = *s++;
279 
280  if (c == ' ' || c == '\t' || c == '\n' || c == '\r')
281  continue;
282 
283  if (c == '=')
284  {
285  /* end sequence */
286  if (!end)
287  {
288  if (pos == 2)
289  end = 1;
290  else if (pos == 3)
291  end = 2;
292  else
293  ereport(ERROR,
294  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
295  errmsg("unexpected \"=\" while decoding base64 sequence")));
296  }
297  b = 0;
298  }
299  else
300  {
301  b = -1;
302  if (c > 0 && c < 127)
303  b = b64lookup[(unsigned char) c];
304  if (b < 0)
305  ereport(ERROR,
306  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
307  errmsg("invalid symbol \"%c\" while decoding base64 sequence", (int) c)));
308  }
309  /* add it to buffer */
310  buf = (buf << 6) + b;
311  pos++;
312  if (pos == 4)
313  {
314  *p++ = (buf >> 16) & 255;
315  if (end == 0 || end > 1)
316  *p++ = (buf >> 8) & 255;
317  if (end == 0 || end > 2)
318  *p++ = buf & 255;
319  buf = 0;
320  pos = 0;
321  }
322  }
323 
324  if (pos != 0)
325  ereport(ERROR,
326  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
327  errmsg("invalid base64 end sequence"),
328  errhint("Input data is missing padding, is truncated, or is otherwise corrupted.")));
329 
330  return p - dst;
331 }
int errhint(const char *fmt,...)
Definition: elog.c:987
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
char * c
static char * buf
Definition: pg_test_fsync.c:67
unsigned int uint32
Definition: c.h:306
#define ereport(elevel, rest)
Definition: elog.h:122
int errmsg(const char *fmt,...)
Definition: elog.c:797
static const int8 b64lookup[128]
Definition: encode.c:206

◆ b64_enc_len()

static unsigned b64_enc_len ( const char *  src,
unsigned  srclen 
)
static

Definition at line 335 of file encode.c.

336 {
337  /* 3 bytes will be converted to 4, linefeed after 76 chars */
338  return (srclen + 2) * 4 / 3 + srclen / (76 * 3 / 4);
339 }

◆ b64_encode()

static unsigned b64_encode ( const char *  src,
unsigned  len,
char *  dst 
)
static

Definition at line 218 of file encode.c.

References _base64, and buf.

219 {
220  char *p,
221  *lend = dst + 76;
222  const char *s,
223  *end = src + len;
224  int pos = 2;
225  uint32 buf = 0;
226 
227  s = src;
228  p = dst;
229 
230  while (s < end)
231  {
232  buf |= (unsigned char) *s << (pos << 3);
233  pos--;
234  s++;
235 
236  /* write it out */
237  if (pos < 0)
238  {
239  *p++ = _base64[(buf >> 18) & 0x3f];
240  *p++ = _base64[(buf >> 12) & 0x3f];
241  *p++ = _base64[(buf >> 6) & 0x3f];
242  *p++ = _base64[buf & 0x3f];
243 
244  pos = 2;
245  buf = 0;
246  }
247  if (p >= lend)
248  {
249  *p++ = '\n';
250  lend = p + 76;
251  }
252  }
253  if (pos != 2)
254  {
255  *p++ = _base64[(buf >> 18) & 0x3f];
256  *p++ = _base64[(buf >> 12) & 0x3f];
257  *p++ = (pos == 0) ? _base64[(buf >> 6) & 0x3f] : '=';
258  *p++ = '=';
259  }
260 
261  return p - dst;
262 }
static const char _base64[]
Definition: encode.c:203
static char * buf
Definition: pg_test_fsync.c:67
unsigned int uint32
Definition: c.h:306

◆ binary_decode()

Datum binary_decode ( PG_FUNCTION_ARGS  )

Definition at line 72 of file encode.c.

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

73 {
74  text *data = PG_GETARG_TEXT_PP(0);
76  bytea *result;
77  char *namebuf;
78  int datalen,
79  resultlen,
80  res;
81  const struct pg_encoding *enc;
82 
83  datalen = VARSIZE_ANY_EXHDR(data);
84 
85  namebuf = TextDatumGetCString(name);
86 
87  enc = pg_find_encoding(namebuf);
88  if (enc == NULL)
89  ereport(ERROR,
90  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
91  errmsg("unrecognized encoding: \"%s\"", namebuf)));
92 
93  resultlen = enc->decode_len(VARDATA_ANY(data), datalen);
94  result = palloc(VARHDRSZ + resultlen);
95 
96  res = enc->decode(VARDATA_ANY(data), datalen, VARDATA(result));
97 
98  /* Make this FATAL 'cause we've trodden on memory ... */
99  if (res > resultlen)
100  elog(FATAL, "overflow - decode estimate too small");
101 
102  SET_VARSIZE(result, VARHDRSZ + res);
103 
104  PG_RETURN_BYTEA_P(result);
105 }
#define VARDATA_ANY(PTR)
Definition: postgres.h:347
#define VARDATA(PTR)
Definition: postgres.h:303
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:233
#define VARHDRSZ
Definition: c.h:503
int errcode(int sqlerrcode)
Definition: elog.c:575
#define PG_RETURN_BYTEA_P(x)
Definition: fmgr.h:330
unsigned(* decode)(const char *data, unsigned dlen, char *res)
Definition: encode.c:26
#define PG_GETARG_TEXT_PP(n)
Definition: fmgr.h:273
#define ERROR
Definition: elog.h:43
struct pg_encoding enc
Definition: encode.c:522
#define FATAL
Definition: elog.h:52
static const struct pg_encoding * pg_find_encoding(const char *name)
Definition: encode.c:553
#define ereport(elevel, rest)
Definition: elog.h:122
#define TextDatumGetCString(d)
Definition: builtins.h:92
uintptr_t Datum
Definition: postgres.h:372
unsigned(* decode_len)(const char *data, unsigned dlen)
Definition: encode.c:24
const char * name
Definition: encode.c:521
#define VARSIZE_ANY_EXHDR(PTR)
Definition: postgres.h:340
void * palloc(Size size)
Definition: mcxt.c:835
int errmsg(const char *fmt,...)
Definition: elog.c:797
Definition: c.h:497
#define SET_VARSIZE(PTR, len)
Definition: postgres.h:328
#define elog
Definition: elog.h:219

◆ binary_encode()

Datum binary_encode ( PG_FUNCTION_ARGS  )

Definition at line 36 of file encode.c.

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

37 {
38  bytea *data = PG_GETARG_BYTEA_PP(0);
40  text *result;
41  char *namebuf;
42  int datalen,
43  resultlen,
44  res;
45  const struct pg_encoding *enc;
46 
47  datalen = VARSIZE_ANY_EXHDR(data);
48 
49  namebuf = TextDatumGetCString(name);
50 
51  enc = pg_find_encoding(namebuf);
52  if (enc == NULL)
53  ereport(ERROR,
54  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
55  errmsg("unrecognized encoding: \"%s\"", namebuf)));
56 
57  resultlen = enc->encode_len(VARDATA_ANY(data), datalen);
58  result = palloc(VARHDRSZ + resultlen);
59 
60  res = enc->encode(VARDATA_ANY(data), datalen, VARDATA(result));
61 
62  /* Make this FATAL 'cause we've trodden on memory ... */
63  if (res > resultlen)
64  elog(FATAL, "overflow - encode estimate too small");
65 
66  SET_VARSIZE(result, VARHDRSZ + res);
67 
68  PG_RETURN_TEXT_P(result);
69 }
#define VARDATA_ANY(PTR)
Definition: postgres.h:347
#define VARDATA(PTR)
Definition: postgres.h:303
#define PG_GETARG_DATUM(n)
Definition: fmgr.h:233
#define VARHDRSZ
Definition: c.h:503
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
unsigned(* encode)(const char *data, unsigned dlen, char *res)
Definition: encode.c:25
struct pg_encoding enc
Definition: encode.c:522
#define FATAL
Definition: elog.h:52
static const struct pg_encoding * pg_find_encoding(const char *name)
Definition: encode.c:553
#define ereport(elevel, rest)
Definition: elog.h:122
#define TextDatumGetCString(d)
Definition: builtins.h:92
uintptr_t Datum
Definition: postgres.h:372
#define PG_RETURN_TEXT_P(x)
Definition: fmgr.h:331
#define PG_GETARG_BYTEA_PP(n)
Definition: fmgr.h:272
const char * name
Definition: encode.c:521
#define VARSIZE_ANY_EXHDR(PTR)
Definition: postgres.h:340
void * palloc(Size size)
Definition: mcxt.c:835
int errmsg(const char *fmt,...)
Definition: elog.c:797
Definition: c.h:497
#define SET_VARSIZE(PTR, len)
Definition: postgres.h:328
#define elog
Definition: elog.h:219
unsigned(* encode_len)(const char *data, unsigned dlen)
Definition: encode.c:23

◆ esc_dec_len()

static unsigned esc_dec_len ( const char *  src,
unsigned  srclen 
)
static

Definition at line 473 of file encode.c.

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

474 {
475  const char *end = src + srclen;
476  int len = 0;
477 
478  while (src < end)
479  {
480  if (src[0] != '\\')
481  src++;
482  else if (src + 3 < end &&
483  (src[1] >= '0' && src[1] <= '3') &&
484  (src[2] >= '0' && src[2] <= '7') &&
485  (src[3] >= '0' && src[3] <= '7'))
486  {
487  /*
488  * backslash + valid octal
489  */
490  src += 4;
491  }
492  else if (src + 1 < end &&
493  (src[1] == '\\'))
494  {
495  /*
496  * two backslashes = backslash
497  */
498  src += 2;
499  }
500  else
501  {
502  /*
503  * one backslash, not followed by ### valid octal
504  */
505  ereport(ERROR,
506  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
507  errmsg("invalid input syntax for type %s", "bytea")));
508  }
509 
510  len++;
511  }
512  return len;
513 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
int errmsg(const char *fmt,...)
Definition: elog.c:797

◆ esc_decode()

static unsigned esc_decode ( const char *  src,
unsigned  srclen,
char *  dst 
)
static

Definition at line 404 of file encode.c.

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

405 {
406  const char *end = src + srclen;
407  char *rp = dst;
408  int len = 0;
409 
410  while (src < end)
411  {
412  if (src[0] != '\\')
413  *rp++ = *src++;
414  else if (src + 3 < end &&
415  (src[1] >= '0' && src[1] <= '3') &&
416  (src[2] >= '0' && src[2] <= '7') &&
417  (src[3] >= '0' && src[3] <= '7'))
418  {
419  int val;
420 
421  val = VAL(src[1]);
422  val <<= 3;
423  val += VAL(src[2]);
424  val <<= 3;
425  *rp++ = val + VAL(src[3]);
426  src += 4;
427  }
428  else if (src + 1 < end &&
429  (src[1] == '\\'))
430  {
431  *rp++ = '\\';
432  src += 2;
433  }
434  else
435  {
436  /*
437  * One backslash, not followed by ### valid octal. Should never
438  * get here, since esc_dec_len does same check.
439  */
440  ereport(ERROR,
441  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
442  errmsg("invalid input syntax for type %s", "bytea")));
443  }
444 
445  len++;
446  }
447 
448  return len;
449 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
#define VAL(CH)
Definition: encode.c:361
int errmsg(const char *fmt,...)
Definition: elog.c:797
long val
Definition: informix.c:689

◆ esc_enc_len()

static unsigned esc_enc_len ( const char *  src,
unsigned  srclen 
)
static

Definition at line 452 of file encode.c.

References IS_HIGHBIT_SET.

453 {
454  const char *end = src + srclen;
455  int len = 0;
456 
457  while (src < end)
458  {
459  if (*src == '\0' || IS_HIGHBIT_SET(*src))
460  len += 4;
461  else if (*src == '\\')
462  len += 2;
463  else
464  len++;
465 
466  src++;
467  }
468 
469  return len;
470 }
#define IS_HIGHBIT_SET(ch)
Definition: c.h:949

◆ esc_encode()

static unsigned esc_encode ( const char *  src,
unsigned  srclen,
char *  dst 
)
static

Definition at line 365 of file encode.c.

References DIG, and IS_HIGHBIT_SET.

366 {
367  const char *end = src + srclen;
368  char *rp = dst;
369  int len = 0;
370 
371  while (src < end)
372  {
373  unsigned char c = (unsigned char) *src;
374 
375  if (c == '\0' || IS_HIGHBIT_SET(c))
376  {
377  rp[0] = '\\';
378  rp[1] = DIG(c >> 6);
379  rp[2] = DIG((c >> 3) & 7);
380  rp[3] = DIG(c & 7);
381  rp += 4;
382  len += 4;
383  }
384  else if (c == '\\')
385  {
386  rp[0] = '\\';
387  rp[1] = '\\';
388  rp += 2;
389  len += 2;
390  }
391  else
392  {
393  *rp++ = c;
394  len++;
395  }
396 
397  src++;
398  }
399 
400  return len;
401 }
#define IS_HIGHBIT_SET(ch)
Definition: c.h:949
char * c
#define DIG(VAL)
Definition: encode.c:362

◆ get_hex()

static char get_hex ( char  c)
inlinestatic

Definition at line 140 of file encode.c.

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

Referenced by hex_decode().

141 {
142  int res = -1;
143 
144  if (c > 0 && c < 127)
145  res = hexlookup[(unsigned char) c];
146 
147  if (res < 0)
148  ereport(ERROR,
149  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
150  errmsg("invalid hexadecimal digit: \"%c\"", c)));
151 
152  return (char) res;
153 }
int errcode(int sqlerrcode)
Definition: elog.c:575
static const int8 hexlookup[128]
Definition: encode.c:114
#define ERROR
Definition: elog.h:43
char * c
#define ereport(elevel, rest)
Definition: elog.h:122
int errmsg(const char *fmt,...)
Definition: elog.c:797

◆ hex_dec_len()

static unsigned hex_dec_len ( const char *  src,
unsigned  srclen 
)
static

Definition at line 194 of file encode.c.

195 {
196  return srclen >> 1;
197 }

◆ hex_decode()

unsigned hex_decode ( const char *  src,
unsigned  len,
char *  dst 
)

Definition at line 156 of file encode.c.

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

Referenced by byteain().

157 {
158  const char *s,
159  *srcend;
160  char v1,
161  v2,
162  *p;
163 
164  srcend = src + len;
165  s = src;
166  p = dst;
167  while (s < srcend)
168  {
169  if (*s == ' ' || *s == '\n' || *s == '\t' || *s == '\r')
170  {
171  s++;
172  continue;
173  }
174  v1 = get_hex(*s++) << 4;
175  if (s >= srcend)
176  ereport(ERROR,
177  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
178  errmsg("invalid hexadecimal data: odd number of digits")));
179 
180  v2 = get_hex(*s++);
181  *p++ = v1 | v2;
182  }
183 
184  return p - dst;
185 }
int errcode(int sqlerrcode)
Definition: elog.c:575
#define ERROR
Definition: elog.h:43
#define ereport(elevel, rest)
Definition: elog.h:122
static char get_hex(char c)
Definition: encode.c:140
int errmsg(const char *fmt,...)
Definition: elog.c:797

◆ hex_enc_len()

static unsigned hex_enc_len ( const char *  src,
unsigned  srclen 
)
static

Definition at line 188 of file encode.c.

189 {
190  return srclen << 1;
191 }

◆ hex_encode()

unsigned hex_encode ( const char *  src,
unsigned  len,
char *  dst 
)

Definition at line 126 of file encode.c.

References hextbl.

Referenced by byteaout().

127 {
128  const char *end = src + len;
129 
130  while (src < end)
131  {
132  *dst++ = hextbl[(*src >> 4) & 0xF];
133  *dst++ = hextbl[*src & 0xF];
134  src++;
135  }
136  return len * 2;
137 }
static const char hextbl[]
Definition: encode.c:112

◆ pg_find_encoding()

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

Definition at line 553 of file encode.c.

References enclist, i, and pg_strcasecmp().

Referenced by binary_decode(), and binary_encode().

554 {
555  int i;
556 
557  for (i = 0; enclist[i].name; i++)
558  if (pg_strcasecmp(enclist[i].name, name) == 0)
559  return &enclist[i].enc;
560 
561  return NULL;
562 }
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
const char * name
Definition: encode.c:521
int i
static const struct @28 enclist[]

Variable Documentation

◆ _base64

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

Definition at line 203 of file encode.c.

Referenced by b64_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 206 of file encode.c.

Referenced by b64_decode().

◆ enc

◆ enclist

const { ... } enclist[]
Initial value:
=
{
{
"hex",
{
}
},
{
"base64",
{
}
},
{
"escape",
{
}
},
{
NULL,
{
NULL, NULL, NULL, NULL
}
}
}
static unsigned b64_enc_len(const char *src, unsigned srclen)
Definition: encode.c:335
static unsigned b64_dec_len(const char *src, unsigned srclen)
Definition: encode.c:342
static unsigned esc_enc_len(const char *src, unsigned srclen)
Definition: encode.c:452
static unsigned b64_encode(const char *src, unsigned len, char *dst)
Definition: encode.c:218
static unsigned esc_encode(const char *src, unsigned srclen, char *dst)
Definition: encode.c:365
unsigned hex_decode(const char *src, unsigned len, char *dst)
Definition: encode.c:156
unsigned hex_encode(const char *src, unsigned len, char *dst)
Definition: encode.c:126
static unsigned b64_decode(const char *src, unsigned len, char *dst)
Definition: encode.c:265
static unsigned hex_dec_len(const char *src, unsigned srclen)
Definition: encode.c:194
static unsigned hex_enc_len(const char *src, unsigned srclen)
Definition: encode.c:188
static unsigned esc_decode(const char *src, unsigned srclen, char *dst)
Definition: encode.c:404
static unsigned esc_dec_len(const char *src, unsigned srclen)
Definition: encode.c:473

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 114 of file encode.c.

Referenced by get_hex().

◆ hextbl

const char hextbl[] = "0123456789abcdef"
static

Definition at line 112 of file encode.c.

Referenced by hex_encode().

◆ name

const char* name

Definition at line 521 of file encode.c.

Referenced by _copyAExpr(), _copyAlterDomainStmt(), _copyAlterTableCmd(), _copyCreateOpClassItem(), _copyDeallocateStmt(), _copyExecuteStmt(), _copyFunctionParameter(), _copyIndexElem(), _copyNamedArgExpr(), _copyPartitionCmd(), _copyPartitionElem(), _copyPrepareStmt(), _copyReindexStmt(), _copyReplicaIdentityStmt(), _copyResTarget(), _copyTriggerTransition(), _copyVariableSetStmt(), _copyVariableShowStmt(), _copyWindowClause(), _copyWindowDef(), _copyXmlExpr(), _equalAExpr(), _equalAlterDomainStmt(), _equalAlterTableCmd(), _equalCreateOpClassItem(), _equalDeallocateStmt(), _equalExecuteStmt(), _equalFunctionParameter(), _equalIndexElem(), _equalNamedArgExpr(), _equalPartitionCmd(), _equalPartitionElem(), _equalPrepareStmt(), _equalReindexStmt(), _equalReplicaIdentityStmt(), _equalResTarget(), _equalTriggerTransition(), _equalVariableSetStmt(), _equalVariableShowStmt(), _equalWindowClause(), _equalWindowDef(), _equalXmlExpr(), _outAExpr(), _outIndexElem(), _outNamedArgExpr(), _outPartitionElem(), _outResTarget(), _outTriggerTransition(), _outWindowClause(), _outWindowDef(), _outXmlExpr(), _readNamedArgExpr(), _readWindowClause(), _readXmlExpr(), aclparse(), aes_cbc_decrypt(), AllocSetStats(), AlterObjectNamespace_internal(), AlterSystemSetConfigFile(), AlterTableGetRelOptionsLockLevel(), appendReloptionsArray(), assignVariables(), AuxiliaryPidGetProc(), binary_decode(), binary_encode(), check_encoding_conversion_args(), checkInsertTargets(), choose_dsm_implementation(), ChooseIndexNameAddition(), compareVariableNames(), convert_sourcefiles_in(), convertOperatorReference(), convertRegProcReference(), CopyGetAttnums(), CreateTrigger(), cursor_to_xml(), cursor_to_xmlschema(), deallocate_one(), define_custom_variable(), DescribeQuery(), does_not_exist_skipping(), dsm_impl_can_resize(), dsm_impl_mmap(), dsm_impl_pin_segment(), dsm_impl_sysv(), dsm_impl_unpin_segment(), dump_block(), dupEvents(), eats(), ECPGdescribe(), enum_in(), enum_recv(), expandRelAttrs(), FigureColname(), FigureIndexColname(), find_option(), findTargetlistEntrySQL92(), flatten_reloptions(), GenerationFree(), GenerationRealloc(), GenerationStats(), get_object_address_unqualified(), get_prompt(), get_tablefunc(), get_type(), GetMemoryChunkContext(), getopt_long(), initialize_reloptions(), initialize_worker_spi(), InitializeClientEncoding(), InitializeLWLocks(), listAvailableScripts(), lookupVariable(), main(), makeA_Expr(), makeDefElem(), makeDefElemExtended(), makeFuncCall(), makeObjectName(), MemoryContextCreate(), MergeAttributes(), mkdirs(), namecheck(), NameListToString(), namestrcpy(), parseQuery(), parseVariable(), pg_any_to_server(), pg_create_logical_replication_slot(), pg_create_physical_replication_slot(), pg_digest(), pg_drop_replication_slot(), pg_fe_getauthname(), pg_get_functiondef(), pg_get_object_address(), pg_hmac(), pg_import_system_collations(), pg_logical_slot_get_changes_guts(), pg_open_tzfile(), 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(), PLy_traceback(), PostmasterMain(), pp_require_safe(), process_postgres_switches(), process_startup_options(), ProcessGUCArray(), publicationListToArray(), px_resolve_alias(), repairDependencyLoop(), report_invalid_encoding(), report_multiple_error_messages(), report_untranslatable_char(), ResourceOwnerCreate(), ri_ReportViolation(), run_permutation(), scan_available_timezones(), schema_to_xml(), schema_to_xml_and_xmlschema(), schema_to_xmlschema(), sendCommand(), set_config_by_name(), set_ps_display(), SetMessageEncoding(), show_item(), SlabStats(), standard_ProcessUtility(), strlist_to_textarray(), tarOpen(), transformOnConflictClause(), transformRangeTableFunc(), TSConfigIsVisible(), TSDictionaryIsVisible(), TSParserIsVisible(), TSTemplateIsVisible(), TypeCreate(), TypeShellMake(), tzloadbody(), tzparse(), verify_peer_name_matches_certificate(), verify_peer_name_matches_certificate_name(), and xml_is_document().