From: Wiebe Cazemier <halfgaar@gmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: unique names in variables and columns in plsql functions
Date: Mon, 27 Mar 2006 23:39:04 +0200
Message-ID: <44285B78.8010804@gmail.com> (raw)
In-Reply-To: <14263.1143471744@sss.pgh.pa.us>
References: <4427F7D3.3000103@gmail.com>
<14263.1143471744@sss.pgh.pa.us>
(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.
Attachments:
signature.asc (application/pgp-signature, 259B) download
signature.asc (application/pgp-signature, 257B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: halfgaar@gmail.com
Subject: Re: unique names in variables and columns in plsql functions
In-Reply-To: <44285B78.8010804@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox