Re: Comparing Datum's at aminsert() stage - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Comparing Datum's at aminsert() stage
Date
Msg-id 25792.1113858268@sss.pgh.pa.us
Whole thread Raw
In response to Comparing Datum's at aminsert() stage  ("Victor Y. Yegorov" <viy@mits.lv>)
Responses Re: Comparing Datum's at aminsert() stage  ("Victor Y. Yegorov" <viy@mits.lv>)
List pgsql-hackers
"Victor Y. Yegorov" <viy@mits.lv> writes:
> So, I'd like to ask -- what is the "reverse" function for heap_fill_tuple(),
> is it OK to use index_getattr()?

That's probably what you *have* to use, since the normal deconstructors
assume they are working with heap tuples, which are different.  But I
don't understand why you are waiting till after the index tuple is
formed.  The aminsert function gets an array of Datums to start with.
Why not do it there?

> And how do I compare 2 Datums? I need FmgrInfo pointer for the equality
> operator of the corresponding data type. Are there any API calls to obtain one?

Look at the array comparison functions for some ideas.  Be wary about
memory leaks: index AM code generally runs in a context that won't get
cleaned up until query end, so if you leak a little bit of memory per
call, you will have a problem you won't notice until it goes into the
field.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Christopher Browne
Date:
Subject: Re: argtype_inherit() is dead code
Next
From: Simon Riggs
Date:
Subject: Re: Problem with PITR recovery