Re: My first PL/pgSQL function

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: My first PL/pgSQL function
Дата
Msg-id CAHyXU0yL+LW_idf835syitRjvP1GM_+fVqEXFtXvGN1pkmYRnw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: My first PL/pgSQL function  (Dane Foster <studdugie@gmail.com>)
Список pgsql-general
On Wed, Oct 21, 2015 at 10:24 AM, Dane Foster <studdugie@gmail.com> wrote:
> For posterity here is the final version. I ran it through PostgreSQL
> 9.5beta1 this morning so it's at least syntactically valid. Additionally I
> went w/ a list of INTO targets instead of a RECORD because it's a more
> elegant solution in that it made the code a little less verbose and a little
> less repetitive. The fact that in some cases it's faster is a serendipitous
> bonus.

*) I really dislike your formatting relative to what it was.  In fact,
it's a mess. You went to four spaces vs two, which causes a lot of
issues IMO.  SQL relative to other languages requires a lot of nested
indentation and this makes things challenging to format well.   This
is opinion I guess but I think it's a regression.

aside: do not use tabs in sql, ever -- I dislike tabs generally but in
postgres .sql it breaks pasting to psql.

*) your indent spacing is not regular (meaning, not always exactly 4).
For example,

        END CASE;
  END IF;

Irregular indentation leads directly to:
*) lots of extra work and irrelevant-to-the-actual-change whitespace adjustments
*) coding difficulty locating the end of the block in the face of
indentation changes.  At the bottom portion of your function, I'm not
easily finding the matching END IF to the:

            ELSE
                -- This should NEVER happen!
                IF danglingvoucher

merlin


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: My first PL/pgSQL function
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: trouble downloading postgres 9.4 for RHEL 6.x