(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 that there's >any possible ambiguity here). > > That's why I suspected it would be NULL, since provider_id wasn't initialised yet. > >How and why would it determine that? In general it's perfectly normal >to use plpgsql variable values in SQL commands. I don't think it'd make >the system more usable if the parser tried to apply a heuristic rule >about some occurrences being meant as variable references and other ones >not. If the rule ever got it wrong, it'd be even more confusing. > I guess I'm looking at it too much as a human. I said "SELECT FROM" so, it guess I assumed it would be clear enough which one it had to use. But, now that I'm thinking about it some more, I agree. However, a fatal error would also have been welcome.
signature.asc
Description: PGP signature
signature.asc
Description: OpenPGP digital signature