Markus Schulz <msc@xxxxxxxxxxxxx> writes: > here is the etextin code:(cut'n'paste from adt/varlena.c Code) > Datum > etextin(PG_FUNCTION_ARGS) > { > char *inputText = PG_GETARG_CSTRING(0); > text *result; > int len=0; > /* verify encoding */ > len = strlen(inputText); > pg_verifymbstr(inputText, len, false); > result = (text *) palloc(len + VARHDRSZ); > VARATT_SIZEP(result) = len + VARHDRSZ; > memcpy(VARDATA(result), inputText, len); > PG_RETURN_TEXT_P(result); > } That code looks fine as far as it goes. I think you forgot to add a PG_FUNCTION_INFO_V1() macro; which means the system is calling this with the wrong argument layout. regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match