Re: Problem with function - Mailing list pgsql-general

From Rich Hall
Subject Re: Problem with function
Date
Msg-id 401E5CC4.7080605@micropat.com
Whole thread Raw
In response to Re: Problem with function  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
>>
      uom := (select uom from prodclass where code = prod_class) ;
>>

Now I want to know why this syntax even compiles!?
What does this mean in plpgsql and where can I find a discussionin the
documentation?

Rick


Tom Lane wrote:

>"Frank Millman" <frank@chagford.com> writes:
>
>
>>      uom := (select uom from prodclass where code = prod_class) ;
>>
>>
>        ^^^            ^^^
>
>It's a bad idea to use plpgsql variable names that match fields of your
>tables.  In this case, since the variable uom starts out NULL, the
>select effectively reads "(select NULL from ...)".
>
>            regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 9: the planner will ignore your desire to choose an index scan if your
>      joining column's datatypes do not match
>
>
>

--




pgsql-general by date:

Previous
From: Christian Rank
Date:
Subject: isolating users from each other
Next
From: Terry Lee Tucker
Date:
Subject: Return Value of a Function