Re: [HACKERS] string_to_array with empty input
От | Robert Haas |
---|---|
Тема | Re: [HACKERS] string_to_array with empty input |
Дата | |
Msg-id | 603c8f070904011228p524ff06ci266f3080c0d25048@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] string_to_array with empty input (justin <justin@emproshunts.com>) |
Ответы |
Re: [HACKERS] string_to_array with empty input
Re: [HACKERS] string_to_array with empty input |
Список | pgsql-general |
On Wed, Apr 1, 2009 at 1:05 PM, justin <justin@emproshunts.com> wrote: > I'm still a hold out, We are taking a string putting it into a array based > on a delimiter. That is very simple and straight forward. Yet many argue > if we want to cast this into another data type the function should deal with > in limited cases. > > string_to_array('',',')::INT[] works as proposed > > But > string_to_array(',,,', ',' )::INT[] Fails > or > string_to_array('1,2,,4', ',' )::INT[] Fails . But... but... those aren't comma-separated lists of integers. If they were, it would work. string_to_array('cow,dog,horse')::INT[] will also fail. If you take 0 items of any type whatsoever and join them together with commas, you will get the empty string. It is also true that if you join 1 item together with commas, you will get that item back, and if that item is the empty string, you will now have the empty string. I think it's better to worry more about the first case because it applies to any type at all, whereas the latter case ONLY applies in situations where the empty string is a potentially legal value. ...Robert
В списке pgsql-general по дате отправления: