how do functional indices work? - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject how do functional indices work?
Date
Msg-id 20010904075959.2626bbcc.depesz@depesz.pl
Whole thread Raw
Responses Re: how do functional indices work?
List 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]

pgsql-general by date:

Previous
From: David Ford
Date:
Subject: is there a function/variable with remote host addr?
Next
From: Stephan Bergmann
Date:
Subject: Re: SHOW