Determine index's attribute number by scankey

Started by Victor Yegorovover 20 years ago3 messages
#1Victor Yegorov
viy@mits.lv

Hello.

Is it possible to somehow determine index's attribute number that is target
one for given scankey?

I've checked nbtree AM code and found no evidence of such an ability. I need
that, because I'm storing each indexed value only once in a form of index
tuple, consisting of only 1 attribute.

If that's not possible now, I'd like to add sk_index_attnum entry to the
ScanKeyData structure.

--

Victor Y. Yegorov

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Victor Yegorov (#1)
Re: Determine index's attribute number by scankey

Victor Yegorov <viy@mits.lv> writes:

Is it possible to somehow determine index's attribute number that is target
one for given scankey?

sk_attno?

regards, tom lane

#3Victor Yegorov
viy@mits.lv
In reply to: Tom Lane (#2)
Re: Determine index's attribute number by scankey

* Tom Lane <tgl@sss.pgh.pa.us> [14.07.2005 01:00]:

sk_attno?

It seems, that sk_attno holds number of scankey itself.

I have table with 3 columns (a, b, c) and index (b, c).
For both selects (only 1 where clause in both of them):

select * from tab where b = ...

and

select * from tab where c = ...

sk_attno reports 0, that made me think of adding new entry to the scankey.

--

Victor Y. Yegorov