Re: Function call order dependency

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql(at)mohawksoft(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Function call order dependency
Date: 2008-09-03 15:05:19
Message-ID: 20971.1220454319@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pgsql(at)mohawksoft(dot)com writes:
> For example I'll use the Oracle "contains" function, though this is not
> exactly what I'm doing, it just illustrates the issue clearly.

> select *, score(1) from mytable where contains(mytable.title, 'Winding
> Road', 1) order by score(1);

> The "contains" function does a match against mytable.title for the term
> 'Winding Road' and both returns and saves an integer score which may be
> retrieved later using the "score(...)" function.

This is just a bad, bad idea. Side-effects in a WHERE-clause function
are guaranteed to cause headaches. When (not if) it breaks, you get
to keep both pieces.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen R. van den Berg 2008-09-03 15:08:01 Re: Function call order dependency
Previous Message Joshua D. Drake 2008-09-03 14:52:38 Re: [PATCH] Cleanup of GUC units code