Re: [SQL] unique names in variables and columns in plsql functions

2006-03-27 Thread Wiebe Cazemier
(Whoops, pressed wrong reply button. Here it is correctly this time.) On 03/27/06 17:02, Tom Lane wrote: >It'll retrieve whatever the current value of the plpgsql variable >provider_id is. plpgsql always assumes that ambiguous names refer >to its variables (indeed, it isn't even directly aware t

Re: [SQL] unique names in variables and columns in plsql functions

2006-03-27 Thread Wiebe Cazemier
(Whoops, pressed wrong reply button. Here it is correctly this time.) On 03/27/06 16:48, Jim C. Nasby wrote: > >Sadly, overloading variable names between plpgsql and SQL is *highly* >problematic. Because of this I *always* prefix plpgsql variables with >something, such as p_ for parameters and v_

Re: [SQL] unique names in variables and columns in plsql functions

2006-03-27 Thread Jim C. Nasby
On Mon, Mar 27, 2006 at 10:02:24AM -0500, Tom Lane wrote: > Wiebe Cazemier <[EMAIL PROTECTED]> writes: > > DECLARE > > provider_id INTEGER; > > BEGIN > > provider_id := (SELECT provider_id FROM investment_products WHERE id = > > my_new.investment_product_id); > > END; > > > After a lot of trou

Re: [SQL] unique names in variables and columns in plsql functions

2006-03-27 Thread Tom Lane
Wiebe Cazemier <[EMAIL PROTECTED]> writes: > DECLARE > provider_id INTEGER; > BEGIN > provider_id := (SELECT provider_id FROM investment_products WHERE id = > my_new.investment_product_id); > END; > After a lot of trouble, I found out this line doesn't work correctly > with the variable name a

Re: [SQL] unique names in variables and columns in plsql functions

2006-03-27 Thread Jim C. Nasby
On Mon, Mar 27, 2006 at 04:33:55PM +0200, Wiebe Cazemier wrote: > Hi, > > In a plpgsl function, consider the following excerpt: > > DECLARE > provider_id INTEGER; > BEGIN > provider_id := (SELECT provider_id FROM investment_products WHERE id = > my_new.investment_product_id); > END; > > Afte