Re: A Query that works standalone but not in a f(x)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ralph Smith <rsmith(at)10kinfo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: A Query that works standalone but not in a f(x)
Date: 2011-01-20 20:59:15
Message-ID: 20835.1295557155@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ralph Smith <rsmith(at)10kinfo(dot)com> writes:
> Within the function I have:

> for darec in select * from purchbt where addr not like ''%STE%STE%'' and
> addr not like ''%STE%STE%STE%'' and (addr similar to
> ''%STE[A-Z]*[0-9]+'' or addr similar to ''%STE[A-Z]*[0-9]+[A-Z]'' or
> addr similar to ''%STE[A-Z]*[0-9]+[A-Z][A-Z]'') loop

> and it finds no records.
> Outside the function, replace '' with ', I DO get the results I expect.

Maybe "addr" is the name of a local variable inside the function?
Pre-9.0, that sort of ambiguity can bite you pretty easily.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Robert Paresi 2011-01-20 21:10:27 Re: Moving from SQL Anywhere to PostGres - First Time
Previous Message Ralph Smith 2011-01-20 20:31:12 A Query that works standalone but not in a f(x)