pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jaime Casanova <systemguards@gmail.com>
To: weigelt@metux.de
To: pgsql-performance@postgresql.org
Subject: Re: immutable functions vs. join for lookups ?
Date: Sun, 17 Apr 2005 03:37:07 -0500
Message-ID: <c2d9e70e05041701372aee3a2c@mail.gmail.com> (raw)
In-Reply-To: <20050417060603.GA23283@nibiru.borg.metux.de>
References: <20050415205511.GB20345@nibiru.borg.metux.de>
	<6776.1113599567@sss.pgh.pa.us>
	<20050417060603.GA23283@nibiru.borg.metux.de>

On 4/17/05, Enrico Weigelt <weigelt@metux.de> wrote:
> * 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.
> 
Even if your data never changes it *can* change so the function should
be at most stable not immutable.

regards,
Jaime Casanova



view thread (18+ messages)  latest in thread

Message-ID: <c2d9e70e05041701372aee3a2c@mail.gmail.com>
Permalink:  ../c2d9e70e05041701372aee3a2c@mail.gmail.com/
Also on:    postgresql.org/message-id/c2d9e70e05041701372aee3a2c@mail.gmail.com

 · 

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: systemguards@gmail.com, weigelt@metux.de
  Subject: Re: immutable functions vs. join for lookups ?
  In-Reply-To: <c2d9e70e05041701372aee3a2c@mail.gmail.com>

* 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