Re: immutable functions vs. join for lookups ? - Mailing list pgsql-performance

From Enrico Weigelt
Subject Re: immutable functions vs. join for lookups ?
Date
Msg-id 20050417060603.GA23283@nibiru.borg.metux.de
Whole thread Raw
In response to Re: immutable functions vs. join for lookups ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: immutable functions vs. join for lookups ?
List pgsql-performance
* Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Enrico Weigelt <weigelt@metux.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.


cu
--
---------------------------------------------------------------------
 Enrico Weigelt    ==   metux IT service

  phone:     +49 36207 519931         www:       http://www.metux.de/
  fax:       +49 36207 519932         email:     contact@metux.de
  cellphone: +49 174 7066481
---------------------------------------------------------------------
 -- DSL ab 0 Euro. -- statische IP -- UUCP -- Hosting -- Webshops --
---------------------------------------------------------------------

pgsql-performance by date:

Previous
From: Hannes Dorbath
Date:
Subject: Re: Query Optimizer Failure / Possible Bug
Next
From: Jaime Casanova
Date:
Subject: Re: immutable functions vs. join for lookups ?