Re: plpgsql.warn_shadow - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: plpgsql.warn_shadow
Date
Msg-id 52EEF807.8060206@joh.to
Whole thread Raw
In response to Re: plpgsql.warn_shadow  (Simon Riggs <simon@2ndQuadrant.com>)
Responses Re: plpgsql.warn_shadow  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Hi everyone,

Here's a new version of the patch.  Added new tests and docs and changed
the GUCs per discussion.

plpgsql.warnings_as_errors only affects compilation at CREATE FUNCTION time:

=# set plpgsql.warnings to 'all';
SET
=#* set plpgsql.warnings_as_errors to true;
SET
=#* select foof(1); -- compiled since it's the first call in this session
WARNING:  variable "f1" shadows a previously defined variable
LINE 2: declare f1 int;
                 ^
  foof
------

(1 row)

=#* create or replace function foof(f1 int) returns void as
$$
declare f1 int;
begin
end $$ language plpgsql;
ERROR:  variable "f1" shadows a previously defined variable
LINE 3: declare f1 int;


Currently, plpgsql_warnings is a boolean since there's only one warning
we implement.  The idea is to make it a bit field of some kind in the
future when we add more warnings.  Starting that work for 9.4 seemed
like overkill, though.  I tried to keep things simple.


Regards,
Marko Tiikkaja

Attachment

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: bugfix patch for json_array_elements
Next
From: Etsuro Fujita
Date:
Subject: Re: WITH ORDINALITY planner improvements