PostgreSQL Source Code  git master
builtins.h File Reference
#include "fmgr.h"
#include "nodes/nodes.h"
#include "utils/fmgrprotos.h"
Include dependency graph for builtins.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAXINT8LEN   20
 
#define CStringGetTextDatum(s)   PointerGetDatum(cstring_to_text(s))
 
#define TextDatumGetCString(d)   text_to_cstring((text *) DatumGetPointer(d))
 
#define FORMAT_TYPE_TYPEMOD_GIVEN   0x01 /* typemod defined by caller */
 
#define FORMAT_TYPE_ALLOW_INVALID   0x02 /* allow invalid types */
 
#define FORMAT_TYPE_FORCE_QUALIFY   0x04 /* force qualification of type */
 
#define FORMAT_TYPE_INVALID_AS_NULL   0x08 /* NULL if undefined */
 

Functions

bool parse_bool (const char *value, bool *result)
 
bool parse_bool_with_len (const char *value, size_t len, bool *result)
 
void domain_check (Datum value, bool isnull, Oid domainType, void **extra, MemoryContext mcxt)
 
int errdatatype (Oid datatypeOid)
 
int errdomainconstraint (Oid datatypeOid, const char *conname)
 
uint64 hex_encode (const char *src, size_t len, char *dst)
 
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)
 
int2vectorbuildint2vector (const int16 *int2s, int n)
 
void namestrcpy (Name name, const char *str)
 
int namestrcmp (Name name, const char *str)
 
int16 pg_strtoint16 (const char *s)
 
int16 pg_strtoint16_safe (const char *s, Node *escontext)
 
int32 pg_strtoint32 (const char *s)
 
int32 pg_strtoint32_safe (const char *s, Node *escontext)
 
int64 pg_strtoint64 (const char *s)
 
int64 pg_strtoint64_safe (const char *s, Node *escontext)
 
uint32 uint32in_subr (const char *s, char **endloc, const char *typname, Node *escontext)
 
uint64 uint64in_subr (const char *s, char **endloc, const char *typname, Node *escontext)
 
int pg_itoa (int16 i, char *a)
 
int pg_ultoa_n (uint32 value, char *a)
 
int pg_ulltoa_n (uint64 value, char *a)
 
int pg_ltoa (int32 value, char *a)
 
int pg_lltoa (int64 value, char *a)
 
char * pg_ultostr_zeropad (char *str, uint32 value, int32 minwidth)
 
char * pg_ultostr (char *str, uint32 value)
 
oidvectorbuildoidvector (const Oid *oids, int n)
 
Oid oidparse (Node *node)
 
int oid_cmp (const void *p1, const void *p2)
 
char * regexp_fixed_prefix (text *text_re, bool case_insensitive, Oid collation, bool *exact)
 
const char * quote_identifier (const char *ident)
 
char * quote_qualified_identifier (const char *qualifier, const char *ident)
 
void generate_operator_clause (fmStringInfo buf, const char *leftop, Oid leftoptype, Oid opoid, const char *rightop, Oid rightoptype)
 
int bpchartruelen (char *s, int len)
 
textcstring_to_text (const char *s)
 
textcstring_to_text_with_len (const char *s, int len)
 
char * text_to_cstring (const text *t)
 
void text_to_cstring_buffer (const text *src, char *dst, size_t dst_len)
 
int xidComparator (const void *arg1, const void *arg2)
 
int xidLogicalComparator (const void *arg1, const void *arg2)
 
char * pg_inet_cidr_ntop (int af, const void *src, int bits, char *dst, size_t size)
 
int pg_inet_net_pton (int af, const char *src, void *dst, size_t size)
 
double convert_network_to_scalar (Datum value, Oid typid, bool *failure)
 
Datum network_scan_first (Datum in)
 
Datum network_scan_last (Datum in)
 
void clean_ipv6_addr (int addr_family, char *addr)
 
Datum numeric_float8_no_overflow (PG_FUNCTION_ARGS)
 
char * format_type_extended (Oid type_oid, int32 typemod, bits16 flags)
 
char * format_type_be (Oid type_oid)
 
char * format_type_be_qualified (Oid type_oid)
 
char * format_type_with_typemod (Oid type_oid, int32 typemod)
 
int32 type_maximum_size (Oid type_oid, int32 typemod)
 
char * quote_literal_cstr (const char *rawstr)
 

Variables

PGDLLIMPORT bool quote_all_identifiers
 

Macro Definition Documentation

◆ CStringGetTextDatum

#define CStringGetTextDatum (   s)    PointerGetDatum(cstring_to_text(s))

Definition at line 94 of file builtins.h.

◆ FORMAT_TYPE_ALLOW_INVALID

#define FORMAT_TYPE_ALLOW_INVALID   0x02 /* allow invalid types */

Definition at line 122 of file builtins.h.

◆ FORMAT_TYPE_FORCE_QUALIFY

#define FORMAT_TYPE_FORCE_QUALIFY   0x04 /* force qualification of type */

Definition at line 123 of file builtins.h.

◆ FORMAT_TYPE_INVALID_AS_NULL

#define FORMAT_TYPE_INVALID_AS_NULL   0x08 /* NULL if undefined */

Definition at line 124 of file builtins.h.

◆ FORMAT_TYPE_TYPEMOD_GIVEN

#define FORMAT_TYPE_TYPEMOD_GIVEN   0x01 /* typemod defined by caller */

Definition at line 121 of file builtins.h.

◆ MAXINT8LEN

#define MAXINT8LEN   20

Definition at line 22 of file builtins.h.

◆ TextDatumGetCString

#define TextDatumGetCString (   d)    text_to_cstring((text *) DatumGetPointer(d))

Definition at line 95 of file builtins.h.

Function Documentation

◆ bpchartruelen()

int bpchartruelen ( char *  s,
int  len 
)

Definition at line 677 of file varchar.c.

678 {
679  int i;
680 
681  /*
682  * Note that we rely on the assumption that ' ' is a singleton unit on
683  * every supported multibyte server encoding.
684  */
685  for (i = len - 1; i >= 0; i--)
686  {
687  if (s[i] != ' ')
688  break;
689  }
690  return i + 1;
691 }
int i
Definition: isn.c:73
const void size_t len

References i, and len.

Referenced by bcTruelen(), bpcharfastcmp_c(), varstr_abbrev_convert(), and varstrfastcmp_locale().

◆ buildint2vector()

int2vector* buildint2vector ( const int16 int2s,
int  n 
)

Definition at line 114 of file int.c.

115 {
116  int2vector *result;
117 
118  result = (int2vector *) palloc0(Int2VectorSize(n));
119 
120  if (n > 0 && int2s)
121  memcpy(result->values, int2s, n * sizeof(int16));
122 
123  /*
124  * Attach standard array header. For historical reasons, we set the index
125  * lower bound to 0 not 1.
126  */
127  SET_VARSIZE(result, Int2VectorSize(n));
128  result->ndim = 1;
129  result->dataoffset = 0; /* never any nulls */
130  result->elemtype = INT2OID;
131  result->dim1 = n;
132  result->lbound1 = 0;
133 
134  return result;
135 }
signed short int16
Definition: c.h:477
#define Int2VectorSize(n)
Definition: int.c:45
void * palloc0(Size size)
Definition: mcxt.c:1241
Definition: c.h:699
int ndim
Definition: c.h:701
int dim1
Definition: c.h:704
Oid elemtype
Definition: c.h:703
int16 values[FLEXIBLE_ARRAY_MEMBER]
Definition: c.h:706
int32 dataoffset
Definition: c.h:702
int lbound1
Definition: c.h:705
#define SET_VARSIZE(PTR, len)
Definition: varatt.h:305

References int2vector::dataoffset, int2vector::dim1, int2vector::elemtype, Int2VectorSize, int2vector::lbound1, int2vector::ndim, palloc0(), SET_VARSIZE, and int2vector::values.

Referenced by CreateStatistics(), CreateTriggerFiringOn(), pg_get_publication_tables(), publication_add_relation(), StorePartitionKey(), and UpdateIndexRelation().

◆ buildoidvector()

oidvector* buildoidvector ( const Oid oids,
int  n 
)

Definition at line 86 of file oid.c.

87 {
88  oidvector *result;
89 
90  result = (oidvector *) palloc0(OidVectorSize(n));
91 
92  if (n > 0 && oids)
93  memcpy(result->values, oids, n * sizeof(Oid));
94 
95  /*
96  * Attach standard array header. For historical reasons, we set the index
97  * lower bound to 0 not 1.
98  */
99  SET_VARSIZE(result, OidVectorSize(n));
100  result->ndim = 1;
101  result->dataoffset = 0; /* never any nulls */
102  result->elemtype = OIDOID;
103  result->dim1 = n;
104  result->lbound1 = 0;
105 
106  return result;
107 }
#define OidVectorSize(n)
Definition: oid.c:28
unsigned int Oid
Definition: postgres_ext.h:31
Definition: c.h:710
int dim1
Definition: c.h:715
int32 dataoffset
Definition: c.h:713
Oid elemtype
Definition: c.h:714
int lbound1
Definition: c.h:716
int ndim
Definition: c.h:712
Oid values[FLEXIBLE_ARRAY_MEMBER]
Definition: c.h:717

References oidvector::dataoffset, oidvector::dim1, oidvector::elemtype, oidvector::lbound1, oidvector::ndim, OidVectorSize, palloc0(), SET_VARSIZE, and oidvector::values.

Referenced by DefineAggregate(), interpret_function_parameter_list(), makeMultirangeConstructors(), makeRangeConstructors(), StorePartitionKey(), and UpdateIndexRelation().

◆ clean_ipv6_addr()

void clean_ipv6_addr ( int  addr_family,
char *  addr 
)

Definition at line 2095 of file network.c.

2096 {
2097  if (addr_family == AF_INET6)
2098  {
2099  char *pct = strchr(addr, '%');
2100 
2101  if (pct)
2102  *pct = '\0';
2103  }
2104 }

Referenced by fill_hba_line(), inet_client_addr(), inet_server_addr(), pg_stat_get_activity(), and pg_stat_get_backend_client_addr().

◆ convert_network_to_scalar()

double convert_network_to_scalar ( Datum  value,
Oid  typid,
bool failure 
)

Definition at line 1502 of file network.c.

1503 {
1504  switch (typid)
1505  {
1506  case INETOID:
1507  case CIDROID:
1508  {
1509  inet *ip = DatumGetInetPP(value);
1510  int len;
1511  double res;
1512  int i;
1513 
1514  /*
1515  * Note that we don't use the full address for IPv6.
1516  */
1517  if (ip_family(ip) == PGSQL_AF_INET)
1518  len = 4;
1519  else
1520  len = 5;
1521 
1522  res = ip_family(ip);
1523  for (i = 0; i < len; i++)
1524  {
1525  res *= 256;
1526  res += ip_addr(ip)[i];
1527  }
1528  return res;
1529  }
1530  case MACADDROID:
1531  {
1532  macaddr *mac = DatumGetMacaddrP(value);
1533  double res;
1534 
1535  res = (mac->a << 16) | (mac->b << 8) | (mac->c);
1536  res *= 256 * 256 * 256;
1537  res += (mac->d << 16) | (mac->e << 8) | (mac->f);
1538  return res;
1539  }
1540  case MACADDR8OID:
1541  {
1543  double res;
1544 
1545  res = (mac->a << 24) | (mac->b << 16) | (mac->c << 8) | (mac->d);
1546  res *= ((double) 256) * 256 * 256 * 256;
1547  res += (mac->e << 24) | (mac->f << 16) | (mac->g << 8) | (mac->h);
1548  return res;
1549  }
1550  }
1551 
1552  *failure = true;
1553  return 0;
1554 }
static struct @143 value
Definition: inet.h:53
Definition: inet.h:108
unsigned char c
Definition: inet.h:111
unsigned char b
Definition: inet.h:110
unsigned char d
Definition: inet.h:112
unsigned char e
Definition: inet.h:113
unsigned char g
Definition: inet.h:115
unsigned char h
Definition: inet.h:116
unsigned char a
Definition: inet.h:109
unsigned char f
Definition: inet.h:114
Definition: inet.h:95
unsigned char e
Definition: inet.h:100
unsigned char b
Definition: inet.h:97
unsigned char f
Definition: inet.h:101
unsigned char c
Definition: inet.h:98
unsigned char a
Definition: inet.h:96
unsigned char d
Definition: inet.h:99
#define ip_addr(inetptr)
Definition: inet.h:77
static macaddr * DatumGetMacaddrP(Datum X)
Definition: inet.h:147
#define ip_family(inetptr)
Definition: inet.h:71
#define PGSQL_AF_INET
Definition: inet.h:39
static inet * DatumGetInetPP(Datum X)
Definition: inet.h:123
static macaddr8 * DatumGetMacaddr8P(Datum X)
Definition: inet.h:163

