Re: REVIEW: WIP: plpgsql - foreach in

Поиск
Список
Период
Сортировка
От Stephen Frost
Тема Re: REVIEW: WIP: plpgsql - foreach in
Дата
Msg-id 20110124024937.GT30352@tamriel.snowman.net
обсуждение исходный текст
Ответ на Re: REVIEW: WIP: plpgsql - foreach in  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: REVIEW: WIP: plpgsql - foreach in  (Robert Haas <robertmhaas@gmail.com>)
Re: REVIEW: WIP: plpgsql - foreach in  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Pavel,

* Pavel Stehule (pavel.stehule@gmail.com) wrote:
> I merge your changes and little enhanced comments.

Thanks.  Reviewing this further-

Why are you using 'FOREACH' here instead of just making it another
variation of 'FOR'?  What is 'FOUND' set to following this?  I realize
that might make the code easier, but it really doesn't seem to make much
sense to me from a usability point of view.

There also appears to be some extra whitespace changes that aren't
necessary and a number of places where you don't follow the indentation
conventions (eg: variable definitions in exec_stmt_foreach_a()).

I'm still not really thrilled with how the checking for scalar vs.
array, etc, is handled.  Additionally, what is this? :
       else if (stmt->row != NULL)       {              ctrl_var = estate->datums[stmt->row->dno];       }       else
   {           ctrl_var = estate->datums[stmt->rec->dno];       } 

Other comments- I don't like using 'i' and 'j', you really should use
better variable names, especially in large loops which contain other
loops.  I'd also suggest changing the outer loop to be equivilant to the
number of iterations that will be done instead of the number of items
and then to *not* update 'i' inside the inner-loop.  That structure is
really just confusing, imv (I certainly didn't entirely follow what was
happening there the first time I read it).  Isn't there a function you
could use to pull out the array slice you need on each iteration through
the array?
Thanks,
    Stephen

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

Предыдущее
От: Joseph Adams
Дата:
Сообщение: patch: Add PGXS support to hstore's Makefile (trivial)
Следующее
От: Robert Haas
Дата:
Сообщение: Re: sepgsql contrib module