Re: A Query that works standalone but not in a f(x) - Mailing list pgsql-general

From Tom Lane
Subject Re: A Query that works standalone but not in a f(x)
Date
Msg-id 20835.1295557155@sss.pgh.pa.us
Whole thread Raw
In response to A Query that works standalone but not in a f(x)  (Ralph Smith <rsmith@10kinfo.com>)
Responses Re: A Query that works standalone but not in a f(x)
List pgsql-general
Ralph Smith <rsmith@10kinfo.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

pgsql-general by date:

Previous
From: Ralph Smith
Date:
Subject: A Query that works standalone but not in a f(x)
Next
From: Ralph Smith
Date:
Subject: Re: A Query that works standalone but not in a f(x)