Re: final patch - plpgsql: for-in-array
От | Pavel Stehule |
---|---|
Тема | Re: final patch - plpgsql: for-in-array |
Дата | |
Msg-id | AANLkTik9RjMN9sRUEMaGiyi_KmRxr9cj6XhJY9YfaM1K@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: final patch - plpgsql: for-in-array (Pavel Stehule <pavel.stehule@gmail.com>) |
Список | pgsql-hackers |
sorry, there was a broken message 2010/11/24 Pavel Stehule <pavel.stehule@gmail.com>: > 2010/11/24 Robert Haas <robertmhaas@gmail.com>: >> On Tue, Nov 23, 2010 at 8:56 PM, Cédric Villemain >> <cedric.villemain.debian@gmail.com> wrote: >>> 2010/11/23 Robert Haas <robertmhaas@gmail.com>: >>>> On Mon, Nov 22, 2010 at 11:55 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote: >>>>> ok, I can only recapitulate so this feature was proposed cca two >>>>> months ago, and minimally Tom and maybe you did agreement - with >>>>> request on syntax - do you remember? I am little bit tired so this >>>>> agreement was changed when I spent my time with this. >>>> >>>> I went back and reread the thread I believe you're speaking about. >>>> The first post is here: >>>> >>>> http://archives.postgresql.org/pgsql-hackers/2010-09/msg01945.php >>> >>> Here perhaps ? (or before) >>> >>> http://archives.postgresql.org/pgsql-hackers/2010-09/msg01983.php >> >> Dang. You're right. I stand corrected. >> > > Sorry, I though so you and Tom hasn't a problem with syntax > FOR-IN-ARRAY (what is a Kevin Grittner's proposal). So problematic is > just my original proposal FOR-IN-expr, but proposed feature isn't > rejected. > Sorry, I though so you and Tom hasn't a problem with syntax FOR-IN-ARRAY (what is a Kevin Grittner's proposal). I though so problematic is just my original proposal FOR-IN-expr, but proposed feature isn't a problem. My proposal isn't really genial - is true so first my motivation was to replace unwished pattern "array_lower(var,1)..array_upper(var,1)". It's relative simple in ADA, where statement FOR is defined over range type, and relative impossible in PL/pgSQL, where range type doesn't exists yet. Some special construct in PL/pgSQL can to solve iteration over array significantly better and simpler then any other solution - there must not be used the syntax FOR-IN-ARRAY - with any next test and next code checking I am more sure: why?: * there is clean indicia so developer wants to process all items in array, or almost all * there isn't random access to array!! * is possibility for a reuse varlena's value stored in array without a temporal copy - with maybe some trick!! * there is a very low overhead I am sorry, so I didn't speaking about these advices early. I though about other possible syntax - what do you think about "FOR var OVER expr LOOP ... END LOOP" ? "OVER" is keyword now Regards Pavel >> -- >> Robert Haas >> EnterpriseDB: http://www.enterprisedb.com >> The Enterprise PostgreSQL Company >> >
В списке pgsql-hackers по дате отправления: