Re: string_to_array with an empty input string
От | Robert Haas |
---|---|
Тема | Re: string_to_array with an empty input string |
Дата | |
Msg-id | AANLkTi=Nxf1ViXop_k4hZtC=ASd2dTPCeDryUndZLZKg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: string_to_array with an empty input string (Peter Geoghegan <peter.geoghegan86@gmail.com>) |
Ответы |
Re: string_to_array with an empty input string
Re: string_to_array with an empty input string Re: string_to_array with an empty input string |
Список | pgsql-hackers |
On Wed, Aug 11, 2010 at 1:32 PM, Peter Geoghegan <peter.geoghegan86@gmail.com> wrote: >> Yeah, I think David's examples are talking about the behavior of join, >> but we're trying to decide what split should do. I think the main >> argument for making it return NULL is that you can then fairly easily >> use COALESCE() to get whatever you want. That's a bit more difficult >> if you use return any other value. > > I think that there's a need for additional built-in array functions, > including one to succinctly test if an array has no elements. What do you propose? I think the easiest ways to do it right now are: array_length(arr, 1) is null or just using an equality test, like this: arr = '{}'::int[] > Iterating through an array with plpgsql, for example, is more clunky > than it should be. Really? FOR var IN SELECT UNNEST(arr) LOOP ... END LOOP I mean, doing everything is sort of clunky in PL/pgsql, but this doesn't seem particularly bad as PL/pgsql idioms go. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Postgres Company
В списке pgsql-hackers по дате отправления: