function param and declared variable of same name

Поиск
Список
Период
Сортировка
От Sim Zacks
Тема function param and declared variable of same name
Дата
Msg-id 4E5F1858.8040207@compulab.co.il
обсуждение исходный текст
Список pgsql-general
<meta http-equiv=3D"content-type" content=3D"text/html; charset=3DISO-8=
859-1">body
      p { margin-bottom: 0cm; margin-top: 0pt; }

  <body style=3D"direction: ltr;"
    bidimailui-detected-decoding-type=3D"latin-charset" bgcolor=3D"#ffffff"
    text=3D"#000000">
    Tested in 8.2 and 9.0.1
    In plpgsql, if you have a function parameter and a variable of the
    same name, it ignores the value passed in and initializes the
    variable to null.
    The correct action, IMO, would be to raise an error.

    create or replace function test1(x int) returns int as
    $$
    declare x int;
    begin
    =A0=A0=A0 return x;
    end;
    $$ language 'plpgsql';

    Thanks
    Sim

В списке pgsql-general по дате отправления:

Предыдущее
От: Guillaume Lelarge
Дата:
Сообщение: Re: ERD Tool
Следующее
От: Sim Zacks
Дата:
Сообщение: Re: function on trigger