From: Samuel Gendler <sgendler@ideasculptor.com>
To: David Johnston <polobo@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: ambiguous local variable name in 9.0 proc
Date: Wed, 21 Sep 2011 16:55:28 -0700
Message-ID: <CAEV0TzDNpTyOnEdHes3eFOv2Dcs_SHyoPymd=hTYH4dASyS7ug@mail.gmail.com> (raw)
In-Reply-To: <00c301cc78b9$0ca38e30$25eaaa90$@yahoo.com>
References: <CAEV0TzB5GDuaG=7OOv_7m6OWagAkkUmkeh=1a62E46o4wKdtgg@mail.gmail.com>
<00c301cc78b9$0ca38e30$25eaaa90$@yahoo.com>
On Wed, Sep 21, 2011 at 4:49 PM, David Johnston <polobo@yahoo.com> wrote:
> ** **
>
> *
> *
>
> Not tested but I think all local variables are implicitly scoped to the
> function name so you should be able to do the following:****
>
> ** **
>
> WHERE reporting_mgmt.aggregate_timescales_impl.tbl_schema = e.tbl_schema**
> **
>
> **
>
Yep. It is also possible to change the db behaviour globally or on a
per-function basis
from
http://developer.postgresql.org/pgdocs/postgres/plpgsql-implementation.html
"To change this behavior on a system-wide basis, set the configuration
parameter plpgsql.variable_conflict to one of error, use_variable, or
use_column(where error is the factory default)."
You can also set the behavior on a function-by-function basis, by inserting
one of these special commands at the start of the function text:
#variable_conflict error
#variable_conflict use_variable
#variable_conflict use_column
Sorry for jumping straight a mailing list query. It was actually relatively
easy to find in the docs. Now to figure out if the function name scoping
trick works in 8.4 so that I can modify my procs prior to upgrading my db.
--sam
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: sgendler@ideasculptor.com, polobo@yahoo.com
Subject: Re: ambiguous local variable name in 9.0 proc
In-Reply-To: <CAEV0TzDNpTyOnEdHes3eFOv2Dcs_SHyoPymd=hTYH4dASyS7ug@mail.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