"Pavel Stehule" <[EMAIL PROTECTED]> writes: > > Datum *const_fce(PG_FUNCTION_ARGS) > { > text *txt = palloc(5 + VARHDRSZ); > memcpy(VARDATA(txt), "pavel", 5); > VARATT_SIZE(txt) = 5 + VARHDRSZ; > > PG_RETURN_TEXT_P(txt); > }
Much better practice is to use the input function of the data type you want to convert to: { text *txt = DatumGetTextP(DirectFunctionCall1(textin, CStringGetDatum("pavel"))); PG_RETURN_TEXT_P(txt); } -- Gregory Stark EnterpriseDB http://www.enterprisedb.com ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster