Input Function (domain_in) Call

Started by Volkan YAZICIover 19 years ago2 messages
#1Volkan YAZICI
yazicivo@ttnet.net.tr

Hi,

I was using OidInputFunctionCall() to cast a basic type into a domain
type. But when I saw

/*
* As above, for I/O functions identified by OID. These are only to be
* used in seldom-executed code paths. They are not only slow but leak
* memory.
*/
Datum
OidInputFunctionCall(Oid functionId, char *str,
Oid typioparam, int32 typmod)

comment in backend/utils/fmgr/fmgr.c, I started to consider my decision.
Is this the right way to use domain_in() function? Which way would you
suggest? Or is there a totally different way to accomplish basic type to
domain transition?

Regards.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Volkan YAZICI (#1)
Re: Input Function (domain_in) Call

Volkan YAZICI <yazicivo@ttnet.net.tr> writes:

I was using OidInputFunctionCall() to cast a basic type into a domain
type.
Is this the right way to use domain_in() function?

If you're doing it more than about once per SQL command, you should find
a place to cache the fmgr lookup info and use InputFunctionCall instead.
Look at the standard PLs for examples.

regards, tom lane