Re: C function woes
От
Peter Eisentraut
Тема
Re: C function woes
Дата
Msg-id
Pine.LNX.4.30.0102211735230.1381-100000@peter.localdomain
Ответ на
Re: C function woes (Tom Lane)
Список
Дерево обсуждения
Printing PostgreSQL reports Richard Ehrlich <richard@techspt.com>
Re: Printing PostgreSQL reports Jeff MacDonald <jeff@pgsql.com>
Re: Printing PostgreSQL reports fabrizio.ermini@sysdat.it
Re: Printing PostgreSQL reports Peter Eisentraut <peter_e@gmx.net>
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/
В списке pgsql-general по дате отправления