References macaddr::a, macaddr8::a, macaddr::b, macaddr8::b, macaddr::c, macaddr8::c, macaddr::d, macaddr8::d, DatumGetInetPP(), DatumGetMacaddr8P(), DatumGetMacaddrP(), macaddr::e, macaddr8::e, macaddr::f, macaddr8::f, macaddr8::g, macaddr8::h, i, ip_addr, ip_family, len, PGSQL_AF_INET, res, and value.

Referenced by convert_to_scalar(), gbt_inet_compress(), and gbt_inet_consistent().

◆ cstring_to_text()

text* cstring_to_text ( const char *  s)

Definition at line 182 of file varlena.c.

183 {
184  return cstring_to_text_with_len(s, strlen(s));
185 }
text * cstring_to_text_with_len(const char *s, int len)
Definition: varlena.c:194

References cstring_to_text_with_len().

Referenced by array_dims(), ASN1_STRING_to_text(), booltext(), brin_minmax_multi_summary_out(), brin_page_type(), build_test_info_result(), build_test_match_result(), cash_words(), cidr_abbrev(), convert_charset(), cstring_to_xmltype(), current_query(), datetime_to_char_body(), dblink_build_sql_delete(), dblink_build_sql_insert(), dblink_build_sql_update(), dblink_cancel_query(), dblink_close(), dblink_connect(), dblink_disconnect(), dblink_error_message(), dblink_exec(), dblink_open(), dmetaphone(), dmetaphone_alt(), exec_assign_c_string(), executeDateTimeMethod(), filter_list_to_array(), format_type(), get_command_tag(), get_command_type(), get_scalar(), hash_page_type(), inet_abbrev(), initcap(), json_in(), json_typeof(), jsonb_get_element(), jsonb_typeof(), JsonbValueAsText(), lower(), md5_bytea(), md5_text(), metaphone(), name_bpchar(), name_text(), network_host(), network_show(), oidvectortypes(), ParameterAclCreate(), ParameterAclLookup(), pg_collation_actual_version(), pg_collation_for(), pg_column_compression(), pg_crypt(), pg_current_logfile(), pg_database_collation_actual_version(), pg_describe_object(), pg_export_snapshot(), pg_get_statisticsobjdef_expressions(), pg_get_wal_replay_pause_state(), pg_parameter_aclmask(), pg_relation_filepath(), pg_size_pretty(), pg_size_pretty_numeric(), pg_stat_get_backend_activity(), pg_stat_get_backend_wait_event(), pg_stat_get_backend_wait_event_type(), pg_stat_get_slru(), pg_stats_ext_mcvlist_items(), pg_tablespace_location(), pg_walfile_name(), pg_xact_status(), pgsql_version(), pgxml_result_to_text(), quote_ident(), quote_ident_cstr(), quote_nullable(), sepgsql_getcon(), sepgsql_mcstrans_in(), sepgsql_mcstrans_out(), set_config_by_name(), show_all_file_settings(), show_config_by_name(), show_config_by_name_missing_ok(), ShowAllGUCConfig(), soundex(), split_part(), ssl_cipher(), ssl_client_dn(), ssl_issuer_dn(), ssl_version(), string_to_text(), test_canonicalize_path(), test_slru_page_read(), test_slru_page_readonly(), text_substring(), textin(), timeofday(), to_hex32(), to_hex64(), tsquerytree(), unaccent_dict(), upper(), xml_encode_special_chars(), xml_in(), and xml_recv().

◆ cstring_to_text_with_len()

text* cstring_to_text_with_len ( const char *  s,
int  len 
)

Definition at line 194 of file varlena.c.

195 {
196  text *result = (text *) palloc(len + VARHDRSZ);
197 
198  SET_VARSIZE(result, len + VARHDRSZ);
199  memcpy(VARDATA(result), s, len);
200 
201  return result;
202 }
#define VARHDRSZ
Definition: c.h:676
void * palloc(Size size)
Definition: mcxt.c:1210
Definition: c.h:671
#define VARDATA(PTR)
Definition: varatt.h:278

References len, palloc(), SET_VARSIZE, VARDATA, and VARHDRSZ.

Referenced by array_to_json(), array_to_json_pretty(), array_to_text_internal(), brin_minmax_multi_summary_out(), build_regexp_match_result(), build_regexp_split_result(), build_test_match_result(), compute_tsvector_stats(), concat_internal(), cstring_to_text(), do_text_output_multiline(), dotrim(), each_object_field_end(), each_worker_jsonb(), elements_array_element_end(), ExecEvalXmlExpr(), executeDateTimeMethod(), executeLikeRegex(), fsm_page_contents(), get_array_element_end(), get_array_end(), get_object_end(), get_object_field_end(), get_scalar(), gin_extract_tsquery(), gin_extract_tsvector(), hstore_akeys(), hstore_avals(), hstore_each(), hstore_fetchval(), hstore_skeys(), hstore_slice_to_array(), hstore_subscript_fetch(), hstore_svals(), hstore_to_array_internal(), hstore_to_json(), hstore_to_json_loose(), json_build_array(), json_build_array_noargs(), json_build_object(), json_build_object_noargs(), json_object(), json_object_two_arg(), json_recv(), json_strip_nulls(), jsonb_pretty(), JsonbValueAsText(), leftmostvalue_text(), LogicalOutputWrite(), parse_ident(), pg_gen_salt(), pg_gen_salt_rounds(), pg_get_function_sqlbody(), replace_text(), replace_text_regexp(), row_to_json(), row_to_json_pretty(), serialize_deflist(), split_part(), split_text(), ssl_extension_info(), string_agg_finalfn(), stringinfo_to_xmltype(), text_format(), text_left(), text_right(), textrecv(), to_json(), transform_json_string_values(), tsquerytree(), tsvector_to_array(), tsvector_unnest(), unistr(), varchar(), varchar_input(), and xslt_process().

◆ domain_check()

void domain_check ( Datum  value,
bool  isnull,
Oid  domainType,
void **  extra,
MemoryContext  mcxt 
)

Definition at line 343 of file domains.c.

345 {
346  DomainIOData *my_extra = NULL;
347 
348  if (mcxt == NULL)
349  mcxt = CurrentMemoryContext;
350 
351  /*
352  * We arrange to look up the needed info just once per series of calls,
353  * assuming the domain type doesn't change underneath us (which really
354  * shouldn't happen, but cope if it does).
355  */
356  if (extra)
357  my_extra = (DomainIOData *) *extra;
358  if (my_extra == NULL || my_extra->domain_type != domainType)
359  {
360  my_extra = domain_state_setup(domainType, true, mcxt);
361  if (extra)
362  *extra = (void *) my_extra;
363  }
364 
365  /*
366  * Do the necessary checks to ensure it's a valid domain value.
367  */
368  domain_check_input(value, isnull, my_extra, NULL);
369 }
static void domain_check_input(Datum value, bool isnull, DomainIOData *my_extra, Node *escontext)
Definition: domains.c:135
static DomainIOData * domain_state_setup(Oid domainType, bool binary, MemoryContext mcxt)
Definition: domains.c:73
MemoryContext CurrentMemoryContext
Definition: mcxt.c:135
Oid domain_type
Definition: domains.c:49

References CurrentMemoryContext, domain_check_input(), domain_state_setup(), DomainIOData::domain_type, and value.

Referenced by check_domain_for_new_field(), check_domain_for_new_tuple(), expanded_record_set_fields(), hstore_populate_record(), plperl_return_next_internal(), plperl_sv_to_datum(), plpgsql_exec_function(), pltcl_build_tuple_result(), PLyObject_ToDomain(), populate_composite(), populate_domain(), and populate_recordset_record().

◆ errdatatype()

int errdatatype ( Oid  datatypeOid)

Definition at line 376 of file domains.c.

377 {
378  HeapTuple tup;
379  Form_pg_type typtup;
380 
381  tup = SearchSysCache1(TYPEOID, ObjectIdGetDatum(datatypeOid));
382  if (!HeapTupleIsValid(tup))
383  elog(ERROR, "cache lookup failed for type %u", datatypeOid);
384  typtup = (Form_pg_type) GETSTRUCT(tup);
385 
387  get_namespace_name(typtup->typnamespace));
389 
390  ReleaseSysCache(tup);
391 
392  return 0; /* return value does not matter */
393 }
#define NameStr(name)
Definition: c.h:730
int err_generic_string(int field, const char *str)
Definition: elog.c:1511
#define ERROR
Definition: elog.h:39
#define HeapTupleIsValid(tuple)
Definition: htup.h:78
#define GETSTRUCT(TUP)
Definition: htup_details.h:653
char * get_namespace_name(Oid nspid)
Definition: lsyscache.c:3331
FormData_pg_type * Form_pg_type
Definition: pg_type.h:261
static Datum ObjectIdGetDatum(Oid X)
Definition: postgres.h:252
#define PG_DIAG_SCHEMA_NAME
Definition: postgres_ext.h:64
#define PG_DIAG_DATATYPE_NAME
Definition: postgres_ext.h:67
void ReleaseSysCache(HeapTuple tuple)
Definition: syscache.c:865
HeapTuple SearchSysCache1(int cacheId, Datum key1)
Definition: syscache.c:817
@ TYPEOID
Definition: syscache.h:114

References elog(), err_generic_string(), ERROR, get_namespace_name(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), PG_DIAG_DATATYPE_NAME, PG_DIAG_SCHEMA_NAME, ReleaseSysCache(), SearchSysCache1(), and TYPEOID.

Referenced by domain_check_input(), errdomainconstraint(), and ExecEvalConstraintNotNull().

◆ errdomainconstraint()

int errdomainconstraint ( Oid  datatypeOid,
const char *  conname 
)

Definition at line 400 of file domains.c.

401 {
402  errdatatype(datatypeOid);
404 
405  return 0; /* return value does not matter */
406 }
int errdatatype(Oid datatypeOid)
Definition: domains.c:376
#define PG_DIAG_CONSTRAINT_NAME
Definition: postgres_ext.h:68

References err_generic_string(), errdatatype(), and PG_DIAG_CONSTRAINT_NAME.

Referenced by domain_check_input(), and ExecEvalConstraintCheck().

◆ format_type_be()

char* format_type_be ( Oid  type_oid)

Definition at line 339 of file format_type.c.

340 {
341  return format_type_extended(type_oid, -1, 0);
342 }
char * format_type_extended(Oid type_oid, int32 typemod, bits16 flags)
Definition: format_type.c:112

References format_type_extended().

