How to compare different datums within from a tuple?

Поиск
Список
Период
Сортировка
От Peter Moser
Тема How to compare different datums within from a tuple?
Дата
Msg-id 55C8D317.5080305@gmail.com
обсуждение исходный текст
Ответы Re: How to compare different datums within from a tuple?  (Anastasia Lubennikova <lubennikovaav@gmail.com>)
Re: How to compare different datums within from a tuple?  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
Hello,
I try to write my first patch. It is too early to tell more about it, 
but I am just fiddling around with some prototypes.

Can someone tell me, how I can compare two datum fields, when I do not 
know the data type in advance inside an executor function?

For example, "x less than y" where x and y are of various types that 
form intervals. I have found the method ExecTuplesMatch, but it is only 
for equality comparison, I think. Another one is ApplySortComparator... 
maybe that's the correct way to go?

Some code to make things clearer...

Datum x = heap_getattr(out->tts_tuple,    node->xpos,    out->tts_tupleDescriptor,    &isNull1);
Datum y = slot_getattr(curr, node->ypos, &isNull2);

if (compareDatumWithCorrectMethod(x,y) < 0)
{ /* do something */
}

Thx,
Peter



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Petr Jelinek
Дата:
Сообщение: Re: WIP: Rework access method interface
Следующее
От: Petr Jelinek
Дата:
Сообщение: Re: WIP: Rework access method interface