On 4/17/05, Enrico Weigelt <weigelt(at)metux(dot)de> wrote:
> * Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> > Enrico Weigelt <weigelt(at)metux(dot)de> writes:
> > > c) CREATE FUNCTION id2username(oid) RETURNS text
> > > LANGUAGE 'SQL' IMMUTABLE AS '
> > > SELECT username AS RESULT FROM users WHERE uid = $1';
> >
> > This is simply dangerous. The function is *NOT* immutable (it is
> > stable though). When ... not if ... your application breaks because
> > you got the wrong answers, you'll get no sympathy from anyone.
>
> In my case it is immutable. The username never changes.
>
Even if your data never changes it *can* change so the function should
be at most stable not immutable.
regards,
Jaime Casanova