Search Postgresql Archives

Re: My first PL/pgSQL function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 21, 2015 at 10:24 AM, Dane Foster <studdugie@xxxxxxxxx> 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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux