Re: C function and enum types parameters
От | Edoardo Panfili |
---|---|
Тема | Re: C function and enum types parameters |
Дата | |
Msg-id | 47E7C244.7010506@aspix.it обсуждение исходный текст |
Ответ на | C function and enum types parameters (Edoardo Panfili <edoardo@aspix.it>) |
Список | pgsql-general |
Edoardo Panfili ha scritto: > I use a C function in my database from 2002, all goes well also with > postgresql 8.3 but with 8.3.1 it no longer works, the problem is with > this line: > > text *hibrid = (PG_ARGISNULL( 0) || > VARSIZE(PG_GETARG_TEXT_P( 0))==VARHDRSZ ?NULL:PG_GETARG_TEXT_P(0)); > > the argument number 0 is an enum defined by > > CREATE TYPE hibridationLevel AS ENUM('none','genus','specie'); > > the error is "ERROR: invalid memory alloc request size 2298488997" > > I can't figure by now how to correct my error, can anyone help me? > I am still working on this after further investigation I can see that the function is not correct also under postgres 8.3 (but it not raises the error) Is seems OK to retrieve the enum argument using Oid oid = PG_GETARG_OID(0); But using this way I can see only the Oid. Can anyone confirm that this is the correct way to work with enum inside a function?. This is my little test case -----------------------function-------------------------------- Datum prova1(PG_FUNCTION_ARGS){ Oid oid = PG_GETARG_OID(0); ereport(WARNING, (errmsg_internal("(1) parametro1: %d", oid))); } -----------------------SQL definition-------------------------- CREATE FUNCTION prova1(hibridationLevel,text) RETURNS int AS 'funzioniGDB2.so' LANGUAGE C WITH (iscachable);" --------------------------------------------------------------- thank you Edoardo -- Jabber: edoardopa@talk.google.com tel: 075 9142766
В списке pgsql-general по дате отправления: