Thanks for all your answers,
I begin to study.
Enrico
--
Enrico <[EMAIL PROTECTED]>
---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster
"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
On Sun, Feb 18, 2007 at 12:56:08PM -0500, [EMAIL PROTECTED] wrote:
> Hi,
> just for fun, I wrote a little postgresql contrib,
> who has a C function called myfun inside it.
> The function myfun returns a value , now I return
> a cstring type value, and it works fine if
> I run from psql shell:
Y
"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 dat
Hello
cstring is clasic c (zero terminated) string and is used only in some
PostgreSQL functions. This type isn't compatible with text and you have to
explicit cast trick with textin function.
root=# select textin(('abc'::cstring));
textin
abc
(1 row)
Standard is using VARLENA types
Hi,
just for fun, I wrote a little postgresql contrib,
who has a C function called myfun inside it.
The function myfun returns a value , now I return
a cstring type value, and it works fine if
I run from psql shell:
select value from myfun(paramteres);
but I can't do an insert like:
insert (ch