pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Enrico Weigelt <weigelt@metux.de>
To: pgsql-performance@postgresql.org
Subject: Re: immutable functions vs. join for lookups ?
Date: Sun, 17 Apr 2005 08:06:04 +0200
Message-ID: <20050417060603.GA23283@nibiru.borg.metux.de> (raw)
In-Reply-To: <6776.1113599567@sss.pgh.pa.us>
References: <20050415205511.GB20345@nibiru.borg.metux.de>
	<6776.1113599567@sss.pgh.pa.us>

* 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 --
---------------------------------------------------------------------



view thread (18+ messages)  latest in thread

Message-ID: <20050417060603.GA23283@nibiru.borg.metux.de>
Permalink:  ../20050417060603.GA23283@nibiru.borg.metux.de/
Also on:    postgresql.org/message-id/20050417060603.GA23283@nibiru.borg.metux.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: weigelt@metux.de
  Subject: Re: immutable functions vs. join for lookups ?
  In-Reply-To: <20050417060603.GA23283@nibiru.borg.metux.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox