From: | Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Stephen Frost <sfrost(at)snowman(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: REVIEW: WIP: plpgsql - foreach in |
Date: | 2011-01-24 11:30:40 |
Message-ID: | AANLkTinadqBt4i9=NxtzULVsO03L-d-42XcJZLQtObdd@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2011/1/24 Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> Hello
>
>>
>>
>>> 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?
>
> I looked on code again. There are a few results:
>
> I'll change identifiers 'i' and 'j' with any, that you send. It's
> usual identifiers for nested loops and in this case they has really
> well known semantic - it's subscript of array.
>
> But others changes are more difficult
>
> we have to iterate over array's items because it allow seq. access to
> array's data. I need a global index for function "array_get_isnull". I
> can't to use a buildin functions like array_slize_size or
> array_get_slice, because there is high overhead of array_seek
> function. I redesigned the initial part of main cycle, but code is
> little bit longer :(, but I hope, it is more readable.
btw, having array_get_isnul accessible from contrib code is nice (I
used to copy/paste it for my own needs)
>
> Regards
>
> Pavel
>
>
>>>
>>
>> I don't know a better short index identifiers than I used. But I am
>> not against to change.
>>
>> I'll try to redesign main cycle.
>>
>> Regards
>>
>> Pavel Stehule
>>
>>
>>
>>> Thanks,
>>>
>>> Stephen
>>>
>>> -----BEGIN PGP SIGNATURE-----
>>> Version: GnuPG v1.4.10 (GNU/Linux)
>>>
>>> iEYEARECAAYFAk086MEACgkQrzgMPqB3kigCzQCffx0iVSMjU2UbOgAOaY/MvtOp
>>> iKsAnA5tdhKxTssdXJ+Rda4qkhNVm26g
>>> =Yn5O
>>> -----END PGP SIGNATURE-----
>>>
>>>
>>
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>
>
--
Cédric Villemain 2ndQuadrant
http://2ndQuadrant.fr/ PostgreSQL : Expertise, Formation et Support
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2011-01-24 11:49:58 | Re: multiset patch review |
Previous Message | Pavel Stehule | 2011-01-24 11:10:03 | Re: REVIEW: WIP: plpgsql - foreach in |