Re: immutable functions and enumerate type casts in indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Edoardo Panfili <edoardo(at)aspix(dot)it>
Cc: pgsql-general(at)postgresql(dot)org, Martijn van Oosterhout <kleptog(at)svana(dot)org>
Subject: Re: immutable functions and enumerate type casts in indexes
Date: 2008-09-03 14:53:28
Message-ID: 20763.1220453608@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Edoardo Panfili <edoardo(at)aspix(dot)it> writes:
> labelDatum = DirectFunctionCall1(enum_out,datumIbrido);
> label = (char *) DatumGetPointer(labelDatum);

Just FYI, preferred style for the second line would be

label = DatumGetCString(labelDatum);

Nearly all standard data types have DatumGetFoo and FooGetDatum
macros to hide the conversion details (even if it's only a cast).

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-09-03 15:17:51 Re: vacuum analyze hurts performance
Previous Message Edoardo Panfili 2008-09-03 13:42:38 Re: immutable functions and enumerate type casts in indexes