47 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
48 errmsg(
"invalid type modifier")));
52 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
53 errmsg(
"length for type %s must be at least 1",
typename)));
56 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
57 errmsg(
"length for type %s cannot exceed %d",
141 if (charlen > maxlen)
152 for (
j = mbmaxlen;
j <
len;
j++)
156 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
157 errmsg(
"value too long for type character(%d)",
165 maxlen =
len = mbmaxlen;
173 maxlen =
len + (maxlen - charlen);
184 memset(r +
len,
' ', maxlen -
len);
294 if (charlen == maxlen)
297 if (charlen > maxlen)
306 for (
i = maxmblen;
i <
len;
i++)
309 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
310 errmsg(
"value too long for type character(%d)",
328 maxlen =
len + (maxlen - charlen);
341 memset(r +
len,
' ', maxlen -
len);
386 if (s_data[
len - 1] !=
' ')
467 for (
j = mbmaxlen;
j <
len;
j++)
471 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
472 errmsg(
"value too long for type character varying(%d)",
583 if (new_typmod < 0 || (old_typmod >= 0 && old_max <= new_max))
620 if (maxlen < 0 ||
len <= maxlen)
630 for (
i = maxmblen;
i <
len;
i++)
631 if (s_data[
i] !=
' ')
633 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
634 errmsg(
"value too long for type character varying(%d)",
679 for (
i =
len - 1;
i >= 0;
i--)
731 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
732 errmsg(
"could not determine which collation to use for string comparison"),
733 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
746 bool locale_is_c =
false;
791 bool locale_is_c =
false;
1002 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
1003 errmsg(
"could not determine which collation to use for string hashing"),
1004 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
1014 result =
hash_any((
unsigned char *) keydata, keylen);
1019 if (mylocale->
provider == COLLPROVIDER_ICU)
1022 UChar *uchar = NULL;
1026 ulen = icu_to_uchar(&uchar, keydata, keylen);
1028 bsize = ucol_getSortKey(mylocale->
info.icu.ucol,
1029 uchar, ulen, NULL, 0);
1031 ucol_getSortKey(mylocale->
info.icu.ucol,
1032 uchar, ulen,
buf, bsize);
1062 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
1063 errmsg(
"could not determine which collation to use for string hashing"),
1064 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
1080 if (mylocale->
provider == COLLPROVIDER_ICU)
1083 UChar *uchar = NULL;
1089 bsize = ucol_getSortKey(mylocale->
info.icu.ucol,
1090 uchar, ulen, NULL, 0);
1092 ucol_getSortKey(mylocale->
info.icu.ucol,
1093 uchar, ulen,
buf, bsize);
1131 else if (len1 < len2)
1133 else if (len1 > len2)
#define PG_GETARG_ARRAYTYPE_P(n)
int32 * ArrayGetIntegerTypmods(ArrayType *arr, int *n)
#define TextDatumGetCString(d)
#define OidIsValid(objectId)
static void PGresult * res
Size toast_raw_datum_size(Datum value)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
#define PG_FREE_IF_COPY(ptr, n)
#define PG_GETARG_CHAR(n)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_CSTRING(x)
#define PG_GETARG_DATUM(n)
#define PG_GETARG_CSTRING(n)
#define PG_GETARG_INT64(n)
#define PG_GETARG_NAME(n)
#define PG_GETARG_BPCHAR_PP(n)
#define PG_GETARG_VARCHAR_PP(n)
#define PG_RETURN_BPCHAR_P(x)
#define PG_RETURN_INT32(x)
#define PG_RETURN_NAME(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_POINTER(x)
#define PG_GET_COLLATION()
#define PG_RETURN_VARCHAR_P(x)
#define PG_RETURN_BOOL(x)
static Datum hash_any_extended(const unsigned char *k, int keylen, uint64 seed)
static Datum hash_any(const unsigned char *k, int keylen)
Assert(fmt[strlen(fmt) - 1] !='\n')
int pg_mbstrlen_with_len(const char *mbstr, int limit)
int pg_mbcharcliplen(const char *mbstr, int len, int limit)
int pg_mbcliplen(const char *mbstr, int len, int limit)
int pg_database_encoding_max_length(void)
void pfree(void *pointer)
void * palloc0(Size size)
int32 exprTypmod(const Node *expr)
Node * relabel_to_typmod(Node *expr, int32 typmod)
#define IsA(nodeptr, _type_)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static int list_length(const List *l)
bool lc_collate_is_c(Oid collation)
pg_locale_t pg_newlocale_from_collation(Oid collid)
static rewind_source * source
#define SET_VARSIZE(PTR, len)
#define VARSIZE_ANY_EXHDR(PTR)
static int cmp(const chr *x, const chr *y, size_t len)
struct SortSupportData * SortSupport
StringInfoData * StringInfo
union pg_locale_struct::@150 info
Datum bpcharrecv(PG_FUNCTION_ARGS)
Datum bpcharne(PG_FUNCTION_ARGS)
Datum varchar_support(PG_FUNCTION_ARGS)
static int bcTruelen(BpChar *arg)
Datum bpchar_larger(PG_FUNCTION_ARGS)
Datum bpchar_pattern_lt(PG_FUNCTION_ARGS)
Datum varcharrecv(PG_FUNCTION_ARGS)
Datum varcharout(PG_FUNCTION_ARGS)
int bpchartruelen(char *s, int len)
Datum bpchar_pattern_le(PG_FUNCTION_ARGS)
Datum bpcharsend(PG_FUNCTION_ARGS)
Datum varcharsend(PG_FUNCTION_ARGS)
Datum bpcharlen(PG_FUNCTION_ARGS)
Datum bpchar(PG_FUNCTION_ARGS)
Datum name_bpchar(PG_FUNCTION_ARGS)
Datum bpchar_sortsupport(PG_FUNCTION_ARGS)
Datum bpchargt(PG_FUNCTION_ARGS)
Datum btbpchar_pattern_sortsupport(PG_FUNCTION_ARGS)
Datum bpcharge(PG_FUNCTION_ARGS)
static int internal_bpchar_pattern_compare(BpChar *arg1, BpChar *arg2)
Datum bpchar_pattern_ge(PG_FUNCTION_ARGS)
static void check_collation_set(Oid collid)
Datum bpchartypmodout(PG_FUNCTION_ARGS)
Datum varcharin(PG_FUNCTION_ARGS)
Datum bpchartypmodin(PG_FUNCTION_ARGS)
Datum varchar(PG_FUNCTION_ARGS)
Datum bpcharlt(PG_FUNCTION_ARGS)
static BpChar * bpchar_input(const char *s, size_t len, int32 atttypmod)
Datum hashbpcharextended(PG_FUNCTION_ARGS)
Datum bpchar_smaller(PG_FUNCTION_ARGS)
Datum bpcharout(PG_FUNCTION_ARGS)
static int32 anychar_typmodin(ArrayType *ta, const char *typename)
Datum bpcharcmp(PG_FUNCTION_ARGS)
Datum bpchareq(PG_FUNCTION_ARGS)
Datum btbpchar_pattern_cmp(PG_FUNCTION_ARGS)
static char * anychar_typmodout(int32 typmod)
Datum bpchar_name(PG_FUNCTION_ARGS)
Datum bpcharin(PG_FUNCTION_ARGS)
Datum varchartypmodin(PG_FUNCTION_ARGS)
Datum varchartypmodout(PG_FUNCTION_ARGS)
Datum bpcharle(PG_FUNCTION_ARGS)
Datum bpcharoctetlen(PG_FUNCTION_ARGS)
Datum bpchar_pattern_gt(PG_FUNCTION_ARGS)
static VarChar * varchar_input(const char *s, size_t len, int32 atttypmod)
Datum char_bpchar(PG_FUNCTION_ARGS)
Datum hashbpchar(PG_FUNCTION_ARGS)
Datum textsend(PG_FUNCTION_ARGS)
int varstr_cmp(const char *arg1, int len1, const char *arg2, int len2, Oid collid)
void varstr_sortsupport(SortSupport ssup, Oid typid, Oid collid)
text * cstring_to_text_with_len(const char *s, int len)
text * cstring_to_text(const char *s)