Referenced by aclcheck_error_type(), addFamilyMember(), addRangeTableEntryForFunction(), AggregateCreate(), AlterType(), AlterTypeNamespace(), AlterTypeNamespace_oid(), AlterTypeNamespaceInternal(), AlterTypeOwner(), analyzeCTE(), appendTypeNameToBuffer(), array_cat(), array_cmp(), array_contain_compare(), array_eq(), array_position_common(), array_positions(), array_recv(), array_replace_internal(), array_send(), assign_record_type_identifier(), ATAddForeignKeyConstraint(), ATExecAlterColumnType(), ATPrepAlterColumnType(), brinvalidate(), btvalidate(), build_attrmap_by_name(), build_column_default(), build_datatype(), build_subplan(), CastCreate(), check_object_ownership(), check_of_type(), check_safe_enum_use(), check_sql_fn_retval(), check_valid_polymorphic_signature(), CheckAttributeType(), checkDomainOwner(), checkEnumOwner(), checkRuleResultList(), CheckVarSlotCompatibility(), coerce_record_to_complex(), coerce_to_boolean(), coerce_to_common_type(), coerce_to_specific_type_typmod(), coerce_type(), compare_values_of_enum(), compile_plperl_function(), compile_pltcl_function(), ComputeIndexAttrs(), ComputePartitionAttrs(), cookDefault(), create_ctas_nodata(), CreateCast(), CreateFunction(), CreateStatistics(), CreateTransform(), DefineAggregate(), DefineDomain(), DefineRange(), DefineType(), do_compile(), domain_check_input(), domain_state_setup(), dropOperators(), dropProcedures(), enforce_generic_type_consistency(), enum_first(), enum_in(), enum_last(), enum_recv(), EvaluateParams(), exec_stmt_foreach_a(), ExecBuildUpdateProjection(), ExecCheckPlanOutput(), ExecEvalArrayExpr(), ExecEvalConstraintCheck(), ExecEvalConstraintNotNull(), ExecEvalFieldSelect(), ExecEvalParamExtern(), ExecEvalWholeRowVar(), ExecInitAgg(), ExecInitExprRec(), ExecInitSubscriptingRef(), exprType(), extract_date(), fetch_cursor_param_value(), findRangeSubOpclass(), findTypeInputFunction(), findTypeReceiveFunction(), fmgr_sql_validator(), format_operator_extended(), format_procedure_extended(), funcname_signature_string(), get_cached_rowtype(), get_cast_oid(), get_domain_constraint_oid(), get_expr_result_tupdesc(), get_multirange_io_data(), get_range_io_data(), get_rels_with_domain(), get_sort_group_operators(), get_transform_oid(), get_ts_parser_func(), get_ts_template_func(), GetAttributeCompression(), GetAttributeStorage(), GetColumnDefCollation(), GetDefaultOpClass(), getObjectDescription(), getTypeBinaryInputInfo(), getTypeBinaryOutputInfo(), getTypeInputInfo(), getTypeOutputInfo(), hash_array(), hash_array_extended(), hash_multirange(), hash_multirange_extended(), hash_range(), hash_range_extended(), hash_record(), hash_record_extended(), hashvalidate(), init_params(), initArrayResultArr(), initGinState(), internal_get_result_type(), interval_part_common(), interval_trunc(), intorel_startup(), jsonb_subscript_transform(), load_enum_cache_data(), lookup_rowtype_tupdesc_domain(), lookup_rowtype_tupdesc_internal(), LookupTypeNameExtended(), make_expanded_record_from_tupdesc(), make_expanded_record_from_typeid(), make_row_comparison_op(), make_scalar_array_op(), NonFiniteTimestampTzPart(), op_signature_string(), ParseFuncOrColumn(), pg_collation_for(), plperl_array_to_datum(), plperl_sv_to_datum(), plperl_validator(), plpgsql_build_variable(), plpgsql_param_eval_generic(), plpgsql_param_eval_generic_ro(), plpgsql_param_eval_recfield(), plpgsql_validator(), PLy_procedure_create(), prepare_sql_fn_parse_info(), print_function_arguments(), print_function_rettype(), print_function_trftypes(), processIndirection(), record_cmp(), record_eq(), record_image_cmp(), record_image_eq(), regtypeout(), RelationBuildPartitionKey(), RenameConstraintById(), RenameType(), resolve_anyarray_from_others(), resolve_anyelement_from_others(), resolve_anymultirange_from_others(), resolve_anyrange_from_others(), ResolveOpClass(), revalidate_rectypeid(), ri_HashCompareOp(), satisfies_hash_partition(), select_common_type(), select_common_type_from_oids(), spgvalidate(), storeOperators(), storeProcedures(), time_part_common(), timestamp_part_common(), timestamp_trunc(), timestamptz_part_common(), timestamptz_trunc_internal(), timetz_part_common(), transformAggregateCall(), transformArrayExpr(), transformAssignedExpr(), transformAssignmentIndirection(), transformAssignmentSubscripts(), transformCollateClause(), transformColumnType(), transformContainerSubscripts(), transformFrameOffset(), transformPartitionBoundValue(), transformPLAssignStmt(), transformTypeCast(), transformXmlSerialize(), tuple_to_stringinfo(), tupledesc_match(), tuples_equal(), unknown_attribute(), validateConnectbyTupleDesc(), variable_coerce_param_hook(), and width_bucket_array().

◆ format_type_be_qualified()

char* format_type_be_qualified ( Oid  type_oid)

◆ format_type_extended()

char* format_type_extended ( Oid  type_oid,
int32  typemod,
bits16  flags 
)

Definition at line 112 of file format_type.c.

113 {
114  HeapTuple tuple;
115  Form_pg_type typeform;
116  Oid array_base_type;
117  bool is_array;
118  char *buf;
119  bool with_typemod;
120 
121  if (type_oid == InvalidOid)
122  {
123  if ((flags & FORMAT_TYPE_INVALID_AS_NULL) != 0)
124  return NULL;
125  else if ((flags & FORMAT_TYPE_ALLOW_INVALID) != 0)
126  return pstrdup("-");
127  }
128 
129  tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(type_oid));
130  if (!HeapTupleIsValid(tuple))
131  {
132  if ((flags & FORMAT_TYPE_INVALID_AS_NULL) != 0)
133  return NULL;
134  else if ((flags & FORMAT_TYPE_ALLOW_INVALID) != 0)
135  return pstrdup("???");
136  else
137  elog(ERROR, "cache lookup failed for type %u", type_oid);
138  }
139  typeform = (Form_pg_type) GETSTRUCT(tuple);
140 
141  /*
142  * Check if it's a "true" array type. Pseudo-array types such as "name"
143  * shouldn't get deconstructed. Also check the toast property, and don't
144  * deconstruct "plain storage" array types --- this is because we don't
145  * want to show oidvector as oid[].
146  */
147  array_base_type = typeform->typelem;
148 
149  if (IsTrueArrayType(typeform) &&
150  typeform->typstorage != TYPSTORAGE_PLAIN)
151  {
152  /* Switch our attention to the array element type */
153  ReleaseSysCache(tuple);
154  tuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(array_base_type));
155  if (!HeapTupleIsValid(tuple))
156  {
157  if ((flags & FORMAT_TYPE_INVALID_AS_NULL) != 0)
158  return NULL;
159  else if ((flags & FORMAT_TYPE_ALLOW_INVALID) != 0)
160  return pstrdup("???[]");
161  else
162  elog(ERROR, "cache lookup failed for type %u", type_oid);
163  }
164  typeform = (Form_pg_type) GETSTRUCT(tuple);
165  type_oid = array_base_type;
166  is_array = true;
167  }
168  else
169  is_array = false;
170 
171  with_typemod = (flags & FORMAT_TYPE_TYPEMOD_GIVEN) != 0 && (typemod >= 0);
172 
173  /*
174  * See if we want to special-case the output for certain built-in types.
175  * Note that these special cases should all correspond to special
176  * productions in gram.y, to ensure that the type name will be taken as a
177  * system type, not a user type of the same name.
178  *
179  * If we do not provide a special-case output here, the type name will be
180  * handled the same way as a user type name --- in particular, it will be
181  * double-quoted if it matches any lexer keyword. This behavior is
182  * essential for some cases, such as types "bit" and "char".
183  */
184  buf = NULL; /* flag for no special case */
185 
186  switch (type_oid)
187  {
188  case BITOID:
189  if (with_typemod)
190  buf = printTypmod("bit", typemod, typeform->typmodout);
191  else if ((flags & FORMAT_TYPE_TYPEMOD_GIVEN) != 0)
192  {
193  /*
194  * bit with typmod -1 is not the same as BIT, which means
195  * BIT(1) per SQL spec. Report it as the quoted typename so
196  * that parser will not assign a bogus typmod.
197  */
198  }
199  else
200  buf = pstrdup("bit");
201  break;
202 
203  case BOOLOID:
204  buf = pstrdup("boolean");
205  break;
206 
207  case BPCHAROID:
208  if (with_typemod)
209  buf = printTypmod("character", typemod, typeform->typmodout);
210  else if ((flags & FORMAT_TYPE_TYPEMOD_GIVEN) != 0)
211  {
212  /*
213  * bpchar with typmod -1 is not the same as CHARACTER, which
214  * means CHARACTER(1) per SQL spec. Report it as bpchar so
215  * that parser will not assign a bogus typmod.
216  */
217  }
218  else
219  buf = pstrdup("character");
220  break;
221 
222  case FLOAT4OID:
223  buf = pstrdup("real");
224  break;
225 
226  case FLOAT8OID:
227  buf = pstrdup("double precision");
228  break;
229 
230  case INT2OID:
231  buf = pstrdup("smallint");
232  break;
233 
234  case INT4OID:
235  buf = pstrdup("integer");
236  break;
237 
238  case INT8OID:
239  buf = pstrdup("bigint");
240  break;
241 
242  case NUMERICOID:
243  if (with_typemod)
244  buf = printTypmod("numeric", typemod, typeform->typmodout);
245  else
246  buf = pstrdup("numeric");
247  break;
248 
249  case INTERVALOID:
250  if (with_typemod)
251  buf = printTypmod("interval", typemod, typeform->typmodout);
252  else
253  buf = pstrdup("interval");
254  break;
255 
256  case TIMEOID:
257  if (with_typemod)
258  buf = printTypmod("time", typemod, typeform->typmodout);
259  else
260  buf = pstrdup("time without time zone");
261  break;
262 
263  case TIMETZOID:
264  if (with_typemod)
265  buf = printTypmod("time", typemod, typeform->typmodout);
266  else
267  buf = pstrdup("time with time zone");
268  break;
269 
270  case TIMESTAMPOID:
271  if (with_typemod)
272  buf = printTypmod("timestamp", typemod, typeform->typmodout);
273  else
274  buf = pstrdup("timestamp without time zone");
275  break;
276 
277  case TIMESTAMPTZOID:
278  if (with_typemod)
279  buf = printTypmod("timestamp", typemod, typeform->typmodout);
280  else
281  buf = pstrdup("timestamp with time zone");
282  break;
283 
284  case VARBITOID:
285  if (with_typemod)
286  buf = printTypmod("bit varying", typemod, typeform->typmodout);
287  else
288  buf = pstrdup("bit varying");
289  break;
290 
291  case VARCHAROID:
292  if (with_typemod)
293  buf = printTypmod("character varying", typemod, typeform->typmodout);
294  else
295  buf = pstrdup("character varying");
296  break;
297  }
298 
299  if (buf == NULL)
300  {
301  /*
302  * Default handling: report the name as it appears in the catalog.
303  * Here, we must qualify the name if it is not visible in the search
304  * path or if caller requests it; and we must double-quote it if it's
305  * not a standard identifier or if it matches any keyword.
306  */
307  char *nspname;
308  char *typname;
309 
310  if ((flags & FORMAT_TYPE_FORCE_QUALIFY) == 0 &&
311  TypeIsVisible(type_oid))
312  nspname = NULL;
313  else
314  nspname = get_namespace_name_or_temp(typeform->typnamespace);
315 
316  typname = NameStr(typeform->typname);
317 
319 
320  if (with_typemod)
321  buf = printTypmod(buf, typemod, typeform->typmodout);
322  }
323 
324  if (is_array)
325  buf = psprintf("%s[]", buf);
326 
327  ReleaseSysCache(tuple);
328 
329  return buf;
330 }
#define FORMAT_TYPE_ALLOW_INVALID
Definition: builtins.h:122
#define FORMAT_TYPE_INVALID_AS_NULL
Definition: builtins.h:124
#define FORMAT_TYPE_TYPEMOD_GIVEN
Definition: builtins.h:121
static char * printTypmod(const char *typname, int32 typmod, Oid typmodout)
Definition: format_type.c:367
char * get_namespace_name_or_temp(Oid nspid)
Definition: lsyscache.c:3355
char * pstrdup(const char *in)
Definition: mcxt.c:1624
bool TypeIsVisible(Oid typid)
Definition: namespace.c:819
static char * buf
Definition: pg_test_fsync.c:67
NameData typname
Definition: pg_type.h:41
#define InvalidOid
Definition: postgres_ext.h:36
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
char * quote_qualified_identifier(const char *qualifier, const char *ident)
Definition: ruleutils.c:11635

