Local variable and column name conflict - Mailing list pgsql-sql

From Daniel Caune
Subject Local variable and column name conflict
Date
Msg-id 1E293D3FF63A3740B10AD5AAD88535D2029164E4@UBIMAIL1.ubisoft.org
Whole thread Raw
Responses Re: Local variable and column name conflict  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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


pgsql-sql by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: hi i need to connect database from my system to another
Next
From: Tom Lane
Date:
Subject: Re: Local variable and column name conflict