Tom Lane wrote:
> Josh Berkus <[email protected]> writes:
>
>>>True, but there were clear benefits from doing so. Disallowing "="
>>>assignment in plpgsql wouldn't buy anything, just break programs.
>
>
>>But it's already disallowed in most places.
>
>
> No it isn't. The plpgsql scanner treats := and = as *the same token*.
> They can be interchanged freely. This has nothing to do with the case
> of modifying a loop variable in particular.
I disagree. If the scanner treated them the same, then
if i := 1 then ...
would work, but it doesn't. The := is rejected in a conditional. Try the
following code if you don't believe me:
CREATE OR REPLACE FUNCTION foo () RETURNS INTEGER AS $$
DECLARE
i integer;
BEGIN
i := 1;
if i := 1 then
return 1;
end if;
return 0;
END;
$$ LANGUAGE plpgsql;
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?
http://archives.postgresql.org