References buf, elog(), ERROR, FORMAT_TYPE_ALLOW_INVALID, FORMAT_TYPE_FORCE_QUALIFY, FORMAT_TYPE_INVALID_AS_NULL, FORMAT_TYPE_TYPEMOD_GIVEN, get_namespace_name_or_temp(), GETSTRUCT, HeapTupleIsValid, InvalidOid, NameStr, ObjectIdGetDatum(), printTypmod(), psprintf(), pstrdup(), quote_qualified_identifier(), ReleaseSysCache(), SearchSysCache1(), TypeIsVisible(), TYPEOID, and typname.

Referenced by array_recv(), deparse_type_name(), format_type(), format_type_be(), format_type_be_qualified(), format_type_with_typemod(), gbtreekey_in(), getObjectDescription(), getObjectIdentityParts(), lookup_am_handler_func(), oidvectortypes(), and record_recv().

◆ format_type_with_typemod()

◆ generate_operator_clause()

void generate_operator_clause ( fmStringInfo  buf,
const char *  leftop,
Oid  leftoptype,
Oid  opoid,
const char *  rightop,
Oid  rightoptype 
)

Definition at line 11959 of file ruleutils.c.

11963 {
11964  HeapTuple opertup;
11965  Form_pg_operator operform;
11966  char *oprname;
11967  char *nspname;
11968 
11969  opertup = SearchSysCache1(OPEROID, ObjectIdGetDatum(opoid));
11970  if (!HeapTupleIsValid(opertup))
11971  elog(ERROR, "cache lookup failed for operator %u", opoid);
11972  operform = (Form_pg_operator) GETSTRUCT(opertup);
11973  Assert(operform->oprkind == 'b');
11974  oprname = NameStr(operform->oprname);
11975 
11976  nspname = get_namespace_name(operform->oprnamespace);
11977 
11978  appendStringInfoString(buf, leftop);
11979  if (leftoptype != operform->oprleft)
11980  add_cast_to(buf, operform->oprleft);
11981  appendStringInfo(buf, " OPERATOR(%s.", quote_identifier(nspname));
11982  appendStringInfoString(buf, oprname);
11983  appendStringInfo(buf, ") %s", rightop);
11984  if (rightoptype != operform->oprright)
11985  add_cast_to(buf, operform->oprright);
11986 
11987  ReleaseSysCache(opertup);
11988 }
Assert(fmt[strlen(fmt) - 1] !='\n')
FormData_pg_operator * Form_pg_operator
Definition: pg_operator.h:83
const char * quote_identifier(const char *ident)
Definition: ruleutils.c:11551
static void add_cast_to(StringInfo buf, Oid typid)
Definition: ruleutils.c:11999
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:91
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:176
@ OPEROID
Definition: syscache.h:72

References add_cast_to(), appendStringInfo(), appendStringInfoString(), Assert(), buf, elog(), ERROR, get_namespace_name(), GETSTRUCT, HeapTupleIsValid, NameStr, ObjectIdGetDatum(), OPEROID, quote_identifier(), ReleaseSysCache(), and SearchSysCache1().

Referenced by refresh_by_match_merge(), and ri_GenerateQual().

◆ 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 }
int errcode(int sqlerrcode)
Definition: elog.c:858
int errmsg(const char *fmt,...)
Definition: elog.c:1069
#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_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().

◆ namestrcmp()

int namestrcmp ( Name  name,
const char *  str 
)

Definition at line 247 of file name.c.

248 {
249  if (!name && !str)
250  return 0;
251  if (!name)
252  return -1; /* NULL < anything */
253  if (!str)
254  return 1; /* NULL < anything */
255  return strncmp(NameStr(*name), str, NAMEDATALEN);
256 }
const char * name
Definition: encode.c:571
#define NAMEDATALEN

References name, NAMEDATALEN, NameStr, and generate_unaccent_rules::str.

Referenced by attnameAttNum(), CopyGetAttnums(), expanded_record_lookup_field(), GetAttributeByName(), NextCopyFromRawFields(), and SPI_fnumber().

◆ namestrcpy()

◆ network_scan_first()

Datum network_scan_first ( Datum  in)

Definition at line 1690 of file network.c.

1691 {
1693 }
#define DirectFunctionCall1(func, arg1)
Definition: fmgr.h:642
Datum network_network(PG_FUNCTION_ARGS)
Definition: network.c:1330

References DirectFunctionCall1, and network_network().

Referenced by match_network_subset().

◆ network_scan_last()

Datum network_scan_last ( Datum  in)

Definition at line 1704 of file network.c.

1705 {
1708  Int32GetDatum(-1));
1709 }
#define DirectFunctionCall2(func, arg1, arg2)
Definition: fmgr.h:644
Datum network_broadcast(PG_FUNCTION_ARGS)
Definition: network.c:1285
Datum inet_set_masklen(PG_FUNCTION_ARGS)
Definition: network.c:324
static Datum Int32GetDatum(int32 X)
Definition: postgres.h:212

References DirectFunctionCall1, DirectFunctionCall2, inet_set_masklen(), Int32GetDatum(), and network_broadcast().

Referenced by match_network_subset().

◆ numeric_float8_no_overflow()

Datum numeric_float8_no_overflow ( PG_FUNCTION_ARGS  )

Definition at line 4572 of file numeric.c.

4573 {
4574  Numeric num = PG_GETARG_NUMERIC(0);
4575  double val;
4576 
4577  if (NUMERIC_IS_SPECIAL(num))
4578  {
4579  if (NUMERIC_IS_PINF(num))
4580  val = HUGE_VAL;
4581  else if (NUMERIC_IS_NINF(num))
4582  val = -HUGE_VAL;
4583  else
4584  val = get_float8_nan();
4585  }
4586  else
4587  {
4588  NumericVar x;
4589 
4590  init_var_from_num(num, &x);
4592  }
4593 
4595 }
#define NUMERIC_IS_SPECIAL(n)
Definition: numeric.c:173
static void init_var_from_num(Numeric num, NumericVar *dest)
Definition: numeric.c:7370
#define NUMERIC_IS_PINF(n)
Definition: numeric.c:205
#define NUMERIC_IS_NINF(n)
Definition: numeric.c:206
static double numericvar_to_double_no_overflow(const NumericVar *var)
Definition: numeric.c:8260
static float8 get_float8_nan(void)
Definition: float.h:123
#define PG_RETURN_FLOAT8(x)
Definition: fmgr.h:367
long val
Definition: informix.c:664
int x
Definition: isn.c:71
#define PG_GETARG_NUMERIC(n)
Definition: numeric.h:77

References get_float8_nan(), init_var_from_num(), NUMERIC_IS_NINF, NUMERIC_IS_PINF, NUMERIC_IS_SPECIAL, numericvar_to_double_no_overflow(), PG_GETARG_NUMERIC, PG_RETURN_FLOAT8, val, and x.

Referenced by convert_numeric_to_scalar(), and gbt_numeric_penalty().

◆ oid_cmp()

int oid_cmp ( const void *  p1,
const void *  p2 
)

Definition at line 257 of file oid.c.

258 {
259  Oid v1 = *((const Oid *) p1);
260  Oid v2 = *((const Oid *) p2);
261 
262  if (v1 < v2)
263  return -1;
264  if (v1 > v2)
265  return 1;
266  return 0;
267 }

References p2.

Referenced by aclmembers(), AlterSubscription_refresh(), EnumValuesCreate(), and find_inheritance_children_extended().

◆ oidparse()

Oid oidparse ( Node node)

Definition at line 234 of file oid.c.

235 {
236  switch (nodeTag(node))
237  {
238  case T_Integer:
239  return intVal(node);
240  case T_Float:
241 
242  /*
243  * Values too large for int4 will be represented as Float
244  * constants by the lexer. Accept these if they are valid OID
245  * strings.
246  */
247  return uint32in_subr(castNode(Float, node)->fval, NULL,
248  "oid", NULL);
249  default:
250  elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node));
251  }
252  return InvalidOid; /* keep compiler quiet */
253 }
#define nodeTag(nodeptr)
Definition: nodes.h:133
#define castNode(_type_, nodeptr)
Definition: nodes.h:197
uint32 uint32in_subr(const char *s, char **endloc, const char *typname, Node *escontext)
Definition: numutils.c:649
Definition: value.h:48
#define intVal(v)
Definition: value.h:79

References castNode, elog(), ERROR, intVal, InvalidOid, nodeTag, and uint32in_subr().

Referenced by get_object_address(), and objectNamesToOids().

◆ parse_bool()

bool parse_bool ( const char *  value,
bool result 
)

Definition at line 30 of file bool.c.

31 {
32  return parse_bool_with_len(value, strlen(value), result);
33 }
bool parse_bool_with_len(const char *value, size_t len, bool *result)
Definition: bool.c:36

References parse_bool_with_len(), and value.

Referenced by GrantRole(), parse_and_validate_value(), parse_basebackup_options(), parse_extension_control_file(), parse_one_reloption(), pg_decode_startup(), and ProcessStartupPacket().

◆ parse_bool_with_len()

bool parse_bool_with_len ( const char *  value,
size_t  len,
bool result 
)

Definition at line 36 of file bool.c.

37 {
38  switch (*value)
39  {
40  case 't':
41  case 'T':
42  if (pg_strncasecmp(value, "true", len) == 0)
43  {
44  if (result)
45  *result = true;
46  return true;
47  }
48  break;
49  case 'f':
50  case 'F':
51  if (pg_strncasecmp(value, "false", len) == 0)
52  {
53  if (result)
54  *result = false;
55  return true;
56  }
57  break;
58  case 'y':
59  case 'Y':
60  if (pg_strncasecmp(value, "yes", len) == 0)
61  {
62  if (result)
63  *result = true;
64  return true;
65  }
66  break;
67  case 'n':
68  case 'N':
69  if (pg_strncasecmp(value, "no", len) == 0)
70  {
71  if (result)
72  *result = false;
73  return true;
74  }
75  break;
76  case 'o':
77  case 'O':
78  /* 'o' is not unique enough */
79  if (pg_strncasecmp(value, "on", (len > 2 ? len : 2)) == 0)
80  {
81  if (result)
82  *result = true;
83  return true;
84  }
85  else if (pg_strncasecmp(value, "off", (len > 2 ? len : 2)) == 0)
86  {
87  if (result)
88  *result = false;
89  return true;
90  }
91  break;
92  case '1':
93  if (len == 1)
94  {
95  if (result)
96  *result = true;
97  return true;
98  }
99  break;
100  case '0':
101  if (len == 1)
102  {
103  if (result)
104  *result = false;
105  return true;
106  }
107  break;
108  default:
109  break;
110  }
111 
112  if (result)
113  *result = false; /* suppress compiler warning */
114  return false;
115 }
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
Definition: pgstrcasecmp.c:69

References len, pg_strncasecmp(), and value.

Referenced by boolin(), and parse_bool().

◆ pg_inet_cidr_ntop()

char* pg_inet_cidr_ntop ( int  af,
const void *  src,
int  bits,
char *  dst,
size_t  size 
)

Definition at line 56 of file inet_cidr_ntop.c.

