Tom Lane writes:
> text *
> hello()
> {
> char data[] = "hello world";
> int32 new_text_size = VARHDRSZ + sizeof(data);
> text *new_text = (text *) palloc(new_text_size);
>
> VARSIZE(new_text) = new_text_size;
> memcpy(VARDATA(new_text), data, sizeof(data));
> return new_text;
> }
Is it good practice to scribble around in data type internals? Why not
text *
hello()
{
return textin("hello world");
}
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/