48 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
49 errmsg(
"invalid type modifier")));
53 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
54 errmsg(
"length for type %s must be at least 1",
typename)));
57 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
58 errmsg(
"length for type %s cannot exceed %d",
146 if (charlen > maxlen)
157 for (
j = mbmaxlen;
j <
len;
j++)
161 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
162 errmsg(
"value too long for type character(%d)",
170 maxlen =
len = mbmaxlen;
178 maxlen =
len + (maxlen - charlen);
189 memset(r +
len,
' ', maxlen -
len);
208 result =
bpchar_input(s, strlen(s), atttypmod, fcinfo->context);
297 if (charlen == maxlen)
300 if (charlen > maxlen)
309 for (
i = maxmblen;
i <
len;
i++)
312 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
313 errmsg(
"value too long for type character(%d)",
331 maxlen =
len + (maxlen - charlen);
344 memset(r +
len,
' ', maxlen -
len);
389 if (s_data[
len - 1] !=
' ')
471 for (
j = mbmaxlen;
j <
len;
j++)
475 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
476 errmsg(
"value too long for type character varying(%d)",
505 result =
varchar_input(s, strlen(s), atttypmod, fcinfo->context);
589 if (new_typmod < 0 || (old_typmod >= 0 && old_max <= new_max))
626 if (maxlen < 0 ||
len <= maxlen)
636 for (
i = maxmblen;
i <
len;
i++)
637 if (s_data[
i] !=
' ')
639 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
640 errmsg(
"value too long for type character varying(%d)",
685 for (
i =
len - 1;
i >= 0;
i--)
737 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
738 errmsg(
"could not determine which collation to use for string comparison"),
739 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
752 bool locale_is_c =
false;
797 bool locale_is_c =
false;
1008 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
1009 errmsg(
"could not determine which collation to use for string hashing"),
1010 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
1020 result =
hash_any((
unsigned char *) keydata, keylen);
1028 bsize =
pg_strnxfrm(NULL, 0, keydata, keylen, mylocale);
1033 elog(
ERROR,
"pg_strnxfrm() returned unexpected result");
1063 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
1064 errmsg(
"could not determine which collation to use for string hashing"),
1065 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
1084 bsize =
pg_strnxfrm(NULL, 0, keydata, keylen, mylocale);
1089 elog(
ERROR,
"pg_strnxfrm() returned unexpected result");
1128 else if (len1 < len2)
1130 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
elog(ERROR, "%s: %s", p2, msg)
Size toast_raw_datum_size(Datum value)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#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)
size_t pg_strnxfrm(char *dest, size_t destsize, const char *src, size_t srclen, pg_locale_t locale)
bool lc_collate_is_c(Oid collation)
pg_locale_t pg_newlocale_from_collation(Oid collid)
bool pg_locale_deterministic(pg_locale_t locale)
static rewind_source * source
static int32 DatumGetInt32(Datum X)
static int cmp(const chr *x, const chr *y, size_t len)
struct SortSupportData * SortSupport
StringInfoData * StringInfo
#define SET_VARSIZE(PTR, len)
#define VARSIZE_ANY_EXHDR(PTR)
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)
static VarChar * varchar_input(const char *s, size_t len, int32 atttypmod, Node *escontext)
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)
static BpChar * bpchar_input(const char *s, size_t len, int32 atttypmod, Node *escontext)
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)
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)
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)