57 {
58  switch (af)
59  {
60  case PGSQL_AF_INET:
61  return inet_cidr_ntop_ipv4(src, bits, dst, size);
62  case PGSQL_AF_INET6:
63  return inet_cidr_ntop_ipv6(src, bits, dst, size);
64  default:
65  errno = EAFNOSUPPORT;
66  return NULL;
67  }
68 }
static char * inet_cidr_ntop_ipv6(const u_char *src, int bits, char *dst, size_t size)
static char * inet_cidr_ntop_ipv4(const u_char *src, int bits, char *dst, size_t size)
#define PGSQL_AF_INET6
Definition: inet.h:40
#define EAFNOSUPPORT
Definition: win32_port.h:380

References EAFNOSUPPORT, inet_cidr_ntop_ipv4(), inet_cidr_ntop_ipv6(), PGSQL_AF_INET, and PGSQL_AF_INET6.

Referenced by cidr_abbrev().

◆ pg_inet_net_pton()

int pg_inet_net_pton ( int  af,
const char *  src,
void *  dst,
size_t  size 
)

Definition at line 62 of file inet_net_pton.c.

63 {
64  switch (af)
65  {
66  case PGSQL_AF_INET:
67  return size == -1 ?
68  inet_net_pton_ipv4(src, dst) :
69  inet_cidr_pton_ipv4(src, dst, size);
70  case PGSQL_AF_INET6:
71  return size == -1 ?
72  inet_net_pton_ipv6(src, dst) :
73  inet_cidr_pton_ipv6(src, dst, size);
74  default:
75  errno = EAFNOSUPPORT;
76  return -1;
77  }
78 }
static int inet_net_pton_ipv6(const char *src, u_char *dst)
static int inet_net_pton_ipv4(const char *src, u_char *dst)
static int inet_cidr_pton_ipv6(const char *src, u_char *dst, size_t size)
static int inet_cidr_pton_ipv4(const char *src, u_char *dst, size_t size)
Definition: inet_net_pton.c:97

References EAFNOSUPPORT, inet_cidr_pton_ipv4(), inet_cidr_pton_ipv6(), inet_net_pton_ipv4(), inet_net_pton_ipv6(), PGSQL_AF_INET, and PGSQL_AF_INET6.

Referenced by network_in().

◆ pg_itoa()

int pg_itoa ( int16  i,
char *  a 
)

Definition at line 793 of file numutils.c.

794 {
795  return pg_ltoa((int32) i, a);
796 }
signed int int32
Definition: c.h:478
int a
Definition: isn.c:69
int pg_ltoa(int32 value, char *a)
Definition: numutils.c:871

References a, i, and pg_ltoa().

Referenced by int2out(), int2vectorout(), LogicalTapeImport(), and LogicalTapeSetCreate().

◆ pg_lltoa()

int pg_lltoa ( int64  value,
char *  a 
)

Definition at line 978 of file numutils.c.

979 {
980  uint64 uvalue = value;
981  int len = 0;
982 
983  if (value < 0)
984  {
985  uvalue = (uint64) 0 - uvalue;
986  a[len++] = '-';
987  }
988 
989  len += pg_ulltoa_n(uvalue, a + len);
990  a[len] = '\0';
991  return len;
992 }
int pg_ulltoa_n(uint64 value, char *a)
Definition: numutils.c:891

References a, len, pg_ulltoa_n(), and value.

Referenced by int8out(), and printsimple().

◆ pg_ltoa()

int pg_ltoa ( int32  value,
char *  a 
)

Definition at line 871 of file numutils.c.

872 {
873  uint32 uvalue = (uint32) value;
874  int len = 0;
875 
876  if (value < 0)
877  {
878  uvalue = (uint32) 0 - uvalue;
879  a[len++] = '-';
880  }
881  len += pg_ultoa_n(uvalue, a + len);
882  a[len] = '\0';
883  return len;
884 }
unsigned int uint32
Definition: c.h:490
int pg_ultoa_n(uint32 value, char *a)
Definition: numutils.c:806

References a, len, pg_ultoa_n(), and value.

Referenced by int4out(), pg_itoa(), and printsimple().

◆ pg_strtoint16()

int16 pg_strtoint16 ( const char *  s)

Definition at line 113 of file numutils.c.

114 {
115  return pg_strtoint16_safe(s, NULL);
116 }
int16 pg_strtoint16_safe(const char *s, Node *escontext)
Definition: numutils.c:119

References pg_strtoint16_safe().

◆ pg_strtoint16_safe()

int16 pg_strtoint16_safe ( const char *  s,
Node escontext 
)

Definition at line 119 of file numutils.c.

120 {
121  const char *ptr = s;
122  const char *firstdigit;
123  uint16 tmp = 0;
124  bool neg = false;
125 
126  /* skip leading spaces */
127  while (likely(*ptr) && isspace((unsigned char) *ptr))
128  ptr++;
129 
130  /* handle sign */
131  if (*ptr == '-')
132  {
133  ptr++;
134  neg = true;
135  }
136  else if (*ptr == '+')
137  ptr++;
138 
139  /* process digits */
140  if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X'))
141  {
142  firstdigit = ptr += 2;
143 
144  while (*ptr)
145  {
146  if (isxdigit((unsigned char) *ptr))
147  {
148  if (unlikely(tmp > -(PG_INT16_MIN / 16)))
149  goto out_of_range;
150 
151  tmp = tmp * 16 + hexlookup[(unsigned char) *ptr++];
152  }
153  else if (*ptr == '_')
154  {
155  /* underscore must be followed by more digits */
156  ptr++;
157  if (*ptr == '\0' || !isxdigit((unsigned char) *ptr))
158  goto invalid_syntax;
159  }
160  else
161  break;
162  }
163  }
164  else if (ptr[0] == '0' && (ptr[1] == 'o' || ptr[1] == 'O'))
165  {
166  firstdigit = ptr += 2;
167 
168  while (*ptr)
169  {
170  if (*ptr >= '0' && *ptr <= '7')
171  {
172  if (unlikely(tmp > -(PG_INT16_MIN / 8)))
173  goto out_of_range;
174 
175  tmp = tmp * 8 + (*ptr++ - '0');
176  }
177  else if (*ptr == '_')
178  {
179  /* underscore must be followed by more digits */
180  ptr++;
181  if (*ptr == '\0' || *ptr < '0' || *ptr > '7')
182  goto invalid_syntax;
183  }
184  else
185  break;
186  }
187  }
188  else if (ptr[0] == '0' && (ptr[1] == 'b' || ptr[1] == 'B'))
189  {
190  firstdigit = ptr += 2;
191 
192  while (*ptr)
193  {
194  if (*ptr >= '0' && *ptr <= '1')
195  {
196  if (unlikely(tmp > -(PG_INT16_MIN / 2)))
197  goto out_of_range;
198 
199  tmp = tmp * 2 + (*ptr++ - '0');
200  }
201  else if (*ptr == '_')
202  {
203  /* underscore must be followed by more digits */
204  ptr++;
205  if (*ptr == '\0' || *ptr < '0' || *ptr > '1')
206  goto invalid_syntax;
207  }
208  else
209  break;
210  }
211  }
212  else
213  {
214  firstdigit = ptr;
215 
216  while (*ptr)
217  {
218  if (isdigit((unsigned char) *ptr))
219  {
220  if (unlikely(tmp > -(PG_INT16_MIN / 10)))
221  goto out_of_range;
222 
223  tmp = tmp * 10 + (*ptr++ - '0');
224  }
225  else if (*ptr == '_')
226  {
227  /* underscore may not be first */
228  if (unlikely(ptr == firstdigit))
229  goto invalid_syntax;
230  /* and it must be followed by more digits */
231  ptr++;
232  if (*ptr == '\0' || !isdigit((unsigned char) *ptr))
233  goto invalid_syntax;
234  }
235  else
236  break;
237  }
238  }
239 
240  /* require at least one digit */
241  if (unlikely(ptr == firstdigit))
242  goto invalid_syntax;
243 
244  /* allow trailing whitespace, but not other trailing chars */
245  while (*ptr != '\0' && isspace((unsigned char) *ptr))
246  ptr++;
247 
248  if (unlikely(*ptr != '\0'))
249  goto invalid_syntax;
250 
251  if (neg)
252  {
253  /* check the negative equivalent will fit without overflowing */
254  if (tmp > (uint16) (-(PG_INT16_MIN + 1)) + 1)
255  goto out_of_range;
256  return -((int16) tmp);
257  }
258 
259  if (tmp > PG_INT16_MAX)
260  goto out_of_range;
261 
262  return (int16) tmp;
263 
264 out_of_range:
265  ereturn(escontext, 0,
266  (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
267  errmsg("value \"%s\" is out of range for type %s",
268  s, "smallint")));
269 
270 invalid_syntax:
271  ereturn(escontext, 0,
272  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
273  errmsg("invalid input syntax for type %s: \"%s\"",
274  "smallint", s)));
275 }
unsigned short uint16
Definition: c.h:489
#define likely(x)
Definition: c.h:294
#define PG_INT16_MIN
Definition: c.h:569
#define unlikely(x)
Definition: c.h:295
#define PG_INT16_MAX
Definition: c.h:570
static const int8 hexlookup[128]
Definition: numutils.c:88

References ereturn, errcode(), errmsg(), hexlookup, likely, PG_INT16_MAX, PG_INT16_MIN, and unlikely.

Referenced by int2in(), and pg_strtoint16().

◆ pg_strtoint32()

int32 pg_strtoint32 ( const char *  s)

Definition at line 291 of file numutils.c.

292 {
293  return pg_strtoint32_safe(s, NULL);
294 }
int32 pg_strtoint32_safe(const char *s, Node *escontext)
Definition: numutils.c:297

References pg_strtoint32_safe().

Referenced by ArrayGetIntegerTypmods(), check_foreign_key(), libpqrcv_endstreaming(), libpqrcv_identify_system(), pq_parse_errornotice(), prsd_headline(), and text_format().

◆ pg_strtoint32_safe()

int32 pg_strtoint32_safe ( const char *  s,
Node escontext 
)

Definition at line 297 of file numutils.c.

