how do functional indices work?

From: hubert depesz lubaczewski <depesz(at)depesz(dot)pl>
To: pgsql-general(at)postgresql(dot)org
Subject: how do functional indices work?
Date: 2001-09-04 05:59:59
Message-ID: 20010904075959.2626bbcc.depesz@depesz.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

hi
i have a question.
let's assume i have table users which is (id int4, person_id int4) - pkey'ed
on id with index on person_id.
next i have table people (id int4, fullname text) with pkey on id.
there is a foreign key between the two tables on users.person_id => people.id.
now i wrote a function, which given user id returns it's person's name. quite
simple function.
not i want to make a index:
create index test on users (myMagicalFunction(id));
this of course works, but the question is:
how this index will work if i'll modify the fullname in people table? would it
be automatically updated? if yes then how pgsql knows where to update this
index? if no - is there any possible workaround that can be done?

depesz

--
hubert depesz lubaczewski http://www.depesz.pl/
------------------------------------------------------------------------
... vows are spoken to be broken ... [enjoy the silence]
... words are meaningless and forgettable ... [depeche mode]

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Bergmann 2001-09-04 06:32:34 Re: SHOW
Previous Message David Ford 2001-09-04 05:41:52 is there a function/variable with remote host addr?