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",
145 if (charlen > maxlen)
156 for (
j = mbmaxlen;
j <
len;
j++)
160 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
161 errmsg(
"value too long for type character(%d)",
169 maxlen =
len = mbmaxlen;
177 maxlen =
len + (maxlen - charlen);
188 memset(r +
len,
' ', maxlen -
len);
207 result =
bpchar_input(s, strlen(s), atttypmod, fcinfo->context);
296 if (charlen == maxlen)
299 if (charlen > maxlen)
308 for (
i = maxmblen;
i <
len;
i++)
311 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
312 errmsg(
"value too long for type character(%d)",
330 maxlen =
len + (maxlen - charlen);
343 memset(r +
len,
' ', maxlen -
len);
388 if (s_data[
len - 1] !=
' ')
470 for (
j = mbmaxlen;
j <
len;
j++)
474 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
475 errmsg(
"value too long for type character varying(%d)",
504 result =
varchar_input(s, strlen(s), atttypmod, fcinfo->context);
588 if (new_typmod < 0 || (old_typmod >= 0 && old_max <= new_max))
625 if (maxlen < 0 ||
len <= maxlen)
635 for (
i = maxmblen;
i <
len;
i++)
636 if (s_data[
i] !=
' ')
638 (
errcode(ERRCODE_STRING_DATA_RIGHT_TRUNCATION),
639 errmsg(
"value too long for type character varying(%d)",
684 for (
i =
len - 1;
i >= 0;
i--)
736 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
737 errmsg(
"could not determine which collation to use for string comparison"),
738 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
999 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
1000 errmsg(
"could not determine which collation to use for string hashing"),
1001 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
1010 result =
hash_any((
unsigned char *) keydata, keylen);
1018 bsize =
pg_strnxfrm(NULL, 0, keydata, keylen, mylocale);
1025 elog(
ERROR,
"pg_strnxfrm() returned unexpected result");
1055 (
errcode(ERRCODE_INDETERMINATE_COLLATION),
1056 errmsg(
"could not determine which collation to use for string hashing"),
1057 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
1075 bsize =
pg_strnxfrm(NULL, 0, keydata, keylen, mylocale);
1082 elog(
ERROR,
"pg_strnxfrm() returned unexpected result");
1121 else if (len1 < len2)
1123 else if (len1 > len2)
#define PG_GETARG_ARRAYTYPE_P(n)
int32 * ArrayGetIntegerTypmods(ArrayType *arr, int *n)
#define TextDatumGetCString(d)
#define Assert(condition)
#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 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)
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 int list_length(const List *l)
size_t pg_strnxfrm(char *dest, size_t destsize, const char *src, ssize_t srclen, pg_locale_t locale)
pg_locale_t pg_newlocale_from_collation(Oid collid)
static rewind_source * source
static int32 DatumGetInt32(Datum X)
MemoryContextSwitchTo(old_ctx)
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)