298 {
299  const char *ptr = s;
300  const char *firstdigit;
301  uint32 tmp = 0;
302  bool neg = false;
303 
304  /* skip leading spaces */
305  while (likely(*ptr) && isspace((unsigned char) *ptr))
306  ptr++;
307 
308  /* handle sign */
309  if (*ptr == '-')
310  {
311  ptr++;
312  neg = true;
313  }
314  else if (*ptr == '+')
315  ptr++;
316 
317  /* process digits */
318  if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X'))
319  {
320  firstdigit = ptr += 2;
321 
322  while (*ptr)
323  {
324  if (isxdigit((unsigned char) *ptr))
325  {
326  if (unlikely(tmp > -(PG_INT32_MIN / 16)))
327  goto out_of_range;
328 
329  tmp = tmp * 16 + hexlookup[(unsigned char) *ptr++];
330  }
331  else if (*ptr == '_')
332  {
333  /* underscore must be followed by more digits */
334  ptr++;
335  if (*ptr == '\0' || !isxdigit((unsigned char) *ptr))
336  goto invalid_syntax;
337  }
338  else
339  break;
340  }
341  }
342  else if (ptr[0] == '0' && (ptr[1] == 'o' || ptr[1] == 'O'))
343  {
344  firstdigit = ptr += 2;
345 
346  while (*ptr)
347  {
348  if (*ptr >= '0' && *ptr <= '7')
349  {
350  if (unlikely(tmp > -(PG_INT32_MIN / 8)))
351  goto out_of_range;
352 
353  tmp = tmp * 8 + (*ptr++ - '0');
354  }
355  else if (*ptr == '_')
356  {
357  /* underscore must be followed by more digits */
358  ptr++;
359  if (*ptr == '\0' || *ptr < '0' || *ptr > '7')
360  goto invalid_syntax;
361  }
362  else
363  break;
364  }
365  }
366  else if (ptr[0] == '0' && (ptr[1] == 'b' || ptr[1] == 'B'))
367  {
368  firstdigit = ptr += 2;
369 
370  while (*ptr)
371  {
372  if (*ptr >= '0' && *ptr <= '1')
373  {
374  if (unlikely(tmp > -(PG_INT32_MIN / 2)))
375  goto out_of_range;
376 
377  tmp = tmp * 2 + (*ptr++ - '0');
378  }
379  else if (*ptr == '_')
380  {
381  /* underscore must be followed by more digits */
382  ptr++;
383  if (*ptr == '\0' || *ptr < '0' || *ptr > '1')
384  goto invalid_syntax;
385  }
386  else
387  break;
388  }
389  }
390  else
391  {
392  firstdigit = ptr;
393 
394  while (*ptr)
395  {
396  if (isdigit((unsigned char) *ptr))
397  {
398  if (unlikely(tmp > -(PG_INT32_MIN / 10)))
399  goto out_of_range;
400 
401  tmp = tmp * 10 + (*ptr++ - '0');
402  }
403  else if (*ptr == '_')
404  {
405  /* underscore may not be first */
406  if (unlikely(ptr == firstdigit))
407  goto invalid_syntax;
408  /* and it must be followed by more digits */
409  ptr++;
410  if (*ptr == '\0' || !isdigit((unsigned char) *ptr))
411  goto invalid_syntax;
412  }
413  else
414  break;
415  }
416  }
417 
418  /* require at least one digit */
419  if (unlikely(ptr == firstdigit))
420  goto invalid_syntax;
421 
422  /* allow trailing whitespace, but not other trailing chars */
423  while (*ptr != '\0' && isspace((unsigned char) *ptr))
424  ptr++;
425 
426  if (unlikely(*ptr != '\0'))
427  goto invalid_syntax;
428 
429  if (neg)
430  {
431  /* check the negative equivalent will fit without overflowing */
432  if (tmp > (uint32) (-(PG_INT32_MIN + 1)) + 1)
433  goto out_of_range;
434  return -((int32) tmp);
435  }
436 
437  if (tmp > PG_INT32_MAX)
438  goto out_of_range;
439 
440  return (int32) tmp;
441 
442 out_of_range:
443  ereturn(escontext, 0,
444  (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
445  errmsg("value \"%s\" is out of range for type %s",
446  s, "integer")));
447 
448 invalid_syntax:
449  ereturn(escontext, 0,
450  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
451  errmsg("invalid input syntax for type %s: \"%s\"",
452  "integer", s)));
453 }
#define PG_INT32_MAX
Definition: c.h:573
#define PG_INT32_MIN
Definition: c.h:572

References ereturn, errcode(), errmsg(), hexlookup, likely, PG_INT32_MAX, PG_INT32_MIN, and unlikely.

Referenced by int4in(), and pg_strtoint32().

◆ pg_strtoint64()

int64 pg_strtoint64 ( const char *  s)

Definition at line 469 of file numutils.c.

470 {
471  return pg_strtoint64_safe(s, NULL);
472 }
int64 pg_strtoint64_safe(const char *s, Node *escontext)
Definition: numutils.c:475

References pg_strtoint64_safe().

◆ pg_strtoint64_safe()

int64 pg_strtoint64_safe ( const char *  s,
Node escontext 
)

Definition at line 475 of file numutils.c.

476 {
477  const char *ptr = s;
478  const char *firstdigit;
479  uint64 tmp = 0;
480  bool neg = false;
481 
482  /* skip leading spaces */
483  while (*ptr && isspace((unsigned char) *ptr))
484  ptr++;
485 
486  /* handle sign */
487  if (*ptr == '-')
488  {
489  ptr++;
490  neg = true;
491  }
492  else if (*ptr == '+')
493  ptr++;
494 
495  /* process digits */
496  if (ptr[0] == '0' && (ptr[1] == 'x' || ptr[1] == 'X'))
497  {
498  firstdigit = ptr += 2;
499 
500  while (*ptr)
501  {
502  if (isxdigit((unsigned char) *ptr))
503  {
504  if (unlikely(tmp > -(PG_INT64_MIN / 16)))
505  goto out_of_range;
506 
507  tmp = tmp * 16 + hexlookup[(unsigned char) *ptr++];
508  }
509  else if (*ptr == '_')
510  {
511  /* underscore must be followed by more digits */
512  ptr++;
513  if (*ptr == '\0' || !isxdigit((unsigned char) *ptr))
514  goto invalid_syntax;
515  }
516  else
517  break;
518  }
519  }
520  else if (ptr[0] == '0' && (ptr[1] == 'o' || ptr[1] == 'O'))
521  {
522  firstdigit = ptr += 2;
523 
524  while (*ptr)
525  {
526  if (*ptr >= '0' && *ptr <= '7')
527  {
528  if (unlikely(tmp > -(PG_INT64_MIN / 8)))
529  goto out_of_range;
530 
531  tmp = tmp * 8 + (*ptr++ - '0');
532  }
533  else if (*ptr == '_')
534  {
535  /* underscore must be followed by more digits */
536  ptr++;
537  if (*ptr == '\0' || *ptr < '0' || *ptr > '7')
538  goto invalid_syntax;
539  }
540  else
541  break;
542  }
543  }
544  else if (ptr[0] == '0' && (ptr[1] == 'b' || ptr[1] == 'B'))
545  {
546  firstdigit = ptr += 2;
547 
548  while (*ptr)
549  {
550  if (*ptr >= '0' && *ptr <= '1')
551  {
552  if (unlikely(tmp > -(PG_INT64_MIN / 2)))
553  goto out_of_range;
554 
555  tmp = tmp * 2 + (*ptr++ - '0');
556  }
557  else if (*ptr == '_')
558  {
559  /* underscore must be followed by more digits */
560  ptr++;
561  if (*ptr == '\0' || *ptr < '0' || *ptr > '1')
562  goto invalid_syntax;
563  }
564  else
565  break;
566  }
567  }
568  else
569  {
570  firstdigit = ptr;
571 
572  while (*ptr)
573  {
574  if (isdigit((unsigned char) *ptr))
575  {
576  if (unlikely(tmp > -(PG_INT64_MIN / 10)))
577  goto out_of_range;
578 
579  tmp = tmp * 10 + (*ptr++ - '0');
580  }
581  else if (*ptr == '_')
582  {
583  /* underscore may not be first */
584  if (unlikely(ptr == firstdigit))
585  goto invalid_syntax;
586  /* and it must be followed by more digits */
587  ptr++;
588  if (*ptr == '\0' || !isdigit((unsigned char) *ptr))
589  goto invalid_syntax;
590  }
591  else
592  break;
593  }
594  }
595 
596  /* require at least one digit */
597  if (unlikely(ptr == firstdigit))
598  goto invalid_syntax;
599 
600  /* allow trailing whitespace, but not other trailing chars */
601  while (*ptr != '\0' && isspace((unsigned char) *ptr))
602  ptr++;
603 
604  if (unlikely(*ptr != '\0'))
605  goto invalid_syntax;
606 
607  if (neg)
608  {
609  /* check the negative equivalent will fit without overflowing */
610  if (tmp > (uint64) (-(PG_INT64_MIN + 1)) + 1)
611  goto out_of_range;
612  return -((int64) tmp);
613  }
614 
615  if (tmp > PG_INT64_MAX)
616  goto out_of_range;
617 
618  return (int64) tmp;
619 
620 out_of_range:
621  ereturn(escontext, 0,
622  (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
623  errmsg("value \"%s\" is out of range for type %s",
624  s, "bigint")));
625 
626 invalid_syntax:
627  ereturn(escontext, 0,
628  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
629  errmsg("invalid input syntax for type %s: \"%s\"",
630  "bigint", s)));
631 }
#define PG_INT64_MAX
Definition: c.h:576
#define PG_INT64_MIN
Definition: c.h:575

References ereturn, errcode(), errmsg(), hexlookup, PG_INT64_MAX, PG_INT64_MIN, and unlikely.

Referenced by int8in(), make_const(), and pg_strtoint64().

◆ pg_ulltoa_n()

int pg_ulltoa_n ( uint64  value,
char *  a 
)

Definition at line 891 of file numutils.c.

892 {
893  int olength,
894  i = 0;
895  uint32 value2;
896 
897  /* Degenerate case */
898  if (value == 0)
899  {
900  *a = '0';
901  return 1;
902  }
903 
904  olength = decimalLength64(value);
905 
906  /* Compute the result string. */
907  while (value >= 100000000)
908  {
909  const uint64 q = value / 100000000;
910  uint32 value3 = (uint32) (value - 100000000 * q);
911 
912  const uint32 c = value3 % 10000;
913  const uint32 d = value3 / 10000;
914  const uint32 c0 = (c % 100) << 1;
915  const uint32 c1 = (c / 100) << 1;
916  const uint32 d0 = (d % 100) << 1;
917  const uint32 d1 = (d / 100) << 1;
918 
919  char *pos = a + olength - i;
920 
921  value = q;
922 
923  memcpy(pos - 2, DIGIT_TABLE + c0, 2);
924  memcpy(pos - 4, DIGIT_TABLE + c1, 2);
925  memcpy(pos - 6, DIGIT_TABLE + d0, 2);
926  memcpy(pos - 8, DIGIT_TABLE + d1, 2);
927  i += 8;
928  }
929 
930  /* Switch to 32-bit for speed */
931  value2 = (uint32) value;
932 
933  if (value2 >= 10000)
934  {
935  const uint32 c = value2 - 10000 * (value2 / 10000);
936  const uint32 c0 = (c % 100) << 1;
937  const uint32 c1 = (c / 100) << 1;
938 
939  char *pos = a + olength - i;
940 
941  value2 /= 10000;
942 
943  memcpy(pos - 2, DIGIT_TABLE + c0, 2);
944  memcpy(pos - 4, DIGIT_TABLE + c1, 2);
945  i += 4;
946  }
947  if (value2 >= 100)
948  {
949  const uint32 c = (value2 % 100) << 1;
950  char *pos = a + olength - i;
951 
952  value2 /= 100;
953 
954  memcpy(pos - 2, DIGIT_TABLE + c, 2);
955  i += 2;
956  }
957  if (value2 >= 10)
958  {
959  const uint32 c = value2 << 1;
960  char *pos = a + olength - i;
961 
962  memcpy(pos - 2, DIGIT_TABLE + c, 2);
963  }
964  else
965  *a = (char) ('0' + value2);
966 
967  return olength;
968 }
static const char DIGIT_TABLE[200]
Definition: numutils.c:29
static int decimalLength64(const uint64 v)
Definition: numutils.c:64
char * c

References a, decimalLength64(), DIGIT_TABLE, i, and value.

Referenced by BuildQueryCompletionString(), and pg_lltoa().

◆ pg_ultoa_n()

int pg_ultoa_n ( uint32  value,
char *  a 
)

Definition at line 806 of file numutils.c.

807 {
808  int olength,
809  i = 0;
810 
811  /* Degenerate case */
812  if (value == 0)
813  {
814  *a = '0';
815  return 1;
816  }
817 
818  olength = decimalLength32(value);
819 
820  /* Compute the result string. */
821  while (value >= 10000)
822  {
823  const uint32 c = value - 10000 * (value / 10000);
824  const uint32 c0 = (c % 100) << 1;
825  const uint32 c1 = (c / 100) << 1;
826 
827  char *pos = a + olength - i;
828 
829  value /= 10000;
830 
831  memcpy(pos - 2, DIGIT_TABLE + c0, 2);
832  memcpy(pos - 4, DIGIT_TABLE + c1, 2);
833  i += 4;
834  }
835  if (value >= 100)
836  {
837  const uint32 c = (value % 100) << 1;
838 
839  char *pos = a + olength - i;
840 
841  value /= 100;
842 
843  memcpy(pos - 2, DIGIT_TABLE + c, 2);
844  i += 2;
845  }
846  if (value >= 10)
847  {
848  const uint32 c = value << 1;
849 
850  char *pos = a + olength - i;
851 
852  memcpy(pos - 2, DIGIT_TABLE + c, 2);
853  }
854  else
855  {
856  *a = (char) ('0' + value);
857  }
858 
859  return olength;
860 }
static int decimalLength32(const uint32 v)
Definition: numutils.c:45

