Re: plpgsql.warn_shadow

Поиск
Список
Период
Сортировка
От Joel Jacobson
Тема Re: plpgsql.warn_shadow
Дата
Msg-id CAASwCXcySDF92Tyzu5tjR_6Yw2+bKXvQS79sjvMVLA3Y6JOwLg@mail.gmail.com
обсуждение исходный текст
Ответ на plpgsql.warn_shadow  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: plpgsql.warn_shadow  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Jan 15, 2014 at 1:34 AM, Marko Tiikkaja <marko@joh.to> wrote:
> Hi all!
>
> It's me again, trying to find a solution to the most common mistakes I make.
> This time it's accidental shadowing of variables, especially input
> variables.  I've wasted several hours banging my head against the wall while
> shouting "HOW CAN THIS VARIABLE ALWAYS BE NULL?".  I can't believe I'm the
> only one.  To give you a rough idea on how it works:

+1

I've made the same mistake countless of times.
For me, it always happens when I have a declared variable in a
function which I later on make an input parameter instead and forget
to remove it under the declare section of the function.

Regarding the warning vs error discussion, I think it depends on if we
want to maximize short-term or long-term user-friendliness.
In the short-term it's more user-friendly to lie to the user and
pretend everything is fine by not crashing the PL/pgSQL-application
and instead writing warning messages in the log file which might not
be seen. But in the long-term the user will run into problems caused
by the bugs.
With MySQL, invalid dates are accepted unless special settings are
turned on, but yes, warnings are emitted which most implementations
ignore. This is bad.

I strongly think it should be made an error, because it is most
certainly an error, and even if it's not, it's at least bad coding
style and the code should be fixed anyway, or if one is lazy, turn
this off in the config file and make it a warning instead.

I don't think we should be too afraid to break backward compability if
it only affects a theoretical percentage of the users in a new major
release.



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: building pgadmin4
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Custom Scan APIs (Re: Custom Plan node)