Re: Better testing coverage and unified coding for plpgsql loops

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, Darafei Komяpa Praliaskouski <me@komzpa.net>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-01-03T19:31:44Z
Lists: pgsql-hackers
Tom Lane wrote:

> I really think we should stick with the macro implementation, unless
> somebody wants to do some actual investigation to prove that a
> function implementation imposes negligible cost.  I'm not prepared
> to just assume that, especially not after the work I just did on
> plpgsql record processing --- I initially thought that an extra
> function call or three wouldn't matter in those code paths either,
> but I found out differently.

I don't really care too much about the macro-or-function side of this,
but if you wanted to improve debuggability avoiding the performance cost
of a function call, you could use a static inline function, which is
supposed (AFAIK) to have performance characteristics equivalent to those
of a macro.  But again I'm not voting either way and I'm not in a
position to do the legwork either.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Commits

  1. Merge coding of return/exit/continue cases in plpgsql's loop statements.

  2. Improve regression tests' code coverage for plpgsql control structures.