References a, decimalLength32(), DIGIT_TABLE, i, and value.

Referenced by pg_ltoa(), pg_ultostr(), pg_ultostr_zeropad(), and printsimple().

◆ pg_ultostr()

char* pg_ultostr ( char *  str,
uint32  value 
)

Definition at line 1058 of file numutils.c.

1059 {
1060  int len = pg_ultoa_n(value, str);
1061 
1062  return str + len;
1063 }

References len, pg_ultoa_n(), generate_unaccent_rules::str, and value.

Referenced by AppendSeconds().

◆ pg_ultostr_zeropad()

char* pg_ultostr_zeropad ( char *  str,
uint32  value,
int32  minwidth 
)

Definition at line 1018 of file numutils.c.

1019 {
1020  int len;
1021 
1022  Assert(minwidth > 0);
1023 
1024  if (value < 100 && minwidth == 2) /* Short cut for common case */
1025  {
1026  memcpy(str, DIGIT_TABLE + value * 2, 2);
1027  return str + 2;
1028  }
1029 
1030  len = pg_ultoa_n(value, str);
1031  if (len >= minwidth)
1032  return str + len;
1033 
1034  memmove(str + minwidth - len, str, len);
1035  memset(str, '0', minwidth - len);
1036  return str + minwidth;
1037 }

References Assert(), DIGIT_TABLE, len, pg_ultoa_n(), generate_unaccent_rules::str, and value.

Referenced by AppendSeconds(), EncodeDateOnly(), EncodeDateTime(), EncodeTimeOnly(), and EncodeTimezone().

◆ quote_identifier()

const char* quote_identifier ( const char *  ident)

Definition at line 11551 of file ruleutils.c.

11552 {
11553  /*
11554  * Can avoid quoting if ident starts with a lowercase letter or underscore
11555  * and contains only lowercase letters, digits, and underscores, *and* is
11556  * not any SQL keyword. Otherwise, supply quotes.
11557  */
11558  int nquotes = 0;
11559  bool safe;
11560  const char *ptr;
11561  char *result;
11562  char *optr;
11563 
11564  /*
11565  * would like to use <ctype.h> macros here, but they might yield unwanted
11566  * locale-specific results...
11567  */
11568  safe = ((ident[0] >= 'a' && ident[0] <= 'z') || ident[0] == '_');
11569 
11570  for (ptr = ident; *ptr; ptr++)
11571  {
11572  char ch = *ptr;
11573 
11574  if ((ch >= 'a' && ch <= 'z') ||
11575  (ch >= '0' && ch <= '9') ||
11576  (ch == '_'))
11577  {
11578  /* okay */
11579  }
11580  else
11581  {
11582  safe = false;
11583  if (ch == '"')
11584  nquotes++;
11585  }
11586  }
11587 
11589  safe = false;
11590 
11591  if (safe)
11592  {
11593  /*
11594  * Check for keyword. We quote keywords except for unreserved ones.
11595  * (In some cases we could avoid quoting a col_name or type_func_name
11596  * keyword, but it seems much harder than it's worth to tell that.)
11597  *
11598  * Note: ScanKeywordLookup() does case-insensitive comparison, but
11599  * that's fine, since we already know we have all-lower-case.
11600  */
11601  int kwnum = ScanKeywordLookup(ident, &ScanKeywords);
11602 
11603  if (kwnum >= 0 && ScanKeywordCategories[kwnum] != UNRESERVED_KEYWORD)
11604  safe = false;
11605  }
11606 
11607  if (safe)
11608  return ident; /* no change needed */
11609 
11610  result = (char *) palloc(strlen(ident) + nquotes + 2 + 1);
11611 
11612  optr = result;
11613  *optr++ = '"';
11614  for (ptr = ident; *ptr; ptr++)
11615  {
11616  char ch = *ptr;
11617 
11618  if (ch == '"')
11619  *optr++ = '"';
11620  *optr++ = ch;
11621  }
11622  *optr++ = '"';
11623  *optr = '\0';
11624 
11625  return result;
11626 }
const uint8 ScanKeywordCategories[SCANKEYWORDS_NUM_KEYWORDS]
Definition: keywords.c:29
#define ident
Definition: indent_codes.h:47
PGDLLIMPORT const ScanKeywordList ScanKeywords
#define UNRESERVED_KEYWORD
Definition: keywords.h:20
int ScanKeywordLookup(const char *str, const ScanKeywordList *keywords)
Definition: kwlookup.c:38
bool quote_all_identifiers
Definition: ruleutils.c:324

References ident, palloc(), pg_malloc(), quote_all_identifiers, ScanKeywordCategories, ScanKeywordLookup(), ScanKeywords, and UNRESERVED_KEYWORD.

Referenced by add_cast_to(), appendFunctionName(), ATPrepAlterColumnType(), CheckMyDatabase(), copy_table(), createdb(), decompile_column_index_array(), deparseAnalyzeSql(), deparseColumnRef(), deparseOperatorName(), deparseRelation(), execute_extension_script(), ExplainIndexScanDetails(), ExplainNode(), ExplainTargetRel(), flatten_set_variable_args(), format_operator_extended(), generate_operator_clause(), generate_operator_name(), get_column_alias_list(), get_from_clause_coldeflist(), get_from_clause_item(), get_insert_query_def(), get_opclass_name(), get_parameter(), get_reloptions(), get_rte_alias(), get_rule_expr(), get_rule_windowclause(), get_rule_windowspec(), get_select_query_def(), get_tablefunc(), get_target_list(), get_update_query_targetlist_def(), get_utility_query_def(), get_variable(), get_windowfunc_expr(), get_with_clause(), getObjectIdentityParts(), make_ruledef(), NameListToQuotedString(), old_9_6_invalidate_hash_indexes(), pg_get_constraintdef_worker(), pg_get_functiondef(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_triggerdef_worker(), pg_identify_object(), PLy_quote_ident(), postgresExplainForeignScan(), postgresImportForeignSchema(), print_function_arguments(), processIndirection(), quote_ident(), quote_object_name(), quote_qualified_identifier(), regnamespaceout(), regoperout(), regroleout(), ReplicationSlotDropAtPubNode(), report_extension_updates(), sepgsql_attribute_post_create(), sepgsql_database_post_create(), sepgsql_relation_post_create(), sepgsql_schema_post_create(), serialize_deflist(), set_frozenxids(), show_sortorder_options(), text_format_string_conversion(), and tuple_to_stringinfo().

◆ quote_literal_cstr()

char* quote_literal_cstr ( const char *  rawstr)

Definition at line 103 of file quote.c.

104 {
105  char *result;
106  int len;
107  int newlen;
108 
109  len = strlen(rawstr);
110  /* We make a worst-case result area; wasting a little space is OK */
111  result = palloc(len * 2 + 3 + 1);
112 
113  newlen = quote_literal_internal(result, rawstr, len);
114  result[newlen] = '\0';
115 
116  return result;
117 }
static size_t quote_literal_internal(char *dst, const char *src, size_t len)
Definition: quote.c:47

References len, palloc(), and quote_literal_internal().

Referenced by build_tuplestore_recursively(), fetch_remote_table_info(), get_publications_str(), get_sql_delete(), get_sql_insert(), get_sql_update(), get_tuple_of_interest(), pg_decode_commit_prepared_txn(), pg_decode_prepare_txn(), pg_decode_rollback_prepared_txn(), pg_decode_stream_prepare(), PLy_quote_literal(), PLy_quote_nullable(), and text_format_string_conversion().

◆ quote_qualified_identifier()

◆ regexp_fixed_prefix()

char* regexp_fixed_prefix ( text text_re,
bool  case_insensitive,
Oid  collation,
bool exact 
)

Definition at line 1939 of file regexp.c.

1941 {
1942  char *result;
1943  regex_t *re;
1944  int cflags;
1945  int re_result;
1946  pg_wchar *str;
1947  size_t slen;
1948  size_t maxlen;
1949  char errMsg[100];
1950 
1951  *exact = false; /* default result */
1952 
1953  /* Compile RE */
1954  cflags = REG_ADVANCED;
1955  if (case_insensitive)
1956  cflags |= REG_ICASE;
1957 
1958  re = RE_compile_and_cache(text_re, cflags | REG_NOSUB, collation);
1959 
1960  /* Examine it to see if there's a fixed prefix */
1961  re_result = pg_regprefix(re, &str, &slen);
1962 
1963  switch (re_result)
1964  {
1965  case REG_NOMATCH:
1966  return NULL;
1967 
1968  case REG_PREFIX:
1969  /* continue with wchar conversion */
1970  break;
1971 
1972  case REG_EXACT:
1973  *exact = true;
1974  /* continue with wchar conversion */
1975  break;
1976 
1977  default:
1978  /* re failed??? */
1980  pg_regerror(re_result, re, errMsg, sizeof(errMsg));
1981  ereport(ERROR,
1982  (errcode(ERRCODE_INVALID_REGULAR_EXPRESSION),
1983  errmsg("regular expression failed: %s", errMsg)));
1984  break;
1985  }
1986 
1987  /* Convert pg_wchar result back to database encoding */
1988  maxlen = pg_database_encoding_max_length() * slen + 1;
1989  result = (char *) palloc(maxlen);
1990  slen = pg_wchar2mb_with_len(str, result, slen);
1991  Assert(slen < maxlen);
1992 
1993  free(str);
1994 
1995  return result;
1996 }
#define ereport(elevel,...)
Definition: elog.h:149
#define free(a)
Definition: header.h:65
unsigned int pg_wchar
Definition: mbprint.c:31
int pg_wchar2mb_with_len(const pg_wchar *from, char *to, int len)
Definition: mbutils.c:1009
int pg_database_encoding_max_length(void)
Definition: mbutils.c:1553
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:121
size_t pg_regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size)
Definition: regerror.c:60
#define REG_ICASE
Definition: regex.h:106
#define REG_NOMATCH
Definition: regex.h:138
#define REG_EXACT
Definition: regex.h:163
#define REG_PREFIX
Definition: regex.h:162
#define REG_ADVANCED
Definition: regex.h:103
#define REG_NOSUB
Definition: regex.h:107
regex_t * RE_compile_and_cache(text *text_re, int cflags, Oid collation)
Definition: regexp.c:138
int pg_regprefix(regex_t *re, chr **string, size_t *slength)
Definition: regprefix.c:46
Definition: regex.h:56

References Assert(), CHECK_FOR_INTERRUPTS, ereport, errcode(), errmsg(), ERROR, free, palloc(), pg_database_encoding_max_length(), pg_regerror(), pg_regprefix(), pg_wchar2mb_with_len(), RE_compile_and_cache(), REG_ADVANCED, REG_EXACT, REG_ICASE, REG_NOMATCH, REG_NOSUB, REG_PREFIX, and generate_unaccent_rules::str.

Referenced by regex_fixed_prefix().

◆ text_to_cstring()

char* text_to_cstring ( const text t)

Definition at line 215 of file varlena.c.

216 {
217  /* must cast away the const, unfortunately */
218  text *tunpacked = pg_detoast_datum_packed(unconstify(text *, t));
219  int len = VARSIZE_ANY_EXHDR(tunpacked);
220  char *result;
221 
222  result = (char *) palloc(len + 1);
223  memcpy(result, VARDATA_ANY(tunpacked), len);
224  result[len] = '\0';
225 
226  if (tunpacked != t)
227  pfree(tunpacked);
228 
229  return result;
230 }
#define unconstify(underlying_type, expr)
Definition: c.h:1232
struct varlena * pg_detoast_datum_packed(struct varlena *datum)
Definition: fmgr.c:1851
void pfree(void *pointer)
Definition: mcxt.c:1436
#define VARDATA_ANY(PTR)
Definition: varatt.h:324
#define VARSIZE_ANY_EXHDR(PTR)
Definition: varatt.h:317

References len, palloc(), pfree(), pg_detoast_datum_packed(), unconstify, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

