comparing index columns

From: "Pavan Deolasee" <pavan(dot)deolasee(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: comparing index columns
Date: 2007-06-12 11:38:38
Message-ID: 2e78013d0706120438n17961c72iaa0c916698390009@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

As per HOT design, a necessary condition to do HOT updates is
that an index column must not be updated. I am invoking the type
specific equality operator to compare two index columns, something
like this (which I think I had copied from ri_KeysEqual(), but that too have
changed now):

typeid = SPI_gettypeid(relation->rd_att, attrnum);
typentry = lookup_type_cache(typeid, TYPECACHE_EQ_OPR_FINFO);

if (!OidIsValid(typentry->eq_opr_finfo.fn_oid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_FUNCTION),
errmsg("could not identify an equality
operator "
"for type %s", format_type_be(typeid))));

/*
* Call the type specific '=' function
*/
if (!DatumGetBool(FunctionCall2(&(typentry->eq_opr_finfo),
oldvalue, newvalue)))
return true;

Heikki pointed out that this may not work correctly with operator classes
where we should actually be using the operator from the given operator class
instead of the default operator of the type.

I don't have much insight into the operator classes and operator families
and how they work. Where should I look for the related code ? Is there
anything else we should be worried about as well ?

Any help is appreciated.

Thanks,
Pavan

--
Pavan Deolasee
EnterpriseDB http://www.enterprisedb.com

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-06-12 11:43:47 Re: Selecting a constant question
Previous Message Zdenek Kotala 2007-06-12 11:20:21 Re: Autovacuum launcher doesn't notice death of postmaster immediately