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

From Tom Lane
Subject Re: Local variable and column name conflict
Date
Msg-id 3434.1151941074@sss.pgh.pa.us
Whole thread Raw
In response to Local variable and column name conflict  ("Daniel Caune" <daniel.caune@ubisoft.com>)
List pgsql-sql
"Daniel Caune" <daniel.caune@ubisoft.com> writes:
> CREATE OR REPLACE FUNCTION foo(i IN int)
>   RETURNS void
> AS $$
> BEGIN
>   UPDATE bar
>     SET i = i; // column i = parameter i
> END;
> $$ LANGUAGE PLPGSQL;

In SELECTs you can qualify the column, ie, bar.i vs i.  That doesn't
work for an UPDATE target, though, so probably the best answer is
"don't do that".  I think it's entirely too error-prone anyway ...
        regards, tom lane


pgsql-sql by date:

Previous
From: "Daniel Caune"
Date:
Subject: Local variable and column name conflict
Next
From: Thomas Beutin
Date:
Subject: Re: join two tables with sharing some columns between two