Referenced by array_to_text(), array_to_text_null(), binary_upgrade_create_empty_extension(), binary_upgrade_set_missing_value(), connectby_text(), connectby_text_serial(), convert_and_check_filename(), convert_any_priv_string(), convert_column_name(), convert_database_name(), convert_foreign_data_wrapper_name(), convert_function_name(), convert_language_name(), convert_schema_name(), convert_server_name(), convert_tablespace_name(), convert_type_name(), crosstab(), crosstab_hash(), cursor_to_xml(), cursor_to_xmlschema(), database_to_xml(), database_to_xml_and_xmlschema(), database_to_xmlschema(), datetime_to_char_body(), datum_to_json(), dblink_cancel_query(), dblink_close(), dblink_connect(), dblink_disconnect(), dblink_error_message(), dblink_exec(), dblink_fetch(), dblink_get_notify(), dblink_is_busy(), dblink_open(), dblink_record_internal(), dblink_send_query(), deserialize_deflist(), difference(), dmetaphone(), dmetaphone_alt(), do_to_timestamp(), ExecAlterExtensionStmt(), execute_extension_script(), executeDateTimeMethod(), get_raw_page_fork(), get_raw_page_fork_1_9(), has_param_priv_byname(), has_sequence_privilege_id_name(), has_sequence_privilege_name(), has_sequence_privilege_name_name(), json_object_field(), json_object_field_text(), jsonb_set_lax(), ltree_addtext(), ltree_textadd(), NUM_cache(), parse_datetime(), parse_ident(), pg_backup_start(), pg_create_restore_point(), pg_crypt(), pg_current_logfile(), pg_get_expr_worker(), pg_get_publication_tables(), pg_get_serial_sequence(), pg_index_column_has_property(), pg_index_has_property(), pg_indexam_has_property(), pg_input_is_valid_common(), pg_logical_emit_message_bytea(), pg_ls_replslotdir(), pg_notify(), pg_prewarm(), pg_relation_size(), 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_bytes(), pg_split_walfile_name(), pg_stat_get_progress_info(), pg_stat_get_replication_slot(), pg_stat_have_stats(), pg_stat_reset_replication_slot(), pg_stat_reset_shared(), pg_stat_reset_slru(), pgxml_texttoxmlchar(), phraseto_tsquery_byid(), plainto_tsquery_byid(), postgres_fdw_disconnect(), query_to_xml(), query_to_xml_and_xmlschema(), query_to_xmlschema(), quote_ident(), quote_ident_cstr(), range_constructor3(), regress_setenv(), replorigin_by_oid(), schema_to_xml(), schema_to_xml_and_xmlschema(), schema_to_xmlschema(), sepgsql_mcstrans_in(), sepgsql_mcstrans_out(), soundex(), table_to_xml(), table_to_xml_and_xmlschema(), table_to_xmlschema(), test_canonicalize_path(), test_predtest(), test_slru_page_write(), text2ltree(), text_concat_ws(), textToQualifiedNameList(), to_date(), to_regclass(), to_regcollation(), to_regnamespace(), to_regoper(), to_regoperator(), to_regproc(), to_regprocedure(), to_regrole(), to_regtype(), to_timestamp(), to_tsquery_byid(), transform_string_values_scalar(), ts_stat_sql(), tsquery_rewrite_query(), tuple_data_split(), unicode_is_normalized(), unicode_normalize_func(), verify_heapam(), websearch_to_tsquery_byid(), X509_NAME_field_to_text(), xml_out_internal(), xmlconcat(), xmlpi(), xmlroot(), and xpath_table().

◆ text_to_cstring_buffer()

void text_to_cstring_buffer ( const text src,
char *  dst,
size_t  dst_len 
)

Definition at line 246 of file varlena.c.

247 {
248  /* must cast away the const, unfortunately */
249  text *srcunpacked = pg_detoast_datum_packed(unconstify(text *, src));
250  size_t src_len = VARSIZE_ANY_EXHDR(srcunpacked);
251 
252  if (dst_len > 0)
253  {
254  dst_len--;
255  if (dst_len >= src_len)
256  dst_len = src_len;
257  else /* ensure truncation is encoding-safe */
258  dst_len = pg_mbcliplen(VARDATA_ANY(srcunpacked), src_len, dst_len);
259  memcpy(dst, VARDATA_ANY(srcunpacked), dst_len);
260  dst[dst_len] = '\0';
261  }
262 
263  if (srcunpacked != src)
264  pfree(srcunpacked);
265 }
int pg_mbcliplen(const char *mbstr, int len, int limit)
Definition: mbutils.c:1084

References pfree(), pg_detoast_datum_packed(), pg_mbcliplen(), unconstify, VARDATA_ANY, and VARSIZE_ANY_EXHDR.

Referenced by be_lo_export(), lo_import_internal(), lookup_timezone(), parse_sane_timezone(), pg_gen_salt(), pg_gen_salt_rounds(), timestamp_zone(), timestamptz_zone(), and timetz_zone().

◆ type_maximum_size()

int32 type_maximum_size ( Oid  type_oid,
int32  typemod 
)

Definition at line 408 of file format_type.c.

409 {
410  if (typemod < 0)
411  return -1;
412 
413  switch (type_oid)
414  {
415  case BPCHAROID:
416  case VARCHAROID:
417  /* typemod includes varlena header */
418 
419  /* typemod is in characters not bytes */
420  return (typemod - VARHDRSZ) *
422  + VARHDRSZ;
423 
424  case NUMERICOID:
425  return numeric_maximum_size(typemod);
426 
427  case VARBITOID:
428  case BITOID:
429  /* typemod is the (max) number of bits */
430  return (typemod + (BITS_PER_BYTE - 1)) / BITS_PER_BYTE
431  + 2 * sizeof(int32);
432  }
433 
434  /* Unknown type, or unlimited-width type such as 'text' */
435  return -1;
436 }
int32 numeric_maximum_size(int32 typmod)
Definition: numeric.c:943
int GetDatabaseEncoding(void)
Definition: mbutils.c:1268
#define BITS_PER_BYTE
int pg_encoding_max_length(int encoding)
Definition: wchar.c:2188

References BITS_PER_BYTE, GetDatabaseEncoding(), numeric_maximum_size(), pg_encoding_max_length(), and VARHDRSZ.

Referenced by get_typavgwidth(), and heapam_relation_needs_toast_table().

◆ uint32in_subr()

uint32 uint32in_subr ( const char *  s,
char **  endloc,
const char *  typname,
Node escontext 
)

Definition at line 649 of file numutils.c.

651 {
652  uint32 result;
653  unsigned long cvt;
654  char *endptr;
655 
656  errno = 0;
657  cvt = strtoul(s, &endptr, 0);
658 
659  /*
660  * strtoul() normally only sets ERANGE. On some systems it may also set
661  * EINVAL, which simply means it couldn't parse the input string. Be sure
662  * to report that the same way as the standard error indication (that
663  * endptr == s).
664  */
665  if ((errno && errno != ERANGE) || endptr == s)
666  ereturn(escontext, 0,
667  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
668  errmsg("invalid input syntax for type %s: \"%s\"",
669  typname, s)));
670 
671  if (errno == ERANGE)
672  ereturn(escontext, 0,
673  (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
674  errmsg("value \"%s\" is out of range for type %s",
675  s, typname)));
676 
677  if (endloc)
678  {
679  /* caller wants to deal with rest of string */
680  *endloc = endptr;
681  }
682  else
683  {
684  /* allow only whitespace after number */
685  while (*endptr && isspace((unsigned char) *endptr))
686  endptr++;
687  if (*endptr)
688  ereturn(escontext, 0,
689  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
690  errmsg("invalid input syntax for type %s: \"%s\"",
691  typname, s)));
692  }
693 
694  result = (uint32) cvt;
695 
696  /*
697  * Cope with possibility that unsigned long is wider than uint32, in which
698  * case strtoul will not raise an error for some values that are out of
699  * the range of uint32.
700  *
701  * For backwards compatibility, we want to accept inputs that are given
702  * with a minus sign, so allow the input value if it matches after either
703  * signed or unsigned extension to long.
704  *
705  * To ensure consistent results on 32-bit and 64-bit platforms, make sure
706  * the error message is the same as if strtoul() had returned ERANGE.
707  */
708 #if PG_UINT32_MAX != ULONG_MAX
709  if (cvt != (unsigned long) result &&
710  cvt != (unsigned long) ((int) result))
711  ereturn(escontext, 0,
712  (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
713  errmsg("value \"%s\" is out of range for type %s",
714  s, typname)));
715 #endif
716 
717  return result;
718 }

References ereturn, errcode(), errmsg(), and typname.

Referenced by cidin(), oidin(), oidparse(), oidvectorin(), and xidin().

◆ uint64in_subr()

uint64 uint64in_subr ( const char *  s,
char **  endloc,
const char *  typname,
Node escontext 
)

Definition at line 736 of file numutils.c.

738 {
739  uint64 result;
740  char *endptr;
741 
742  errno = 0;
743  result = strtou64(s, &endptr, 0);
744 
745  /*
746  * strtoul[l] normally only sets ERANGE. On some systems it may also set
747  * EINVAL, which simply means it couldn't parse the input string. Be sure
748  * to report that the same way as the standard error indication (that
749  * endptr == s).
750  */
751  if ((errno && errno != ERANGE) || endptr == s)
752  ereturn(escontext, 0,
753  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
754  errmsg("invalid input syntax for type %s: \"%s\"",
755  typname, s)));
756 
757  if (errno == ERANGE)
758  ereturn(escontext, 0,
759  (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
760  errmsg("value \"%s\" is out of range for type %s",
761  s, typname)));
762 
763  if (endloc)
764  {
765  /* caller wants to deal with rest of string */
766  *endloc = endptr;
767  }
768  else
769  {
770  /* allow only whitespace after number */
771  while (*endptr && isspace((unsigned char) *endptr))
772  endptr++;
773  if (*endptr)
774  ereturn(escontext, 0,
775  (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
776  errmsg("invalid input syntax for type %s: \"%s\"",
777  typname, s)));
778  }
779 
780  return result;
781 }
#define strtou64(str, endptr, base)
Definition: c.h:1285

References ereturn, errcode(), errmsg(), strtou64, and typname.

Referenced by xid8in().

◆ xidComparator()

int xidComparator ( const void *  arg1,
const void *  arg2 
)

Definition at line 138 of file xid.c.

139 {
140  TransactionId xid1 = *(const TransactionId *) arg1;
141  TransactionId xid2 = *(const TransactionId *) arg2;
142 
143  if (xid1 > xid2)
144  return 1;
145  if (xid1 < xid2)
146  return -1;
147  return 0;
148 }
uint32 TransactionId
Definition: c.h:636

Referenced by ReorderBufferCopySnap(), ReorderBufferGetCatalogChangesXacts(), SerializeTransactionState(), SnapBuildBuildSnapshot(), SnapBuildInitialSnapshot(), SnapBuildXidHasCatalogChanges(), and TransactionIdInArray().

◆ xidLogicalComparator()

int xidLogicalComparator ( const void *  arg1,
const void *  arg2 
)

Definition at line 159 of file xid.c.

160 {
161  TransactionId xid1 = *(const TransactionId *) arg1;
162  TransactionId xid2 = *(const TransactionId *) arg2;
163 
166 
167  if (TransactionIdPrecedes(xid1, xid2))
168  return -1;
169 
170  if (TransactionIdPrecedes(xid2, xid1))
171  return 1;
172 
173  return 0;
174 }
bool TransactionIdPrecedes(TransactionId id1, TransactionId id2)
Definition: transam.c:280
#define TransactionIdIsNormal(xid)
Definition: transam.h:42

References Assert(), TransactionIdIsNormal, and TransactionIdPrecedes().

Referenced by ProcArrayApplyRecoveryInfo().

Variable Documentation

◆ quote_all_identifiers

PGDLLIMPORT bool quote_all_identifiers
extern

Definition at line 324 of file ruleutils.c.

Referenced by fmtId(), main(), quote_identifier(), and setup_connection().