This is a discussion on C function and enum types parameters within the Pgsql General forums, part of the PostgreSQL category; --> I use a C function in my database from 2002, all goes well also with postgresql 8.3 but with ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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? thank you edoardo -- Jabber: edoardopa@talk.google.com tel: 075 9142766 -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/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 - Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general |
| Thread Tools | |
| Display Modes | |
|
|