Hello 2011/4/21 Nick Raj <nickrajjain@xxxxxxxxx>: > Hi, > I am defining a new data type called mpoint > i.e. > typedef struct mpoint > { > ÂÂÂ Point p; > ÂÂÂ Timestamp t; > } mpoint; > > For defining input/output function > > 1ÂÂÂÂ Datum mpoint_in(PG_FUNCTION_ARGS) > 2ÂÂÂÂ { > 3 > 4ÂÂÂÂÂÂÂ mpoint *result; > 5ÂÂÂÂÂÂÂ char *pnt=(char *)malloc (sizeof (20)); > 6ÂÂÂÂÂÂÂ char *ts=(char *)malloc (sizeof (20)); > 7 ÂÂÂÂÂÂ result= (mpoint *) palloc(sizeof(mpoint)); > 8ÂÂÂÂÂÂÂ char *st = PG_GETARG_CSTRING(0); > 9ÂÂÂÂÂÂÂ mpoint_decode(st,pnt,ts); > // st breaks down into pnt that corresponds to Point and ts corresponds to > Timestamp > 10 > 11 ÂÂÂÂ result->p = point_in(PointerGetDatum(pnt));ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ // > point_in (input function for point that assigns x, y into point) > 12 ÂÂÂÂ result-> t = timestamp_in(PointerGetDatum(ts));ÂÂÂÂÂÂÂÂ // similar > for timestamp > 13 > 14 ÂÂÂÂ PG_RETURN_MPOINT_P(result); > 15ÂÂ } > > line no 11 warning: passing argument 1 of âpoint_inâ makes pointer from > integer without a cast > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ../../../include/utils/geo_decls.h:191: note: expected > âFunctionCallInfoâ but argument is of type âunsigned intâ > line no 11 error: incompatible types when assigning to type âPointâ from > type âDatumâ > line no 12 warning: passing argument 1 of âtimestamp_inâ makes pointer from > integer without a cast > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ../../../include/utils/timestamp.h:205: note: expected > âFunctionCallInfoâ but argument is of type âunsigned intâ > you are missing a important header files. > Can anybody figure out what kind of mistake i am doing? > Also, why it got related to 'FunctionCallInfo' ? see on definition of PG_FUNCTION_ARGS macro Regards Pavel Stehule > > Thanks > Nick > -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general