Re: unique names in variables and columns in plsql functions - Mailing list pgsql-sql

From Wiebe Cazemier
Subject Re: unique names in variables and columns in plsql functions
Date
Msg-id 44285B78.8010804@gmail.com
Whole thread Raw
In response to Re: unique names in variables and columns in plsql functions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
(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.


Attachment

pgsql-sql by date:

Previous
From: Wiebe Cazemier
Date:
Subject: Re: unique names in variables and columns in plsql functions
Next
From: Maciej Piekielniak
Date:
Subject: cursor and for update