Local variable and column name conflict

From: "Daniel Caune" <daniel(dot)caune(at)ubisoft(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Local variable and column name conflict
Date: 2006-07-03 15:34:36
Message-ID: 1E293D3FF63A3740B10AD5AAD88535D2029164E4@UBIMAIL1.ubisoft.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Is there a way to specify a local variable/parameter within a query
where a column has the same name than the local variable/parameter?

Example:

CREATE OR REPLACE FUNCTION foo(i IN int)
RETURNS void
AS $$
BEGIN
UPDATE bar
SET i = i; // column i = parameter i
END;
$$ LANGUAGE PLPGSQL;

For instance, Ingres suggests prefixing local variable/parameter with
":" in the query:

UPDATE bar
SET i = :i;

I can continue using the de facto Oracle's naming convention
(P_parameter and V_local_variable) anyway. That's not a big deal.

Regards,

--
Daniel CAUNE
Ubisoft Online Technology
(514) 490 2040 ext. 3613

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-07-03 15:37:54 Re: Local variable and column name conflict
Previous Message Richard Broersma Jr 2006-07-03 13:09:46 Re: hi i need to connect database from my system to another