Re: Comparing Datum's at aminsert() stage

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Victor Y(dot) Yegorov" <viy(at)mits(dot)lv>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Comparing Datum's at aminsert() stage
Date: 2005-04-18 21:04:28
Message-ID: 25792.1113858268@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Victor Y. Yegorov" <viy(at)mits(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-04-18 22:20:23 Re: Problem with PITR recovery
Previous Message Victor Y. Yegorov 2005-04-18 20:32:18 Comparing Datum's at aminsert() stage